From c70b71f9454928550e8aad0c60890f71476806ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 21 Apr 2023 00:05:27 +0200 Subject: [PATCH] Fix night vision in D3D9/ES2 as well. --- GPU/Common/DepalettizeShaderCommon.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/GPU/Common/DepalettizeShaderCommon.cpp b/GPU/Common/DepalettizeShaderCommon.cpp index 6b81322a42..f37443cec7 100644 --- a/GPU/Common/DepalettizeShaderCommon.cpp +++ b/GPU/Common/DepalettizeShaderCommon.cpp @@ -249,7 +249,7 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) { break; case GE_FORMAT_5551: if (config.textureFormat == GE_TFMT_CLUT8 && mask == 0xFF && shift == 0) { - sprintf(lookupMethod, "index.a * 128.0 + index.b * 64.0 + index.g * 4.0"); // we just skip A. + sprintf(lookupMethod, "(index.a * 128.0 + index.b * 64.0 + index.g * 4.0)"); // we just skip A. index_multiplier = 1.0f / 256.0f; // SOCOM case. #16210 } else if ((mask & (mask + 1)) == 0 && shift < 16) { @@ -322,10 +322,7 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) { // Seems to need a half-pixel offset fix? Might mean it was rendered wrong... texel_offset += 0.5f / texturePixels; } - char offset[128] = ""; - sprintf(offset, " + %f", texel_offset); - - writer.F(" float coord = (%s * %f)%s;\n", lookupMethod, index_multiplier, offset); + writer.F(" float coord = (%s * %f) + %f;\n", lookupMethod, index_multiplier, texel_offset); writer.C(" vec4 outColor = ").SampleTexture2D("pal", "vec2(coord, 0.0)").C(";\n"); }