summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2015-11-13 11:13:05 +0200
committerTapani Pälli <tapani.palli@intel.com>2015-11-26 08:01:31 +0200
commitc2e146f4879b806e7178b8145645268c1ce0b4cd (patch)
tree048342c20d14b19ce55f648d9b1327ed5dd657b8 /src/mesa/main/api_validate.c
parent22d2dda03be32d23bc8e9f5823a4f2469737ddbe (diff)
downloadexternal_mesa3d-c2e146f4879b806e7178b8145645268c1ce0b4cd.zip
external_mesa3d-c2e146f4879b806e7178b8145645268c1ce0b4cd.tar.gz
external_mesa3d-c2e146f4879b806e7178b8145645268c1ce0b4cd.tar.bz2
mesa: error out in indirect draw when vertex bindings mismatch
Patch adds additional mask for tracking which vertex arrays have associated vertex buffer binding set. This array can be directly compared to which vertex arrays are enabled and should match when drawing. Fixes following CTS tests: ES31-CTS.draw_indirect.negative-noVBO-arrays ES31-CTS.draw_indirect.negative-noVBO-elements v2: update mask in vertex_array_attrib_binding v3: rename mask and make it track _BoundArrays which matches what was actually originally wanted (Fredrik Höglund) v4: code cleanup, check for GLES 3.1 (Fredrik Höglund) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index a490189..d0b3ae7 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -710,6 +710,20 @@ valid_draw_indirect(struct gl_context *ctx,
return GL_FALSE;
}
+ /* From OpenGL ES 3.1 spec. section 10.5:
+ * "An INVALID_OPERATION error is generated if zero is bound to
+ * VERTEX_ARRAY_BINDING, DRAW_INDIRECT_BUFFER or to any enabled
+ * vertex array."
+ *
+ * Here we check that for each enabled vertex array we have a vertex
+ * buffer bound.
+ */
+ if (_mesa_is_gles31(ctx) &&
+ ctx->Array.VAO->_Enabled != ctx->Array.VAO->VertexAttribBufferMask) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(No VBO bound)", name);
+ return GL_FALSE;
+ }
+
if (!_mesa_valid_prim_mode(ctx, mode, name))
return GL_FALSE;