summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-01-03 14:30:12 +0100
committerdegasus <wickmarkus@web.de>2014-01-03 14:30:12 +0100
commit01351795f01d113a587fe51c904cdba84536f230 (patch)
tree06c3347ec083d6719488f353ca3da2a32908a130 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent0f0a3cc5093fb0f95b97c5a5cf5f515ae1405c17 (diff)
TextureCache: Warn for invalid custom textures
At the moment, custom textures with: - invalid mipmap size - invalid aspect ratio - non-fractional scaling factors are allowed. But they can't be loaded fine by the backend, so generate a warning if someone trys to load them.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 8555bd736d..a3224bcf08 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -255,11 +255,12 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign
char texPathTemp[MAX_PATH];
unsigned int newWidth = 0;
unsigned int newHeight = 0;
+ u32 tex_hash_u32 = tex_hash & 0x00000000FFFFFFFFLL;
if (level == 0)
- sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
+ sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat);
else
- sprintf(texPathTemp, "%s_%08x_%i_mip%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat, level);
+ sprintf(texPathTemp, "%s_%08x_%i_mip%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), tex_hash_u32, texformat, level);
unsigned int required_size = 0;
PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, &required_size, texformat, temp_size, temp);
@@ -275,6 +276,13 @@ PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsign
if (ret != PC_TEX_FMT_NONE)
{
+ if (level > 0 && (newWidth != width || newHeight != height))
+ ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. This mipmap layer _must_ be %dx%d.", newWidth, newHeight, texPathTemp, width, height);
+ if (newWidth * height != newHeight * width)
+ ERROR_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. The aspect differs from the native size %dx%d.", newWidth, newHeight, texPathTemp, width, height);
+ if (newWidth % width || newHeight % height)
+ WARN_LOG(VIDEO, "Invalid custom texture size %dx%d for texture %s. Please use an integer upscaling factor based on the native size %dx%d.", newWidth, newHeight, texPathTemp, width, height);
+
width = newWidth;
height = newHeight;
}