From 6274eb7cae3d2c166a603e1a91b52601930d28dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 25 Apr 2023 23:17:40 +0200 Subject: [PATCH] Follow the intent of the game's lookups rather than the practice, to reduce banding. --- GPU/Common/DepalettizeShaderCommon.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/GPU/Common/DepalettizeShaderCommon.cpp b/GPU/Common/DepalettizeShaderCommon.cpp index f37443cec7..8bba36521d 100644 --- a/GPU/Common/DepalettizeShaderCommon.cpp +++ b/GPU/Common/DepalettizeShaderCommon.cpp @@ -249,7 +249,8 @@ 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. + // Follow the intent here, and ignore g (and let's not round unnecessarily). + sprintf(lookupMethod, "floor(floor(index.a) * 128.0 + index.b * 64.0)"); // we just skip A. index_multiplier = 1.0f / 256.0f; // SOCOM case. #16210 } else if ((mask & (mask + 1)) == 0 && shift < 16) { @@ -373,7 +374,12 @@ void GenerateDepalFs(ShaderWriter &writer, const DepalConfig &config) { case GLSL_VULKAN: case GLSL_3xx: case HLSL_D3D11: - GenerateDepalShader300(writer, config); + // Use the float shader for the SOCOM special. + if (config.bufferFormat == GE_FORMAT_5551 && config.textureFormat == GE_TFMT_CLUT8) { + GenerateDepalShaderFloat(writer, config); + } else { + GenerateDepalShader300(writer, config); + } break; default: _assert_msg_(false, "Shader language not supported for depal: %d", (int)writer.Lang().shaderLanguage);