Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit b30f715

Browse files
author
Flyinghead
committed
Fix paletted textures mismatch in texture cache
1 parent 46f28cf commit b30f715

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/rend/gles/gltex.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,12 @@ const TSP TSPTextureCacheMask = { { TexV : 7, TexU : 7 } };
645645
const TCW TCWTextureCacheMask = { { TexAddr : 0x1FFFFF, Reserved : 0, StrideSel : 0, ScanOrder : 0, PixelFmt : 7, VQ_Comp : 1, MipMapped : 1 } };
646646

647647
TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw) {
648-
u64 key = ((u64)(tcw.full & TCWTextureCacheMask.full) << 32) | (tsp.full & TSPTextureCacheMask.full);
648+
u64 key = tsp.full & TSPTextureCacheMask.full;
649+
if (tcw.PixelFmt == 5 || tcw.PixelFmt == 6)
650+
// Paletted textures have a palette selection that must be part of the key
651+
key |= (u64)tcw.full << 32;
652+
else
653+
key |= (u64)(tcw.full & TCWTextureCacheMask.full) << 32;
649654

650655
TexCacheIter tx = TexCache.find(key);
651656

0 commit comments

Comments
 (0)