summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2012-12-14 12:20:08 -0800
committerPaul Berry <stereotype441@gmail.com>2012-12-18 08:31:34 -0800
commitfebc237141ab06a478d05752dedc858c2b4b8599 (patch)
treefc5115f7491a5ba8bfa832934d3ee64fda3b3f03 /src/mesa/main/api_validate.c
parent3870f2903f030969491fa287b7f8d7eaf1d2f4f9 (diff)
downloadexternal_mesa3d-febc237141ab06a478d05752dedc858c2b4b8599.zip
external_mesa3d-febc237141ab06a478d05752dedc858c2b4b8599.tar.gz
external_mesa3d-febc237141ab06a478d05752dedc858c2b4b8599.tar.bz2
mesa/gles3: Generate error on DrawElements* calls if transform feedback active.
In GLES3, only glDrawArrays() and glDrawArraysInstanced() calls are allowed when transform feedback is active. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index e47db23..355a93c 100644
--- a/src/mesa/main/api_validate.c
+++ b/src/mesa/main/api_validate.c
@@ -313,9 +313,24 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
+ struct gl_transform_feedback_object *xfb_obj
+ = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
@@ -431,9 +446,24 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
+ struct gl_transform_feedback_object *xfb_obj
+ = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
@@ -560,9 +590,24 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
const GLvoid *indices, GLsizei numInstances,
GLint basevertex)
{
+ struct gl_transform_feedback_object *xfb_obj
+ = ctx->TransformFeedback.CurrentObject;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
FLUSH_CURRENT(ctx, 0);
+ /* From the GLES3 specification, section 2.14.2 (Transform Feedback
+ * Primitive Capture):
+ *
+ * The error INVALID_OPERATION is also generated by DrawElements,
+ * DrawElementsInstanced, and DrawRangeElements while transform feedback
+ * is active and not paused, regardless of mode.
+ */
+ if (_mesa_is_gles3(ctx) && xfb_obj->Active && !xfb_obj->Paused) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElements(transform feedback active)");
+ return GL_FALSE;
+ }
+
if (count <= 0) {
if (count < 0)
_mesa_error(ctx, GL_INVALID_VALUE,