Skip to content

Commit 589896f

Browse files
anisunitysebastienlagarde
authored andcommitted
Fixed the rt screen space shadows not using the correct asset for allocating the history buffers. #6613
1 parent 27b6b11 commit 589896f

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
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Fixed issue with typed loads on RGBA16F in Volumetric Lighting Filtering.
1515
- Fixed potential asymmetrical resource release in the volumetric clouds (case 1388218).
1616
- Fixed the intensity of the sky being reduced signficantly even if there is no clouds (case 1388279).
17+
- Fixed the rt screen space shadows not using the correct asset for allocating the history buffers.
1718

1819
## [13.1.4] - 2021-12-04
1920

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)