mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Fix mipmap count and potential crash for non square textures that are allocated with GBitmap class
This commit is contained in:
parent
11532e10cc
commit
f6d624be8f
2 changed files with 5 additions and 16 deletions
|
|
@ -327,7 +327,10 @@ void GBitmap::allocateBitmap(const U32 in_width, const U32 in_height, const bool
|
|||
|
||||
mNumMipLevels++;
|
||||
allocPixels += currWidth * currHeight * mBytesPerPixel;
|
||||
} while (currWidth != 1 && currHeight != 1);
|
||||
} while (currWidth != 1 || currHeight != 1);
|
||||
|
||||
U32 expectedMips = mFloor(mLog2(mMax(in_width, in_height))) + 1;
|
||||
AssertFatal(mNumMipLevels == expectedMips, "GBitmap::allocateBitmap: mipmap count wrong");
|
||||
}
|
||||
AssertFatal(mNumMipLevels <= c_maxMipLevels, "GBitmap::allocateBitmap: too many miplevels");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue