Fix an issue when calculating the number of mipmaps for a volume/3D texture.

This commit is contained in:
Alex Szpakowski
2018-01-06 01:55:09 -04:00
parent 08b3635e4e
commit 6808968893
4 changed files with 8 additions and 7 deletions
+3 -2
View File
@@ -91,7 +91,7 @@ void Image::init(PixelFormat fmt, int w, int h, const Settings &settings)
if (isCompressed() && mipmapsType == MIPMAPS_GENERATED)
mipmapsType = MIPMAPS_NONE;
mipmapCount = mipmapsType == MIPMAPS_NONE ? 1 : getMipmapCount(w, h);
mipmapCount = mipmapsType == MIPMAPS_NONE ? 1 : getTotalMipmapCount(w, h);
if (mipmapCount > 1)
filter.mipmap = defaultMipmapFilter;
@@ -280,9 +280,10 @@ Image::MipmapsType Image::Slices::validate() const
int w = firstdata->getWidth();
int h = firstdata->getHeight();
int depth = textureType == TEXTURE_VOLUME ? slicecount : 1;
PixelFormat format = firstdata->getFormat();
int expectedmips = Texture::getMipmapCount(w, h);
int expectedmips = Texture::getTotalMipmapCount(w, h, depth);
if (mipcount != expectedmips && mipcount != 1)
throw love::Exception("Image does not have all required mipmap levels (expected %d, got %d)", expectedmips, mipcount);