summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texgetimage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texgetimage.c')
-rw-r--r--src/mesa/main/texgetimage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 3e3951b1c49..341ce6103f0 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -322,10 +322,15 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
{
GLuint size;
+ /* don't use texImage->CompressedSize since that may be padded out */
+ size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
+ texImage->Depth,
+ texImage->TexFormat);
+
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
/* pack texture image into a PBO */
GLubyte *buf;
- if ((const GLubyte *) img + texImage->CompressedSize >
+ if ((const GLubyte *) img + size >
(const GLubyte *) ctx->Pack.BufferObj->Size) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetCompressedTexImage(invalid PBO access)");
@@ -347,11 +352,6 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
return;
}
- /* don't use texImage->CompressedSize since that may be padded out */
- size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
- texImage->Depth,
- texImage->TexFormat);
-
/* just memcpy, no pixelstore or pixel transfer */
_mesa_memcpy(img, texImage->Data, size);