From 4f1d684ef855c2dd72bfd2ff2b60a4a7af58717d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Delgado=20Kr=C3=A4mer?= Date: Sun, 26 May 2024 22:29:51 +0200 Subject: [PATCH] gi/hdGatling: move maxVolumeWalkLength render setting to a push constant --- src/gi/include/Gi.h | 2 +- src/gi/shaders/interface/rp_main.h | 3 ++- src/gi/src/Gi.cpp | 4 ++-- src/gi/src/GlslShaderGen.cpp | 2 -- src/gi/src/GlslShaderGen.h | 1 - src/gi/src/main.cpp | 4 ++-- src/hdGatling/renderPass.cpp | 4 ++-- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/gi/include/Gi.h b/src/gi/include/Gi.h index 388d77d0..fbbf800e 100644 --- a/src/gi/include/Gi.h +++ b/src/gi/include/Gi.h @@ -115,7 +115,6 @@ namespace gtl bool progressiveAccumulation; GiScene* scene; uint32_t mediumStackSize; - uint32_t maxVolumeWalkLength; }; struct GiGeomCacheParams @@ -137,6 +136,7 @@ namespace gtl uint32_t rrBounceOffset; float rrInvMinTermProb; float maxSampleValue; + uint32_t maxVolumeWalkLength; float backgroundColor[4]; GiDomeLight* domeLight; GiScene* scene; diff --git a/src/gi/shaders/interface/rp_main.h b/src/gi/shaders/interface/rp_main.h index 8c5e4b5c..62ac99d5 100644 --- a/src/gi/shaders/interface/rp_main.h +++ b/src/gi/shaders/interface/rp_main.h @@ -99,7 +99,8 @@ struct PushConstants GI_FLOAT lightIntensityMultiplier; GI_UINT clipRangePacked; GI_FLOAT sensorExposure; - /* 3 floats free */ + GI_UINT maxVolumeWalkLength; // NOTE: can be quantized + /* 2 floats free */ }; const GI_UINT BLAS_PAYLOAD_BITFLAG_IS_DOUBLE_SIDED = (1 << 0); diff --git a/src/gi/src/Gi.cpp b/src/gi/src/Gi.cpp index fe2db402..40256367 100644 --- a/src/gi/src/Gi.cpp +++ b/src/gi/src/Gi.cpp @@ -1153,7 +1153,6 @@ namespace gtl .depthOfField = params.depthOfField, .filterImportanceSampling = params.filterImportanceSampling, .materialCount = params.materialCount, - .maxVolumeWalkLength = params.maxVolumeWalkLength, .nextEventEstimation = nextEventEstimation, .progressiveAccumulation = params.progressiveAccumulation, .reorderInvocations = s_deviceFeatures.rayTracingInvocationReorder, @@ -1460,7 +1459,8 @@ namespace gtl .rrInvMinTermProb = params.rrInvMinTermProb, .lightIntensityMultiplier = params.lightIntensityMultiplier, .clipRangePacked = glm::packHalf2x16(glm::vec2(params.camera.clipStart, params.camera.clipEnd)), - .sensorExposure = params.camera.exposure + .sensorExposure = params.camera.exposure, + .maxVolumeWalkLength = params.maxVolumeWalkLength }; std::vector buffers; diff --git a/src/gi/src/GlslShaderGen.cpp b/src/gi/src/GlslShaderGen.cpp index 1f414650..5ce07251 100644 --- a/src/gi/src/GlslShaderGen.cpp +++ b/src/gi/src/GlslShaderGen.cpp @@ -126,8 +126,6 @@ namespace gtl stitcher.appendDefine("PROGRESSIVE_ACCUMULATION"); } - stitcher.appendDefine("MAX_VOLUME_WALK_LENGTH", (int32_t) params.maxVolumeWalkLength); - fs::path filePath = m_shaderPath / fileName; if (!stitcher.appendSourceFile(filePath)) { diff --git a/src/gi/src/GlslShaderGen.h b/src/gi/src/GlslShaderGen.h index 6d506204..26c7c643 100644 --- a/src/gi/src/GlslShaderGen.h +++ b/src/gi/src/GlslShaderGen.h @@ -71,7 +71,6 @@ namespace gtl bool depthOfField; bool filterImportanceSampling; uint32_t materialCount; - uint32_t maxVolumeWalkLength; bool nextEventEstimation; bool progressiveAccumulation; bool reorderInvocations; diff --git a/src/gi/src/main.cpp b/src/gi/src/main.cpp index d71ae08d..e1b77130 100644 --- a/src/gi/src/main.cpp +++ b/src/gi/src/main.cpp @@ -138,8 +138,7 @@ TEST_CASE_FIXTURE(GraphicalTestFixture, "EmptyScene") .nextEventEstimation = false, .progressiveAccumulation = true, .scene = m_scene, - .mediumStackSize = 1, - .maxVolumeWalkLength = 7 + .mediumStackSize = 1 }; GiShaderCache* shaderCache = giCreateShaderCache(shaderCacheParams); @@ -178,6 +177,7 @@ TEST_CASE_FIXTURE(GraphicalTestFixture, "EmptyScene") .rrBounceOffset = 255, .rrInvMinTermProb = 0.0f, .maxSampleValue = 100.0f, + .maxVolumeWalkLength = 7, .backgroundColor = { 0.5f, 0.5f, 0.5f, 1.0f }, .domeLight = nullptr, .scene = m_scene diff --git a/src/hdGatling/renderPass.cpp b/src/hdGatling/renderPass.cpp index e0c91f05..eff8aa98 100644 --- a/src/hdGatling/renderPass.cpp +++ b/src/hdGatling/renderPass.cpp @@ -437,8 +437,7 @@ void HdGatlingRenderPass::_Execute(const HdRenderPassStateSharedPtr& renderPassS .nextEventEstimation = _settings.find(HdGatlingSettingsTokens->nextEventEstimation)->second.Get(), .progressiveAccumulation = _settings.find(HdGatlingSettingsTokens->progressiveAccumulation)->second.Get(), .scene = _scene, - .mediumStackSize = (uint32_t) _settings.find(HdGatlingSettingsTokens->mediumStackSize)->second.Get(), - .maxVolumeWalkLength = (uint32_t) _settings.find(HdGatlingSettingsTokens->maxVolumeWalkLength)->second.Get() + .mediumStackSize = (uint32_t) _settings.find(HdGatlingSettingsTokens->mediumStackSize)->second.Get() }; _shaderCache = giCreateShaderCache(shaderParams); @@ -487,6 +486,7 @@ void HdGatlingRenderPass::_Execute(const HdRenderPassStateSharedPtr& renderPassS .rrBounceOffset = VtValue::Cast(_settings.find(HdGatlingSettingsTokens->rrBounceOffset)->second).Get(), .rrInvMinTermProb = VtValue::Cast(_settings.find(HdGatlingSettingsTokens->rrInvMinTermProb)->second).Get(), .maxSampleValue = VtValue::Cast(_settings.find(HdGatlingSettingsTokens->maxSampleValue)->second).Get(), + .maxVolumeWalkLength = VtValue::Cast(_settings.find(HdGatlingSettingsTokens->maxVolumeWalkLength)->second).Get(), .backgroundColor = { backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3] }, .domeLight = renderParam->ActiveDomeLight(), .scene = _scene