Fix mipmap count and potential crash for non square textures that are allocated with GBitmap class

This commit is contained in:
rextimmy 2017-01-16 15:36:52 +10:00
parent 11532e10cc
commit f6d624be8f
2 changed files with 5 additions and 16 deletions

View file

@ -1085,21 +1085,7 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
// NOTE: Does this belong here?
if( inOutNumMips == 0 && !autoGenSupp )
{
U32 currWidth = width;
U32 currHeight = height;
inOutNumMips = 1;
do
{
currWidth >>= 1;
currHeight >>= 1;
if( currWidth == 0 )
currWidth = 1;
if( currHeight == 0 )
currHeight = 1;
inOutNumMips++;
} while ( currWidth != 1 && currHeight != 1 );
inOutNumMips = mFloor(mLog2(mMax(width, height))) + 1;
}
}
}