make gtao quality variant actually selectable

This commit is contained in:
Wls50
2025-11-29 13:03:58 +01:00
committed by Hirek
parent 7316a35b00
commit 3f68c543bb
2 changed files with 24 additions and 17 deletions

View File

@@ -103,7 +103,8 @@ void NvSsao::Init() {
.setInitialState(ResourceStates::ShaderResource)
.setKeepInitialState(true));
SamplerHandle sampler_point = m_SamplerPoint = m_backend->GetDevice()->createSampler(
SamplerHandle sampler_point = m_SamplerPoint =
m_backend->GetDevice()->createSampler(
nvrhi::SamplerDesc()
.setAllAddressModes(SamplerAddressMode::Clamp)
.setAllFilters(false));
@@ -141,11 +142,15 @@ void NvSsao::Init() {
.addItem(BindingSetItem::Texture_UAV(2, m_debugImage))
.addItem(BindingSetItem::Sampler(0, sampler_point)),
blGTAO, m_BSGTAO);
m_PSOGTAO = m_backend->GetDevice()->createComputePipeline(
std::array<IShader*, 4> const shaders{m_CSGTAOLow, m_CSGTAOMedium,
m_CSGTAOHigh, m_CSGTAOUltra};
for (int i = 0; i < 4; ++i) {
m_PSOGTAO[i] = m_backend->GetDevice()->createComputePipeline(
ComputePipelineDesc()
.setComputeShader(m_CSGTAOHigh)
.setComputeShader(shaders[i])
.addBindingLayout(blGTAO));
}
}
{
BindingLayoutHandle blDenoise;
@@ -204,7 +209,7 @@ void NvSsao::Render(nvrhi::ICommandList* command_list,
{
command_list->beginMarker("Main Pass");
nvrhi::ComputeState state;
state.setPipeline(m_PSOGTAO);
state.setPipeline(m_PSOGTAO[glm::clamp(settings.QualityLevel, 0, 3)]);
state.addBindingSet(m_BSGTAO);
command_list->setComputeState(state);
@@ -227,8 +232,7 @@ void NvSsao::Render(nvrhi::ICommandList* command_list,
.addItem(
nvrhi::BindingSetItem::ConstantBuffer(0, m_constantBuffer))
.addItem(nvrhi::BindingSetItem::Texture_SRV(0, ping))
.addItem(nvrhi::BindingSetItem::Texture_SRV(
1, m_workingEdges))
.addItem(nvrhi::BindingSetItem::Texture_SRV(1, m_workingEdges))
.addItem(nvrhi::BindingSetItem::Texture_UAV(
0, last_pass ? m_outputAO.Get() : pong,
nvrhi::Format::R32_UINT))
@@ -265,10 +269,13 @@ void NvSsao::OnGui(bool const open_now) {
if (ImGui::CollapsingHeader("Advanced")) {
ImGui::InputFloat("Radius multiplier", &settings.RadiusMultiplier);
ImGui::InputFloat("Falloff range", &settings.FalloffRange);
ImGui::InputFloat("Sample distribution power", &settings.SampleDistributionPower);
ImGui::InputFloat("Thin occluder compensation", &settings.ThinOccluderCompensation);
ImGui::InputFloat("Sample distribution power",
&settings.SampleDistributionPower);
ImGui::InputFloat("Thin occluder compensation",
&settings.ThinOccluderCompensation);
ImGui::InputFloat("Final value power", &settings.FinalValuePower);
ImGui::InputFloat("Depth MIP sampling offset", &settings.DepthMIPSamplingOffset);
ImGui::InputFloat("Depth MIP sampling offset",
&settings.DepthMIPSamplingOffset);
}
ImGui::End();
}

View File

@@ -26,7 +26,7 @@ struct NvSsao {
nvrhi::ShaderHandle m_CSGTAOMedium;
nvrhi::ShaderHandle m_CSGTAOHigh;
nvrhi::ShaderHandle m_CSGTAOUltra;
nvrhi::ComputePipelineHandle m_PSOGTAO;
std::array<nvrhi::ComputePipelineHandle, 4> m_PSOGTAO;
nvrhi::BindingSetHandle m_BSGTAO;
nvrhi::ShaderHandle m_CSDenoisePass;