diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index ef0c8b4be0d..0149f6d0fc7 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -24,6 +24,7 @@ The version number for this package has increased due to a version update of a r - Fixed upside down XR occlusion mesh. - Fixed precision issue with the atmospheric fog. - Claryfied doc for the LayeredLit material. +- Fixing exceptions in the console when putting the SSGI in low quality mode (render graph). ### Changed - Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.RenderGraph.cs index 0d1106cb5df..bd45ce4ea2b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.RenderGraph.cs @@ -75,13 +75,13 @@ class UpscaleSSGIPassData public TextureHandle outputBuffer; } - TextureHandle UpscaleSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllumination giSettings, TextureHandle depthPyramid, TextureHandle inputBuffer) + TextureHandle UpscaleSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllumination giSettings, HDUtils.PackedMipChainInfo info, TextureHandle depthPyramid, TextureHandle inputBuffer) { using (var builder = renderGraph.AddRenderPass("Upscale SSGI", out var passData, ProfilingSampler.Get(HDProfileId.SSGIUpscale))) { builder.EnableAsyncCompute(false); - passData.parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings); ; + passData.parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings, info); passData.depthTexture = builder.ReadTexture(depthPyramid); passData.inputBuffer = builder.ReadTexture(inputBuffer); passData.outputBuffer = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true) @@ -137,7 +137,7 @@ TextureHandle ConvertSSGI(RenderGraph renderGraph, HDCamera hdCamera, bool halfR } } - TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, ShaderVariablesRaytracing shaderVariablesRayTracingCB) + TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, ShaderVariablesRaytracing shaderVariablesRayTracingCB, HDUtils.PackedMipChainInfo info) { // Grab the global illumination volume component GlobalIllumination giSettings = hdCamera.volumeStack.GetComponent(); @@ -160,7 +160,7 @@ TextureHandle RenderSSGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHand // Upscale it if required // If this was a half resolution effect, we still have to upscale it if (!giSettings.fullResolutionSS) - colorBuffer = UpscaleSSGI(renderGraph, hdCamera, giSettings, depthPyramid, colorBuffer); + colorBuffer = UpscaleSSGI(renderGraph, hdCamera, giSettings, info, depthPyramid, colorBuffer); return colorBuffer; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs index 174c86780e0..59d629a7a68 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs @@ -325,7 +325,7 @@ struct SSGIUpscaleParameters public int upscaleKernel; } - SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllumination settings) + SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllumination settings, HDUtils.PackedMipChainInfo info) { SSGIUpscaleParameters parameters = new SSGIUpscaleParameters(); @@ -336,7 +336,6 @@ SSGIUpscaleParameters PrepareSSGIUpscaleParameters(HDCamera hdCamera, GlobalIllu parameters.halfScreenSize.Set(parameters.texWidth / 2, parameters.texHeight / 2, 1.0f / (parameters.texWidth * 0.5f), 1.0f / (parameters.texHeight * 0.5f)); // Set the generation parameters - var info = m_SharedRTManager.GetDepthBufferMipChainInfo(); parameters.firstMipOffset.Set(HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].x), HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].y)); // Grab the right kernel @@ -467,7 +466,7 @@ void RenderSSGI(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext re { ComputeShader bilateralUpsampleCS = m_Asset.renderPipelineResources.shaders.bilateralUpsampleCS; - SSGIUpscaleParameters parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings); + SSGIUpscaleParameters parameters = PrepareSSGIUpscaleParameters(hdCamera, giSettings, m_SharedRTManager.GetDepthBufferMipChainInfo()); SSGIUpscaleResources resources = PrepareSSGIUpscaleResources(hdCamera, buffer00, buffer10); ExecuteSSGIUpscale(cmd, parameters, resources); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 7c2965549db..c9997ae6475 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -119,7 +119,7 @@ void ExecuteWithRenderGraph( RenderRequest renderRequest, switch (GetIndirectDiffuseMode(hdCamera)) { case IndirectDiffuseMode.ScreenSpace: - lightingBuffers.ssgiLightingBuffer = RenderSSGI(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_ShaderVariablesRayTracingCB); + lightingBuffers.ssgiLightingBuffer = RenderSSGI(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_ShaderVariablesRayTracingCB, GetDepthBufferMipChainInfo()); break; case IndirectDiffuseMode.Raytrace: