fix reverseZDepth uniform name

This commit is contained in:
James Seibel
2026-05-16 17:54:30 -05:00
parent f67d9e4e04
commit 2f9504b167
5 changed files with 13 additions and 13 deletions
@@ -6,7 +6,7 @@ out vec4 fragColor;
layout (std140) uniform baseFragUniformBlock layout (std140) uniform baseFragUniformBlock
{ {
bool uIsVulkan; bool uIsReverseZDepth;
}; };
uniform sampler2D uSourceColorTexture; uniform sampler2D uSourceColorTexture;
@@ -19,7 +19,7 @@ void main()
float fragmentDepth = texture(uSourceDepthTexture, TexCoord).r; float fragmentDepth = texture(uSourceDepthTexture, TexCoord).r;
bool drawnTo; bool drawnTo;
if (uIsVulkan) if (uIsReverseZDepth)
{ {
drawnTo = (fragmentDepth != 0.0f); drawnTo = (fragmentDepth != 0.0f);
} }
@@ -12,7 +12,7 @@ layout (std140) uniform fragUniformBlock
// inverted model view matrix and projection matrix // inverted model view matrix and projection matrix
mat4 uDhInvMvmProj; mat4 uDhInvMvmProj;
bool uIsVulkan; bool uIsReverseZDepth;
}; };
uniform sampler2D uMcColorTexture; uniform sampler2D uMcColorTexture;
@@ -28,7 +28,7 @@ vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
{ {
// normalized device coordinates // normalized device coordinates
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0); vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
if (uIsVulkan) if (uIsReverseZDepth)
{ {
// Z already in [0,1], don't remap // Z already in [0,1], don't remap
ndc.xy = ndc.xy * 2.0 - 1.0; ndc.xy = ndc.xy * 2.0 - 1.0;
@@ -22,7 +22,7 @@ layout (std140) uniform fragUniformBlock
mat4 uDhInvMvmProj; mat4 uDhInvMvmProj;
mat4 uMcInvMvmProj; mat4 uMcInvMvmProj;
bool uIsVulkan; bool uIsReverseZDepth;
}; };
@@ -35,7 +35,7 @@ vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
{ {
// normalized device coordinates // normalized device coordinates
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0); vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
if (uIsVulkan) if (uIsReverseZDepth)
{ {
// Z already in [0,1], don't remap // Z already in [0,1], don't remap
ndc.xy = ndc.xy * 2.0 - 1.0; ndc.xy = ndc.xy * 2.0 - 1.0;
@@ -84,7 +84,7 @@ void main()
// we only want to fade vanilla rendered objects, not to the sky or LODs // we only want to fade vanilla rendered objects, not to the sky or LODs
bool isGround; bool isGround;
if (uIsVulkan) if (uIsReverseZDepth)
{ {
isGround = (mcFragmentDepth > 0); isGround = (mcFragmentDepth > 0);
} }
@@ -41,7 +41,7 @@ layout (std140) uniform fragUniformBlock
// inverted model view matrix and projection matrix // inverted model view matrix and projection matrix
mat4 uInvMvmProj; mat4 uInvMvmProj;
bool uIsVulkan; bool uIsReverseZDepth;
}; };
uniform sampler2D uDhDepthTexture; uniform sampler2D uDhDepthTexture;
@@ -142,7 +142,7 @@ vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
{ {
// normalized device coordinates // normalized device coordinates
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0); vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
if (uIsVulkan) if (uIsReverseZDepth)
{ {
// Z already in [0,1], don't remap // Z already in [0,1], don't remap
ndc.xy = ndc.xy * 2.0 - 1.0; ndc.xy = ndc.xy * 2.0 - 1.0;
@@ -23,7 +23,7 @@ layout (std140) uniform fragUniformBlock
mat4 uInvProj; mat4 uInvProj;
mat4 uProj; mat4 uProj;
bool uIsVulkan; bool uIsReverseZDepth;
}; };
uniform sampler2D uDhDepthTexture; uniform sampler2D uDhDepthTexture;
@@ -51,7 +51,7 @@ vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
{ {
// normalized device coordinates // normalized device coordinates
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0); vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
if (uIsVulkan) if (uIsReverseZDepth)
{ {
// Z already in [0,1], don't remap // Z already in [0,1], don't remap
ndc.xy = ndc.xy * 2.0 - 1.0; ndc.xy = ndc.xy * 2.0 - 1.0;
@@ -98,7 +98,7 @@ float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3
continue; continue;
} }
if (uIsVulkan) if (uIsReverseZDepth)
{ {
vec4 ndc = vec4( vec4 ndc = vec4(
sampleClipPos.x * 2.0 - 1.0, // UV [0,1] -> NDC [-1,+1] sampleClipPos.x * 2.0 - 1.0, // UV [0,1] -> NDC [-1,+1]
@@ -137,7 +137,7 @@ void main()
float occlusion = 0.0; float occlusion = 0.0;
bool isGround; bool isGround;
if (uIsVulkan) if (uIsReverseZDepth)
{ {
isGround = (fragmentDepth > 0.0f); isGround = (fragmentDepth > 0.0f);
} }