[Mesa-dev] [PATCH] texgetimage: Check that a multisample tex is not passed to GetTextureSubImage

Eduardo Lima Mitev elima at igalia.com
Thu Feb 2 18:29:22 UTC 2017


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



More information about the mesa-dev mailing list