mesa: Draw indirect is not allowed if the default VAO is bound.
authorMarta Lofstedt <marta.lofstedt@intel.com>
Mon, 26 Oct 2015 09:58:37 +0000 (10:58 +0100)
committerMarta Lofstedt <marta.lofstedt@linux.intel.com>
Tue, 27 Oct 2015 11:16:23 +0000 (12:16 +0100)
From OpenGL ES 3.1 specification, section 10.5:
"DrawArraysIndirect requires that all data sourced for the
command, including the DrawArraysIndirectCommand
structure,  be in buffer objects,  and may not be called when
the default vertex array object is bound."

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/mesa/main/api_validate.c

index e936d62d488e45c68b6cbf68140c19003456025c..06efe02e445727a4273c6c1170b1f9644221e1db 100644 (file)
@@ -698,6 +698,18 @@ valid_draw_indirect(struct gl_context *ctx,
 {
    const GLsizeiptr end = (GLsizeiptr)indirect + size;
 
+   /* OpenGL ES 3.1 spec. section 10.5:
+    *
+    *      "DrawArraysIndirect requires that all data sourced for the
+    *      command, including the DrawArraysIndirectCommand
+    *      structure,  be in buffer objects,  and may not be called when
+    *      the default vertex array object is bound."
+    */
+   if (ctx->Array.VAO == ctx->Array.DefaultVAO) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "(no VAO bound)");
+      return GL_FALSE;
+   }
+
    if (!_mesa_valid_prim_mode(ctx, mode, name))
       return GL_FALSE;