diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 8a1771e2073..9a89b7dd9e2 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -602,6 +602,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issue that caused not all baked reflection to be deleted upon clicking "Clear Baked Data" in the lighting menu (case 1136080) - Fixed an issue where asset preview could be rendered white because of static lighting sky. - Fixed an issue where static lighting was not updated when removing the static lighting sky profile. +- Fixed the show cookie atlas debug mode not displaying correctly when enabling the clear cookie atlas option. ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 34bc9598dba..7a3e7461d07 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -1093,7 +1093,7 @@ void RegisterLightingDebug() children = { new DebugUI.UIntField { displayName = "Mip Level", getter = () => data.lightingDebugSettings.cookieAtlasMipLevel, setter = value => data.lightingDebugSettings.cookieAtlasMipLevel = value, min = () => 0, max = () => (uint)(RenderPipelineManager.currentPipeline as HDRenderPipeline).GetCookieAtlasMipCount()}, - new DebugUI.Button { displayName = "Reset Cookie Atlas", action = () => data.lightingDebugSettings.clearCookieAtlas = true} + new DebugUI.BoolField { displayName = "Clear Cookie Atlas", getter = () => data.lightingDebugSettings.clearCookieAtlas, setter = value => data.lightingDebugSettings.clearCookieAtlas = value} } }); } @@ -1118,7 +1118,7 @@ void RegisterLightingDebug() children = { new DebugUI.UIntField { displayName = "Mip Level", getter = () => data.lightingDebugSettings.planarReflectionProbeMipLevel, setter = value => data.lightingDebugSettings.planarReflectionProbeMipLevel = value, min = () => 0, max = () => (uint)(RenderPipelineManager.currentPipeline as HDRenderPipeline).GetPlanarReflectionProbeMipCount()}, - new DebugUI.Button { displayName = "Reset Planar Atlas", action = () => data.lightingDebugSettings.clearPlanarReflectionProbeAtlas = true }, + new DebugUI.BoolField { displayName = "Clear Planar Atlas", getter = () => data.lightingDebugSettings.clearPlanarReflectionProbeAtlas, setter = value => data.lightingDebugSettings.clearPlanarReflectionProbeAtlas = value}, } }); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 71ab4ad5a9e..644fcd0d80c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -997,7 +997,7 @@ void LightLoopNewRender() m_ScreenSpaceShadowsUnion.Clear(); } - void LightLoopNewFrame(HDCamera hdCamera) + void LightLoopNewFrame(CommandBuffer cmd, HDCamera hdCamera) { var frameSettings = hdCamera.frameSettings; @@ -1015,6 +1015,13 @@ void LightLoopNewFrame(HDCamera hdCamera) { m_WorldToViewMatrices.Add(GetWorldToViewMatrix(hdCamera, viewIndex)); } + + // Clear the cookie atlas if needed at the beginning of the frame. + if (m_DebugDisplaySettings.data.lightingDebugSettings.clearCookieAtlas) + { + m_TextureCaches.lightCookieManager.ResetAllocator(); + m_TextureCaches.lightCookieManager.ClearAtlasTexture(cmd); + } } void LightLoopReleaseResolutionDependentBuffers() @@ -4062,12 +4069,6 @@ static void RenderLightLoopDebugOverlay(in DebugParameters debugParameters, Comm } } - if (lightingDebug.clearCookieAtlas) - { - parameters.cookieManager.ResetAllocator(); - parameters.cookieManager.ClearAtlasTexture(cmd); - } - if (lightingDebug.displayCookieAtlas) { using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.DisplayCookieAtlas))) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 61fe99366e4..a437a07dbd1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -2068,7 +2068,7 @@ AOVRequestData aovRequest // Do anything we need to do upon a new frame. // The NewFrame must be after the VolumeManager update and before Resize because it uses properties set in NewFrame - LightLoopNewFrame(hdCamera); + LightLoopNewFrame(cmd, hdCamera); // Apparently scissor states can leak from editor code. As it is not used currently in HDRP (apart from VR). We disable scissor at the beginning of the frame. cmd.DisableScissorRect();