Skip to content

Commit

Permalink
gi/hdGatling: move maxVolumeWalkLength render setting to a push constant
Browse files Browse the repository at this point in the history
  • Loading branch information
pablode committed May 28, 2024
1 parent f396af6 commit 08897f4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/gi/include/Gi.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ namespace gtl
bool progressiveAccumulation;
GiScene* scene;
uint32_t mediumStackSize;
uint32_t maxVolumeWalkLength;
};

struct GiGeomCacheParams
Expand All @@ -137,6 +136,7 @@ namespace gtl
uint32_t rrBounceOffset;
float rrInvMinTermProb;
float maxSampleValue;
uint32_t maxVolumeWalkLength;
float backgroundColor[4];
GiDomeLight* domeLight;
GiScene* scene;
Expand Down
3 changes: 2 additions & 1 deletion src/gi/shaders/interface/rp_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/gi/src/Gi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,6 @@ namespace gtl
.depthOfField = params.depthOfField,
.filterImportanceSampling = params.filterImportanceSampling,
.materialCount = params.materialCount,
.maxVolumeWalkLength = params.maxVolumeWalkLength,
.nextEventEstimation = nextEventEstimation,
.progressiveAccumulation = params.progressiveAccumulation,
.reorderInvocations = s_deviceFeatures.rayTracingInvocationReorder,
Expand Down Expand Up @@ -1462,7 +1461,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<CgpuBufferBinding> buffers;
Expand Down
2 changes: 0 additions & 2 deletions src/gi/src/GlslShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
1 change: 0 additions & 1 deletion src/gi/src/GlslShaderGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ namespace gtl
bool depthOfField;
bool filterImportanceSampling;
uint32_t materialCount;
uint32_t maxVolumeWalkLength;
bool nextEventEstimation;
bool progressiveAccumulation;
bool reorderInvocations;
Expand Down
4 changes: 2 additions & 2 deletions src/gi/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/hdGatling/renderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,7 @@ void HdGatlingRenderPass::_Execute(const HdRenderPassStateSharedPtr& renderPassS
.nextEventEstimation = _settings.find(HdGatlingSettingsTokens->nextEventEstimation)->second.Get<bool>(),
.progressiveAccumulation = _settings.find(HdGatlingSettingsTokens->progressiveAccumulation)->second.Get<bool>(),
.scene = _scene,
.mediumStackSize = (uint32_t) _settings.find(HdGatlingSettingsTokens->mediumStackSize)->second.Get<int>(),
.maxVolumeWalkLength = (uint32_t) _settings.find(HdGatlingSettingsTokens->maxVolumeWalkLength)->second.Get<int>()
.mediumStackSize = (uint32_t) _settings.find(HdGatlingSettingsTokens->mediumStackSize)->second.Get<int>()
};
_shaderCache = giCreateShaderCache(shaderParams);

Expand Down Expand Up @@ -487,6 +486,7 @@ void HdGatlingRenderPass::_Execute(const HdRenderPassStateSharedPtr& renderPassS
.rrBounceOffset = VtValue::Cast<uint32_t>(_settings.find(HdGatlingSettingsTokens->rrBounceOffset)->second).Get<uint32_t>(),
.rrInvMinTermProb = VtValue::Cast<float>(_settings.find(HdGatlingSettingsTokens->rrInvMinTermProb)->second).Get<float>(),
.maxSampleValue = VtValue::Cast<float>(_settings.find(HdGatlingSettingsTokens->maxSampleValue)->second).Get<float>(),
.maxVolumeWalkLength = VtValue::Cast<uint32_t>(_settings.find(HdGatlingSettingsTokens->maxVolumeWalkLength)->second).Get<uint32_t>(),
.backgroundColor = { backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3] },
.domeLight = renderParam->ActiveDomeLight(),
.scene = _scene
Expand Down

0 comments on commit 08897f4

Please sign in to comment.