OpenGL 4.5 spec, section "8.11.4 Texture Image Queries", page 233 of
the PDF states:

    "An INVALID_OPERATION error is generated if texture is the name of a buffer
     or multisample texture."

Currently, this is not being checked and the multisample texture image is passed
down to the driver hook. On i965, it is crashing the driver with an assertion:

intel_mipmap_tree.c:3125: intel_miptree_map: Assertion `mt->num_samples <= 1' 
failed.
---
 src/mesa/main/texgetimage.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index d5cb1636605..6a23e4bbb8c 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1185,6 +1185,20 @@ getteximage_error_check(struct gl_context *ctx,
    texImage = select_tex_image(texObj, target, level, zoffset);
    assert(texImage);
 
+   /* Check that texObj is not a buffer or multisample texture if called
+    * from glGetTextureSubImage. OpenGL 4.5 spec, section "8.11.4 Texture
+    * Image Queries", page 233 of the PDF states:
+    *
+    *     "An INVALID_OPERATION error is generated if texture is the
+    *      name of a buffer or multisample texture."
+    */
+   if (texImage->NumSamples > 0 &&
+       strcmp(caller, "glGetTextureSubImage") == 0) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "%s(multisample texture)", caller);
+      return true;
+   }
+
    /*
     * Format and type checking has been moved up to GetnTexImage and
     * GetTextureImage so that it happens before getting the texImage object.
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to