Skip to content

Commit d9728a9

Browse files
anisunitysebastienlagarde
authored andcommitted
Fixed the rt screen space shadows not using the correct asset for allocating the history buffers. #6613
1 parent 40df3be commit d9728a9

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
@@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7070
- Fixed issue with typed loads on RGBA16F in Volumetric Lighting Filtering.
7171
- Fixed the fade in mode of the clouds not impacting the volumetric clouds shadows (case 1381652).
7272
- Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279).
73+
- Fixed the rt screen space shadows not using the correct asset for allocating the history buffers.
7374

7475
## [12.1.3] - 2021-11-17
7576

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)