From a7a456caa46c809118503d3cfa7e693d74dd3a75 Mon Sep 17 00:00:00 2001 From: Pavlo Penenko Date: Fri, 8 Sep 2023 19:41:45 -0400 Subject: [PATCH 1/2] https://github.com/ppenenko/metashade/issues/31: fixed the incorrectly inverted depth test in the DX12 depth pass --- src/DX12/GLTF/GltfDepthPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DX12/GLTF/GltfDepthPass.cpp b/src/DX12/GLTF/GltfDepthPass.cpp index f0c914e..55f0567 100644 --- a/src/DX12/GLTF/GltfDepthPass.cpp +++ b/src/DX12/GLTF/GltfDepthPass.cpp @@ -318,7 +318,7 @@ namespace CAULDRON_DX12 descPso.RasterizerState.DepthClipEnable = false; descPso.BlendState = CD3DX12_BLEND_DESC(D3D12_DEFAULT); descPso.DepthStencilState = CD3DX12_DEPTH_STENCIL_DESC(D3D12_DEFAULT); - descPso.DepthStencilState.DepthFunc = m_bInvertedDepth ? D3D12_COMPARISON_FUNC_LESS : D3D12_COMPARISON_FUNC_GREATER; + descPso.DepthStencilState.DepthFunc = m_bInvertedDepth ? D3D12_COMPARISON_FUNC_GREATER : D3D12_COMPARISON_FUNC_LESS; descPso.SampleMask = UINT_MAX; descPso.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; descPso.DSVFormat = depthFormat; From b1bd514824c2694b05ab8896b26f6d54fef0c9ad Mon Sep 17 00:00:00 2001 From: Pavlo Penenko Date: Fri, 8 Sep 2023 19:49:24 -0400 Subject: [PATCH 2/2] https://github.com/ppenenko/metashade/issues/31: fixed the incorrectly inverted depth test in the VK depth pass --- src/VK/GLTF/GltfDepthPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VK/GLTF/GltfDepthPass.cpp b/src/VK/GLTF/GltfDepthPass.cpp index b546dae..70e701e 100644 --- a/src/VK/GLTF/GltfDepthPass.cpp +++ b/src/VK/GLTF/GltfDepthPass.cpp @@ -419,7 +419,7 @@ namespace CAULDRON_VK ds.flags = 0; ds.depthTestEnable = true; ds.depthWriteEnable = true; - ds.depthCompareOp = m_bInvertedDepth ? VK_COMPARE_OP_LESS_OR_EQUAL : VK_COMPARE_OP_GREATER_OR_EQUAL; + ds.depthCompareOp = m_bInvertedDepth ? VK_COMPARE_OP_GREATER_OR_EQUAL : VK_COMPARE_OP_LESS_OR_EQUAL; ds.back.failOp = VK_STENCIL_OP_KEEP; ds.back.passOp = VK_STENCIL_OP_KEEP; ds.back.compareOp = VK_COMPARE_OP_ALWAYS;