OGL: Warn about wrong texture sizes

This commit is contained in:
degasus 2015-01-11 22:47:40 +01:00
parent a9eb08b85d
commit 7284312568
1 changed files with 6 additions and 0 deletions

View File

@ -188,6 +188,12 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, u
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height, void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level) 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) if (pcfmt != PC_TEX_FMT_DXT1)
{ {
glActiveTexture(GL_TEXTURE0+9); glActiveTexture(GL_TEXTURE0+9);