From 4e460a7968aa58365205bfb4a30e5df88ae0c1d4 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Tue, 11 Feb 2025 18:57:30 +0000 Subject: [PATCH] UberShaderPixel: use unswapped texture samples for depth --- Source/Core/VideoCommon/UberShaderPixel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp index f9674aa5a3..62cfd824d2 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.cpp +++ b/Source/Core/VideoCommon/UberShaderPixel.cpp @@ -724,6 +724,7 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, out.Write("struct State {{\n" " int4 Reg[4];\n" + " int4 RawTexColor;\n" " int4 TexColor;\n" " int AlphaBump;\n" "}};\n" @@ -1090,10 +1091,10 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, " uint sampler_num = {};\n", BitfieldExtract<&TwoTevStageOrders::texmap_even>("ss.order")); out.Write("\n" - " int4 color = sampleTextureWrapper(sampler_num, tevcoord.xy, layer);\n" + " s.RawTexColor = sampleTextureWrapper(sampler_num, tevcoord.xy, layer);\n" " uint swap = {};\n", BitfieldExtract<&TevStageCombiner::AlphaCombiner::tswap>("ss.ac")); - out.Write(" s.TexColor = Swizzle(swap, color);\n"); + out.Write(" s.TexColor = Swizzle(swap, s.RawTexColor);\n"); out.Write(" }} else {{\n" " // Texture is disabled\n" " s.TexColor = int4(255, 255, 255, 255);\n" @@ -1371,7 +1372,7 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, " int ztex = int(" I_ZBIAS "[1].w); // fixed bias\n" "\n" " // Whatever texture was in our last stage, it's now our depth texture\n" - " ztex += idot(s.TexColor.xyzw, " I_ZBIAS "[0].xyzw);\n" + " ztex += idot(s.RawTexColor.xyzw, " I_ZBIAS "[0].xyzw);\n" " ztex += (bpmem_ztex_op == 1u) ? zCoord : 0;\n" " zCoord = ztex & 0xFFFFFF;\n" " }}\n"