From 6919d8a7645bfccc86c26ed08276daa48e237208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 7 Apr 2026 11:39:16 -0600 Subject: [PATCH] ImGeDebugger: In the textures window, properly write out the status flags. --- GPU/Common/TextureCacheCommon.cpp | 55 +++++++++++++++++++++++++++++++ GPU/Common/TextureCacheCommon.h | 2 ++ UI/ImDebugger/ImGe.cpp | 2 +- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 812fecccaa..b5de4005a3 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -3102,3 +3102,58 @@ CheckAlphaResult TextureCacheCommon::CheckCLUTAlpha(const uint8_t *pixelData, GE return CheckAlpha32((const u32 *)pixelData, w, 0xFF000000); } } + +std::string TexStatusToString(TexCacheEntry::TexStatus status) { + std::string result; + switch (status & TexCacheEntry::STATUS_MASK) { + case TexCacheEntry::STATUS_HASHING: + result += "HASHING "; + break; + case TexCacheEntry::STATUS_RELIABLE: + result += "RELIABLE "; + break; + case TexCacheEntry::STATUS_UNRELIABLE: + result += "UNRELIABLE "; + break; + } + if (status & TexCacheEntry::STATUS_ALPHA_MASK) { + result += "ALPHA"; + } + if (status & TexCacheEntry::STATUS_CLUT_VARIANTS) { + result += "CLUTVARIANTS "; + } + if (status & TexCacheEntry::STATUS_CLUT_RECHECK) { + result += "CLUT_RECHECK "; + } + if (status & TexCacheEntry::STATUS_CHANGE_FREQUENT) { + result += "FREQ "; + } + if (status & TexCacheEntry::STATUS_UNRELIABLE) { + result += "UNREL "; + } + if (status & TexCacheEntry::STATUS_TO_SCALE) { + result += "TOSCALE "; + } + if (status & TexCacheEntry::STATUS_IS_SCALED_OR_REPLACED) { + result += "SCALED/REPL "; + } + if (status & TexCacheEntry::STATUS_NO_MIPS) { + result += "NO_MIPS "; + } + if (status & TexCacheEntry::STATUS_CLUT_GPU) { + result += "CLUT_GPU "; + } + if (status & TexCacheEntry::STATUS_FORCE_REBUILD) { + result += "FORCE_REBUILD "; + } + if (status & TexCacheEntry::STATUS_3D) { + result += "3D "; + } + if (status & TexCacheEntry::STATUS_VIDEO) { + result += "VIDEO "; + } + if (status & TexCacheEntry::STATUS_BGRA) { + result += "BGRA "; + } + return result.empty() ? "None" : result; +} diff --git a/GPU/Common/TextureCacheCommon.h b/GPU/Common/TextureCacheCommon.h index 5b59f3288d..978dcbbc2b 100644 --- a/GPU/Common/TextureCacheCommon.h +++ b/GPU/Common/TextureCacheCommon.h @@ -237,6 +237,8 @@ struct TexCacheEntry { static u64 CacheKey(u32 addr, u8 format, u16 dim, u32 cluthash); }; +std::string TexStatusToString(TexCacheEntry::TexStatus status); + // Can't be unordered_map, we use lower_bound ... although for some reason that (used to?) compiles on MSVC. // Would really like to replace this with DenseHashMap but can't as long as we need lower_bound. typedef std::map> TexCache; diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index 0d3ee6ca64..ab38ea7eac 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -174,7 +174,7 @@ void DrawTexturesWindow(ImConfig &cfg, TextureCacheCommon *textureCache) { ImGui::Image(texId, ImVec2(w, h)); ImGui::Text("%08x: %dx%d, %d mips, %s", (uint32_t)(cfg.selectedTexAddr & 0xFFFFFFFF), w, h, entry->maxLevel + 1, GeTextureFormatToString((GETextureFormat)entry->format)); ImGui::Text("Stride: %d", entry->bufw); - ImGui::Text("Status: %08x", entry->status); // TODO: Show the flags + ImGui::Text("Status: %08x: %s", entry->status, TexStatusToString((TexCacheEntry::TexStatus)(entry->status)).c_str()); ImGui::Text("Hash: %08x", entry->fullhash); ImGui::Text("CLUT Hash: %08x", entry->cluthash); ImGui::Text("Minihash: %08x", entry->minihash);