Skip to content

Commit b0d24fe

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.5] Fix Frame Debugger flicker with water.
1 parent 99e3ea2 commit b0d24fe

1 file changed

Lines changed: 35 additions & 9 deletions

File tree

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,11 @@ internal void InternalRender(ScriptableRenderContext renderContext, List<Camera>
21632163
Render(renderContext, cameras);
21642164
}
21652165

2166+
#if UNITY_EDITOR
2167+
// Throttle logging for WaterUpdate. Remove when FrameDebugger is improved to handle variable updates.
2168+
double m_RealtimeSinceLastLogUpdateWaterSurfaces;
2169+
#endif
2170+
21662171
/// <summary>
21672172
/// RenderPipeline Render implementation.
21682173
/// </summary>
@@ -2229,15 +2234,36 @@ protected override void Render(ScriptableRenderContext renderContext, List<Camer
22292234

22302235
if (m_Asset.currentPlatformRenderPipelineSettings.supportWater)
22312236
{
2232-
// Update the water surfaces
2233-
var commandBuffer = CommandBufferPool.Get("");
2234-
waterSystem.UpdateWaterSurfaces(commandBuffer);
2235-
renderContext.ExecuteCommandBuffer(commandBuffer);
2236-
renderContext.Submit();
2237-
commandBuffer.Clear();
2238-
CommandBufferPool.Release(commandBuffer);
2239-
}
22402237

2238+
#if UNITY_EDITOR
2239+
// Disable water updates while in the FrameDebugger until it can be improved.
2240+
// Intermittent blit/CPU-readback events cause flicker in the FrameDebugger.
2241+
// NOTE: This means those events cannot be debugged with the FrameDebugger for now.
2242+
if (FrameDebugger.enabled)
2243+
{
2244+
// Notify the user that we have disabled the water updates for the FrameDebugger to avoid flicker.
2245+
if (Time.realtimeSinceStartupAsDouble - m_RealtimeSinceLastLogUpdateWaterSurfaces > 60.0)
2246+
{
2247+
Debug.Log("Water surface updates are disabled while the FrameDebugger is active. Some events might not be visible in the FrameDebugger.");
2248+
m_RealtimeSinceLastLogUpdateWaterSurfaces = Time.realtimeSinceStartupAsDouble;
2249+
}
2250+
}
2251+
else
2252+
{
2253+
m_RealtimeSinceLastLogUpdateWaterSurfaces = 0.0; // Make sure we notify on FrameDebugger activation.
2254+
#else
2255+
{
2256+
#endif
2257+
2258+
// Update the water surfaces
2259+
var commandBuffer = CommandBufferPool.Get("");
2260+
waterSystem.UpdateWaterSurfaces(commandBuffer);
2261+
renderContext.ExecuteCommandBuffer(commandBuffer);
2262+
renderContext.Submit();
2263+
commandBuffer.Clear();
2264+
CommandBufferPool.Release(commandBuffer);
2265+
}
2266+
}
22412267

22422268
#if DEVELOPMENT_BUILD || UNITY_EDITOR
22432269

@@ -3471,7 +3497,7 @@ void ReAllocateOffscreenUIColorBufferIfNeeded()
34713497
}
34723498
}
34733499
}
3474-
3500+
34753501
void AllocateCustomPassBuffers()
34763502
{
34773503
m_CustomPassColorBuffer = new Lazy<RTHandle>(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer"));

0 commit comments

Comments
 (0)