Skip to content

Commit d42f51f

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.4] Fix Frame Debugger flicker with water.
1 parent 0fe81d9 commit d42f51f

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
@@ -2156,6 +2156,11 @@ internal void InternalRender(ScriptableRenderContext renderContext, List<Camera>
21562156
Render(renderContext, cameras);
21572157
}
21582158

2159+
#if UNITY_EDITOR
2160+
// Throttle logging for WaterUpdate. Remove when FrameDebugger is improved to handle variable updates.
2161+
double m_RealtimeSinceLastLogUpdateWaterSurfaces;
2162+
#endif
2163+
21592164
/// <summary>
21602165
/// RenderPipeline Render implementation.
21612166
/// </summary>
@@ -2226,15 +2231,36 @@ protected override void Render(ScriptableRenderContext renderContext, List<Camer
22262231

22272232
if (m_Asset.currentPlatformRenderPipelineSettings.supportWater)
22282233
{
2229-
// Update the water surfaces
2230-
var commandBuffer = CommandBufferPool.Get("");
2231-
waterSystem.UpdateWaterSurfaces(commandBuffer);
2232-
renderContext.ExecuteCommandBuffer(commandBuffer);
2233-
renderContext.Submit();
2234-
commandBuffer.Clear();
2235-
CommandBufferPool.Release(commandBuffer);
2236-
}
22372234

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

22392265
#if DEVELOPMENT_BUILD || UNITY_EDITOR
22402266

@@ -3480,7 +3506,7 @@ void ReAllocateOffscreenUIColorBufferIfNeeded()
34803506
}
34813507
}
34823508
}
3483-
3509+
34843510
void AllocateCustomPassBuffers()
34853511
{
34863512
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)