summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2016-01-13 12:45:53 +1000
committerStenzek <stenzek@gmail.com>2016-01-13 12:54:38 +1000
commit1f3b90d70a43dfffe63b5c2dca0e9a1218c40f94 (patch)
tree559c6ca4d32b96030389c4ff8f98e2aaf44dd8b4 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent8f8134f5f4da2ff29f58c8f373ed1f5c64bcdf71 (diff)
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.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp2
1 files changed, 1 insertions, 1 deletions
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