From 56738e5893ed7c4dc108996590475c52726623e3 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Thu, 3 Apr 2025 23:00:15 +0300 Subject: [PATCH] Fix half pixel getting applied twice to reverse Z vertex shaders. --- XenosRecomp/shader_recompiler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/XenosRecomp/shader_recompiler.cpp b/XenosRecomp/shader_recompiler.cpp index c73483c..bb5e82c 100644 --- a/XenosRecomp/shader_recompiler.cpp +++ b/XenosRecomp/shader_recompiler.cpp @@ -1784,7 +1784,8 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi } else { - out += "\toPos.xy += g_HalfPixelOffset * oPos.w;\n"; + if (!hasMtxProjection) + out += "\toPos.xy += g_HalfPixelOffset * oPos.w;\n"; } if (simpleControlFlow) @@ -1824,5 +1825,8 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi if (hasMtxProjection) out += "\t}\n"; + if (!isPixelShader && hasMtxProjection) + out += "\toPos.xy += g_HalfPixelOffset * oPos.w;\n"; + out += "}"; }