diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index bf76ad0dc0..2c916ec0f8 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -80,7 +80,7 @@ void HiresTexture::Init(const std::string& gameCode) } } -std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format, bool dump) +std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format, bool has_mipmaps, bool dump) { // checking for min/max on paletted textures u32 min = 0xffff; @@ -121,7 +121,7 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co u64 tex_hash = GetHashHiresTexture(texture, (int)texture_size); u64 tlut_hash = tlut_size ? GetHashHiresTexture(tlut, (int)tlut_size) : 0; - std::string basename = StringFromFormat("tex1_%dx%d_%016lx", width, height, tex_hash); + std::string basename = StringFromFormat("tex1%s_%dx%d_%016lx", has_mipmaps ? "_m" : "", width, height, tex_hash); std::string tlutname = tlut_size ? StringFromFormat("_%016lx", tlut_hash) : ""; std::string formatname = StringFromFormat("_%d", format); @@ -131,9 +131,9 @@ std::string HiresTexture::GenBaseName(const u8* texture, size_t texture_size, co return basename + tlutname + formatname; } -HiresTexture* HiresTexture::Search(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format) +HiresTexture* HiresTexture::Search(const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, int format, bool has_mipmaps) { - std::string base_filename = GenBaseName(texture, texture_size, tlut, tlut_size, width, height, format); + std::string base_filename = GenBaseName(texture, texture_size, tlut, tlut_size, width, height, format, has_mipmaps); HiresTexture* ret = nullptr; for (int level = 0;; level++) diff --git a/Source/Core/VideoCommon/HiresTextures.h b/Source/Core/VideoCommon/HiresTextures.h index a1a16ff1c4..340d660706 100644 --- a/Source/Core/VideoCommon/HiresTextures.h +++ b/Source/Core/VideoCommon/HiresTextures.h @@ -18,14 +18,15 @@ public: const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, - int format + int format, bool has_mipmaps ); static std::string GenBaseName( const u8* texture, size_t texture_size, const u8* tlut, size_t tlut_size, u32 width, u32 height, - int format, bool dump = false + int format, bool has_mipmaps, + bool dump = false ); ~HiresTexture(); diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 1159159690..3e61ea11f3 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -304,8 +304,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) const int texformat = tex.texImage0[id].format; const u32 tlutaddr = tex.texTlut[id].tmem_offset << 9; const u32 tlutfmt = tex.texTlut[id].tlut_format; - const bool use_mipmaps = (tex.texMode0[id].min_filter & 3) != 0; u32 tex_levels = (tex.texMode1[id].max_lod + 0xf) / 0x10 + 1; + const bool use_mipmaps = (tex.texMode0[id].min_filter & 3) != 0 && tex_levels > 0; const bool from_tmem = tex.texImage1[id].image_type != 0; if (0 == address) @@ -410,7 +410,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) src_data, texture_size, &texMem[tlutaddr], palette_size, width, height, - texformat + texformat, use_mipmaps )); if (hires_tex) @@ -476,7 +476,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) src_data, texture_size, &texMem[tlutaddr], palette_size, width, height, - texformat, true + texformat, use_mipmaps, + true ); DumpTexture(entry, basename, 0); }