diff --git a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp index f82123a46..6b92607ea 100644 --- a/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp +++ b/Source/Engine/Renderer/GI/DynamicDiffuseGlobalIllumination.cpp @@ -46,7 +46,8 @@ GPU_CB_STRUCT(Data0 { GlobalSignDistanceFieldPass::ConstantsData GlobalSDF; GlobalSurfaceAtlasPass::ConstantsData GlobalSurfaceAtlas; ShaderGBufferData GBuffer; - Float2 Padding0; + float Padding0; + uint32 ProbesCount; float ResetBlend; float TemporalTime; Int4 ProbeScrollClears[4]; @@ -475,6 +476,7 @@ bool DynamicDiffuseGlobalIlluminationPass::RenderInner(RenderContext& renderCont data.DDGI = ddgiData.Result.Constants; data.GlobalSDF = bindingDataSDF.Constants; data.GlobalSurfaceAtlas = bindingDataSurfaceAtlas.Constants; + data.ProbesCount = data.DDGI.ProbesCounts[0] * data.DDGI.ProbesCounts[1] * data.DDGI.ProbesCounts[2]; data.ResetBlend = clear ? 1.0f : 0.0f; for (int32 cascadeIndex = 0; cascadeIndex < cascadesCount; cascadeIndex++) { diff --git a/Source/Shaders/GI/DDGI.shader b/Source/Shaders/GI/DDGI.shader index 92df2c043..4eb71a7ae 100644 --- a/Source/Shaders/GI/DDGI.shader +++ b/Source/Shaders/GI/DDGI.shader @@ -30,7 +30,8 @@ DDGIData DDGI; GlobalSDFData GlobalSDF; GlobalSurfaceAtlasData GlobalSurfaceAtlas; GBufferData GBuffer; -float2 Padding0; +float Padding0; +uint ProbesCount; float ResetBlend; float TemporalTime; int4 ProbeScrollClears[4]; @@ -86,8 +87,7 @@ META_CS(true, FEATURE_LEVEL_SM5) void CS_Classify(uint3 DispatchThreadId : SV_DispatchThreadID) { uint probeIndex = DispatchThreadId.x; - uint probesCount = DDGI.ProbesCounts.x * DDGI.ProbesCounts.y * DDGI.ProbesCounts.z; - if (probeIndex >= probesCount) + if (probeIndex >= ProbesCount) return; uint3 probeCoords = GetDDGIProbeCoords(DDGI, probeIndex); probeIndex = GetDDGIScrollingProbeIndex(DDGI, CascadeIndex, probeCoords); @@ -271,7 +271,6 @@ META_CS(true, FEATURE_LEVEL_SM5) [numthreads(1, 1, 1)] void CS_UpdateProbesInitArgs() { - uint probesCount = DDGI.ProbesCounts.x * DDGI.ProbesCounts.y * DDGI.ProbesCounts.z; uint activeProbesCount = ActiveProbes.Load(0); uint arg = 0; for (uint probesOffset = 0; probesOffset < activeProbesCount; probesOffset += DDGI_TRACE_RAYS_PROBES_COUNT_LIMIT)