From 8fb0f913315f98c9c3f3bf51ad0fc4e534991e10 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Fri, 14 May 2021 18:17:08 -0500 Subject: [PATCH] VideoCommon: split the texture hash from the base name when generating the texture name --- Source/Core/VideoCommon/TextureInfo.cpp | 13 ++++++++++--- Source/Core/VideoCommon/TextureInfo.h | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/Core/VideoCommon/TextureInfo.cpp b/Source/Core/VideoCommon/TextureInfo.cpp index 09c5dee375..166b58497e 100644 --- a/Source/Core/VideoCommon/TextureInfo.cpp +++ b/Source/Core/VideoCommon/TextureInfo.cpp @@ -4,6 +4,7 @@ #include "VideoCommon/TextureInfo.h" +#include #include #include "Common/Align.h" @@ -95,6 +96,11 @@ TextureInfo::TextureInfo(const u8* ptr, const u8* tlut_ptr, u32 address, } } +std::string TextureInfo::NameDetails::GetFullName() const +{ + return fmt::format("{}_{}{}_{}", base_name, texture_name, tlut_name, format_name); +} + TextureInfo::NameDetails TextureInfo::CalculateTextureName() { if (!m_ptr) @@ -151,10 +157,11 @@ TextureInfo::NameDetails TextureInfo::CalculateTextureName() const u64 tlut_hash = tlut_size ? XXH64(tlut, tlut_size, 0) : 0; NameDetails result; - result.base_name = fmt::format("{}{}x{}{}_{:016x}", format_prefix, m_raw_width, m_raw_height, - m_mipmaps_enabled ? "_m" : "", tex_hash); + result.base_name = fmt::format("{}{}x{}{}", format_prefix, m_raw_width, m_raw_height, + m_mipmaps_enabled ? "_m" : ""); + result.texture_name = fmt::format("{:016x}", tex_hash); result.tlut_name = tlut_size ? fmt::format("_{:016x}", tlut_hash) : ""; - result.format_name = fmt::format("_{}", static_cast(m_texture_format)); + result.format_name = fmt::to_string(static_cast(m_texture_format)); return result; } diff --git a/Source/Core/VideoCommon/TextureInfo.h b/Source/Core/VideoCommon/TextureInfo.h index d48e63706f..55e705bab7 100644 --- a/Source/Core/VideoCommon/TextureInfo.h +++ b/Source/Core/VideoCommon/TextureInfo.h @@ -25,10 +25,11 @@ public: struct NameDetails { std::string base_name; + std::string texture_name; std::string tlut_name; std::string format_name; - std::string GetFullName() const { return base_name + tlut_name + format_name; } + std::string GetFullName() const; }; NameDetails CalculateTextureName();