Skip to content

Commit 20f9f72

Browse files
authored
Fixed the rt screen space shadows not using the correct asset for allocating the history buffers. (#6613)
1 parent 9d4dd25 commit 20f9f72

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8080
- Fixed for APV debug mode breaking rendering when switching to an asset with APV disabled.
8181
- Fixed potential asymmetrical resource release in the volumetric clouds (case 1388218).
8282
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).
83+
- Fixed the rt screen space shadows not using the correct asset for allocating the history buffers.
8384

8485
### Changed
8586
- Converted most TGA textures files to TIF to reduce the size of HDRP material samples.

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadows.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public partial class HDRenderPipeline
5757
// This buffer holds the unfiltered, accumulated, shadow values, it is accessed with the same index as the one used at runtime (aka screen space shadow slot)
5858
static RTHandle ShadowHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
5959
{
60-
HDRenderPipelineAsset hdPipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
60+
HDRenderPipeline hdrp = RenderPipelineManager.currentPipeline as HDRenderPipeline;
61+
HDRenderPipelineAsset hdPipelineAsset = hdrp.m_Asset;
6162
GraphicsFormat graphicsFormat = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
62-
HDRenderPipeline hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
63-
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
63+
int numShadowSlices = Math.Max((int)Math.Ceiling(hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
6464
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
6565
enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ScreenSpaceShadowHistoryBuffer{1}", viewName, frameIndex));
6666
}
@@ -70,20 +70,20 @@ static RTHandle ShadowHistoryBufferAllocatorFunction(string viewName, int frameI
7070
// It is accessed with the same index used at runtime (aka screen space shadow slot)
7171
static RTHandle ShadowHistoryValidityBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
7272
{
73-
HDRenderPipelineAsset hdPipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
74-
HDRenderPipeline hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
73+
HDRenderPipeline hdrp = RenderPipelineManager.currentPipeline as HDRenderPipeline;
74+
HDRenderPipelineAsset hdPipelineAsset = hdrp.m_Asset;
7575
GraphicsFormat graphicsFormat = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
76-
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
76+
int numShadowSlices = Math.Max((int)Math.Ceiling(hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
7777
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
7878
enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ShadowHistoryValidityBuffer{1}", viewName, frameIndex));
7979
}
8080

8181
static RTHandle ShadowHistoryDistanceBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
8282
{
83-
HDRenderPipelineAsset hdPipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
84-
HDRenderPipeline hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
83+
HDRenderPipeline hdrp = RenderPipelineManager.currentPipeline as HDRenderPipeline;
84+
HDRenderPipelineAsset hdPipelineAsset = hdrp.m_Asset;
8585
GraphicsFormat graphicsFormat = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
86-
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
86+
int numShadowSlices = Math.Max((int)Math.Ceiling(hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
8787
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
8888
enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ShadowHistoryDistanceBuffer{1}", viewName, frameIndex));
8989
}

0 commit comments

Comments
 (0)