From b6d9de83dc91ba1afa533591170e007031daf200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 17 Nov 2014 20:52:03 +0100 Subject: [PATCH] Fix size computation for array textures in setStorage() fallback. The comment was right, but the code was apparently copy-pasted. Sadly no unit test covered this, because nearly every desktop impl has ARB_texture_storage and on ES2 (which is the only that doesn't have texture storage) it's not possible to query image size, heh. --- src/Magnum/AbstractTexture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index a1ef9ec3c..55b8fcd01 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -952,7 +952,7 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G } else if(target == GL_TEXTURE_1D_ARRAY) { for(GLsizei level = 0; level != levels; ++level) DataHelper<2>::setImage(*this, target, level, internalFormat, - ImageReference2D{format, type, Math::max(Vector2i(1), size >> level)}); + ImageReference2D{format, type, Vector2i{Math::max(1, size.x() >> level), size.y()}}); #endif /* No other targets are available */ @@ -1004,7 +1004,7 @@ void AbstractTexture::storageImplementationFallback(GLenum target, GLsizei level #endif for(GLsizei level = 0; level != levels; ++level) DataHelper<3>::setImage(*this, target, level, internalFormat, - ImageReference3D{format, type, Math::max(Vector3i(1), size >> level)}); + ImageReference3D{format, type, Vector3i{Math::max(Vector2i{1}, size.xy() >> level), size.z()}}); #endif /* No other targets are available */