From b40c8a01973ee5ce668695803cf0094f636d22bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 8 Oct 2026 07:08:23 +0200 Subject: [PATCH] TextureCLUTInShader: Build the CLUT texture from the raw CLUT The GLES texture cache keeps 16-bit CLUTs in clutBuf_ converted to its own component order, and GetClutTexture converted them again, so Fushigi no Dungeon 4's tiles came out black on OpenGL. The framebuffer depal path already passed clutBufRaw_. Co-Authored-By: Claude Opus 5.5 --- GPU/Common/TextureCacheCommon.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 8b63d5e271..0ffb3a2b16 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -975,7 +975,8 @@ TextureApplyResult TextureCacheCommon::ApplyTextureFinish(TexCacheEntry *entry, if (entry->status & TexStatus::CLUT8_INDEXED) { bool smoothedDepal = false; u32 depthUpperBits = 0; - ClutTexture clutTexture = clutTextureCache_.GetClutTexture(gstate.getClutPaletteFormat(), clutHash_, clutBuf_); + // The raw CLUT: GetClutTexture converts it itself, and the GLES backend's clutBuf_ is already converted to its order. + ClutTexture clutTexture = clutTextureCache_.GetClutTexture(gstate.getClutPaletteFormat(), clutHash_, clutBufRaw_); BindAsClutTexture(clutTexture.texture, false); gstate_c.SetShaderDepal(ShaderDepalMode::NORMAL, GE_FORMAT_CLUT8); } else {