diff --git a/GPU/Common/DepalettizeShaderCommon.cpp b/GPU/Common/DepalettizeShaderCommon.cpp index 1746215ada..ee04359135 100644 --- a/GPU/Common/DepalettizeShaderCommon.cpp +++ b/GPU/Common/DepalettizeShaderCommon.cpp @@ -132,10 +132,7 @@ void GenerateDepalShader300(ShaderWriter &writer, const DepalConfig &config) { break; } - float texturePixels = 256.0f; - if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) { - texturePixels = 512.0f; - } + float texturePixels = 512.0f; if (shift) { writer.F(" index = (int(uint(index) >> uint(%d)) & 0x%02x)", shift, mask); @@ -278,11 +275,9 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) { break; } - float texturePixels = 256.f; - if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) { - texturePixels = 512.f; - index_multiplier *= 0.5f; - } + // We always use 512-sized textures now. + float texturePixels = 512.f; + index_multiplier *= 0.5f; // Adjust index_multiplier, similar to the use of 15.99 instead of 16 in the ES 3 path. // index_multiplier -= 0.01f / texturePixels; @@ -326,11 +321,7 @@ void GenerateDepalSmoothed(ShaderWriter &writer, const DepalConfig &config) { } writer.C(" float index = ").SampleTexture2D("tex", "v_texcoord").F(".%s * %0.1f;\n", sourceChannel, indexMultiplier); - float texturePixels = 256.f; - if (config.clutFormat != GE_CMODE_32BIT_ABGR8888) { - texturePixels = 512.f; - } - + float texturePixels = 512.f; writer.F(" float coord = (index + 0.5) * %f;\n", 1.0 / texturePixels); writer.C(" vec4 outColor = ").SampleTexture2D("pal", "vec2(coord, 0.0)").C(";\n"); } diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index fe3d685f28..9586d01b48 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -640,7 +640,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu p.C(" if (depalShift == 5u) { index0 = t.g; }\n"); p.C(" else if (depalShift == 10u) { index0 = t.b; }\n"); p.C(" }\n"); - p.F(" t = ").SampleTexture2D("pal", "vec2(index0 * factor, 0.0)").C(";\n"); + p.F(" t = ").SampleTexture2D("pal", "vec2(index0 * factor * 0.5, 0.0)").C(";\n"); // 0.5 for 512-entry CLUT. break; case ShaderDepalMode::NORMAL: if (doTextureProjection) { diff --git a/GPU/Common/TextureShaderCommon.cpp b/GPU/Common/TextureShaderCommon.cpp index bebc72d516..f364016e72 100644 --- a/GPU/Common/TextureShaderCommon.cpp +++ b/GPU/Common/TextureShaderCommon.cpp @@ -68,7 +68,7 @@ ClutTexture TextureShaderCache::GetClutTexture(GEPaletteFormat clutFormat, const ClutTexture *tex = new ClutTexture(); Draw::TextureDesc desc{}; - desc.width = maxClutEntries; + desc.width = 512; // We always use 512-sized textures here for simplicity, though the most common is that only up to 256 entries are used. desc.height = 1; desc.depth = 1; desc.mipLevels = 1;