summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/TextureCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/OGL/TextureCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/TextureCache.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp
index 4bf70271d1..241b73f719 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp
@@ -188,6 +188,12 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, u
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level)
{
+ if (level >= config.levels)
+ PanicAlert("Texture only has %d levels, can't update level %d", config.levels, level);
+ if (width != std::max(1u, config.width >> level) || height != std::max(1u, config.height >> level))
+ PanicAlert("size of level %d must be %dx%d, but %dx%d requested",
+ level, std::max(1u, config.width >> level), std::max(1u, config.height >> level), width, height);
+
if (pcfmt != PC_TEX_FMT_DXT1)
{
glActiveTexture(GL_TEXTURE0+9);