From 1f3b90d70a43dfffe63b5c2dca0e9a1218c40f94 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 13 Jan 2016 12:45:53 +1000 Subject: [PATCH] TextureCacheBase: Change CalculateLevelSize to match D3D/OGL sizes This was causing crashes/driver resets when odd-dimension textures were being loaded, due to the size we were uploading being larger than the size of the higher-level texture calculated by the runtime. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 5805eb3d8b..f47dab338c 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -328,7 +328,7 @@ void TextureCacheBase::DumpTexture(TCacheEntryBase* entry, std::string basename, static u32 CalculateLevelSize(u32 level_0_size, u32 level) { - return (level_0_size + ((1 << level) - 1)) >> level; + return std::max(level_0_size >> level, 1u); } // Used by TextureCacheBase::Load