mesa: Call _mesa_test_texobj_completeness() before using _MaxLevel in image validation.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 20 Jan 2015 12:42:48 +0000 (14:42 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 4 May 2015 14:44:16 +0000 (17:44 +0300)
gl_texture_object::_MaxLevel doesn't have any meaningful value until
_mesa_test_texobj_completeness() has been run.  Fixes the "level"
ARB_shader_image_load_store piglit test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/shaderimage.c

index 005698c526f4fa99d58e240315117ef0a450d0dd..cb88d9c57092c874e4a573dac81bb1cdad1fdfb1 100644 (file)
@@ -337,13 +337,14 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
    struct gl_texture_object *t = u->TexObj;
    mesa_format tex_format;
 
-   if (!t || u->Level < t->BaseLevel ||
-       u->Level > t->_MaxLevel)
+   if (!t)
       return GL_FALSE;
 
    _mesa_test_texobj_completeness(ctx, t);
 
-   if ((u->Level == t->BaseLevel && !t->_BaseComplete) ||
+   if (u->Level < t->BaseLevel ||
+       u->Level > t->_MaxLevel ||
+       (u->Level == t->BaseLevel && !t->_BaseComplete) ||
        (u->Level != t->BaseLevel && !t->_MipmapComplete))
       return GL_FALSE;