From a057ea41ab5b044063c7f780304e788c0003c340 Mon Sep 17 00:00:00 2001 From: David Svez Date: Wed, 5 Aug 2026 23:26:22 -0500 Subject: [PATCH] Clear inactive DDGI dispatch arguments --- Source/Shaders/GI/DDGI.shader | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Shaders/GI/DDGI.shader b/Source/Shaders/GI/DDGI.shader index bade984fc..90d705f78 100644 --- a/Source/Shaders/GI/DDGI.shader +++ b/Source/Shaders/GI/DDGI.shader @@ -352,10 +352,12 @@ void CS_UpdateProbesInitArgs() { uint activeProbesCount = ActiveProbes.Load(0); // Counter at 0 activeProbesCount = min(activeProbesCount, ProbesCount); + // The CPU submits every allocated batch, so always overwrite all arguments to avoid + // dispatching stale work left by a previous cascade or frame. uint arg = 0; - for (uint probesOffset = 0; probesOffset < activeProbesCount; probesOffset += DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT) + for (uint probesOffset = 0; probesOffset < ProbesCount; probesOffset += DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT) { - uint probesBatchSize = min(activeProbesCount - probesOffset, DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT); + uint probesBatchSize = probesOffset < activeProbesCount ? min(activeProbesCount - probesOffset, DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT) : 0; UpdateProbesInitArgs[arg++] = probesBatchSize; UpdateProbesInitArgs[arg++] = 1; UpdateProbesInitArgs[arg++] = 1;