Skip to content

Fix show cookie atlas debug mode #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
});
}
Expand All @@ -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},
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ void LightLoopNewRender()
m_ScreenSpaceShadowsUnion.Clear();
}

void LightLoopNewFrame(HDCamera hdCamera)
void LightLoopNewFrame(CommandBuffer cmd, HDCamera hdCamera)
{
var frameSettings = hdCamera.frameSettings;

Expand All @@ -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()
Expand Down Expand Up @@ -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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down