16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 22:59:19 +02:00

support specular occlusion using bent normals

This commit is contained in:
Wls50
2025-11-28 23:36:26 +01:00
committed by Hirek
parent aa0b6e9965
commit 7316a35b00
5 changed files with 24 additions and 148 deletions

View File

@@ -78,7 +78,7 @@ void NvSsao::Init() {
.setWidth(m_width)
.setHeight(m_height)
.setIsUAV(true)
.setFormat(Format::R8_UINT)
.setFormat(Format::R32_UINT)
.setInitialState(ResourceStates::ShaderResource)
.setKeepInitialState(true));
@@ -88,7 +88,7 @@ void NvSsao::Init() {
.setWidth(m_width)
.setHeight(m_height)
.setIsUAV(true)
.setFormat(Format::R8_UINT)
.setFormat(Format::R32_UINT)
.setInitialState(ResourceStates::ShaderResource)
.setKeepInitialState(true));
@@ -98,7 +98,7 @@ void NvSsao::Init() {
.setWidth(m_width)
.setHeight(m_height)
.setIsUAV(true)
.setFormat(Format::R8_UNORM)
.setFormat(Format::RGBA8_UNORM)
.setIsTypeless(true)
.setInitialState(ResourceStates::ShaderResource)
.setKeepInitialState(true));
@@ -129,27 +129,6 @@ void NvSsao::Init() {
.addBindingLayout(blPrefilterDepths));
}
{
BindingLayoutHandle blPrefilterDepths;
BindingSetDesc bsDescPrefilter =
BindingSetDesc()
.addItem(BindingSetItem::ConstantBuffer(0, m_constantBuffer))
.addItem(BindingSetItem::Texture_SRV(0, m_gbuffer->m_gbuffer_depth))
.addItem(BindingSetItem::Sampler(0, sampler_point));
for (int i = 0; i < XE_GTAO_DEPTH_MIP_LEVELS; ++i) {
bsDescPrefilter.addItem(
BindingSetItem::Texture_UAV(i, m_workingDepths, Format::UNKNOWN,
TextureSubresourceSet(i, 1, 0, 1)));
}
utils::CreateBindingSetAndLayout(m_backend->GetDevice(),
ShaderType::Compute, 0, bsDescPrefilter,
blPrefilterDepths, m_BSPrefilterDepths);
m_PSOPrefilterDepths = m_backend->GetDevice()->createComputePipeline(
ComputePipelineDesc()
.setComputeShader(m_CSPrefilterDepths16x16)
.addBindingLayout(blPrefilterDepths));
}
{
BindingLayoutHandle blGTAO;
utils::CreateBindingSetAndLayout(
@@ -157,8 +136,6 @@ void NvSsao::Init() {
BindingSetDesc()
.addItem(BindingSetItem::ConstantBuffer(0, m_constantBuffer))
.addItem(BindingSetItem ::Texture_SRV(0, m_workingDepths))
.addItem(
BindingSetItem::Texture_SRV(1, m_gbuffer->m_gbuffer_normal))
.addItem(BindingSetItem::Texture_UAV(0, m_workingAOTerm))
.addItem(BindingSetItem::Texture_UAV(1, m_workingEdges))
.addItem(BindingSetItem::Texture_UAV(2, m_debugImage))
@@ -251,10 +228,10 @@ void NvSsao::Render(nvrhi::ICommandList* command_list,
nvrhi::BindingSetItem::ConstantBuffer(0, m_constantBuffer))
.addItem(nvrhi::BindingSetItem::Texture_SRV(0, ping))
.addItem(nvrhi::BindingSetItem::Texture_SRV(
1, m_gbuffer->m_gbuffer_normal))
1, m_workingEdges))
.addItem(nvrhi::BindingSetItem::Texture_UAV(
0, last_pass ? m_outputAO.Get() : pong,
nvrhi::Format::R8_UINT))
nvrhi::Format::R32_UINT))
.addItem(nvrhi::BindingSetItem::Texture_UAV(1, m_workingEdges))
.addItem(nvrhi::BindingSetItem::Texture_UAV(2, m_debugImage))
.addItem(nvrhi::BindingSetItem::Sampler(0, m_SamplerPoint)),