mesa: Refuse to bind a mutable texture object to an image unit in GLES.
authorFrancisco Jerez <currojerez@riseup.net>
Sun, 16 Aug 2015 23:02:17 +0000 (02:02 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Thu, 20 Aug 2015 09:26:53 +0000 (12:26 +0300)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
src/mesa/main/shaderimage.c

index 5a3c47a..c4bba84 100644 (file)
@@ -546,6 +546,18 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
          return;
       }
 
+      /* From section 8.22 "Texture Image Loads and Stores" of the OpenGL ES
+       * 3.1 spec:
+       *
+       * "An INVALID_OPERATION error is generated if texture is not the name
+       *  of an immutable texture object."
+       */
+      if (_mesa_is_gles(ctx) && !t->Immutable) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glBindImageTexture(!immutable)");
+         return;
+      }
+
       _mesa_reference_texobj(&u->TexObj, t);
    } else {
       _mesa_reference_texobj(&u->TexObj, NULL);