From 63755944053d344a39894bde57cc67b6780023d3 Mon Sep 17 00:00:00 2001 From: jpolo1224 Date: Fri, 21 Aug 2026 20:40:17 -0400 Subject: [PATCH] GS/TC: cross-version probe for the texture-hash divergence (diagnostic) The two builds ask for disjoint TEX0 hashes for the same on-screen font -- nine values on 2.6.6, eight now, no overlap, same palette hash, same PSMT4. Every function feeding the hash is byte-identical between them, so what differs is the DATA, and HashCacheKey records only the region's width and height: never where it starts, never which address it came from, never whether mips were folded in. Print exactly what the key discards -- TBP0, TBW, TW/TH, the full region rect including its origin, whether lod was present, and the first bytes actually hashed -- so two logs can be diffed instead of theorised about. --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index 3f9a73bb56..7948104608 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -9459,6 +9459,31 @@ GSTextureCache::HashCacheKey GSTextureCache::HashCacheKey::Create(const GIFRegTE ret.TEX0Hash = FinishBlockHash(hash_st); + // ★ CROSS-VERSION PROBE (diagnostic builds only). + // + // Two builds ask for completely disjoint TEX0 hashes for the same on-screen font: nine values + // on 2.6.6, eight now, no overlap, same palette hash, same 32x32 PSMT4. Every hashing function + // involved is byte-identical between them, so the DATA being hashed differs -- and the key + // records only the region's width and height, never where it starts or which address it came + // from. Print the things the key throws away, so the two logs can be diffed directly instead + // of guessed at. + if (psm.pal != 0) // any paletted texture; the cap below keeps the volume sane + { + static u32 probes = 0; + if (probes < 12) + { + probes++; + Console.WriteLnFmt("TCPROBE tex0hash={:016x} clut={:016x} TBP0={:05x} TBW={} PSM={} TW={} TH={} " + "region=({},{})-({},{}) lod={} first={:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", + ret.TEX0Hash, ret.CLUTHash, static_cast(TEX0.TBP0), static_cast(TEX0.TBW), + static_cast(TEX0.PSM), static_cast(TEX0.TW), static_cast(TEX0.TH), + region.GetMinX(), region.GetMinY(), region.GetMaxX(), region.GetMaxY(), + lod ? 1 : 0, + s_unswizzle_buffer[0], s_unswizzle_buffer[1], s_unswizzle_buffer[2], s_unswizzle_buffer[3], + s_unswizzle_buffer[4], s_unswizzle_buffer[5], s_unswizzle_buffer[6], s_unswizzle_buffer[7]); + } + } + return ret; }