[Mesa-dev] [PATCH 3/4] mesa: Reject ResumeTransformFeedback if the wrong program is bound.

Kenneth Graunke kenneth at whitecape.org
Fri Sep 6 16:40:15 PDT 2013


This is actually a pretty important error condition: otherwise, you
could set up transform feedback with one program, and resume it with
a program that generates a completely different set of outputs.

Fixes a subcase of Piglit's new ARB_transform_feedback2 api-errors test.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/main/transformfeedback.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index c2c14a1..191e88c 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -943,6 +943,17 @@ _mesa_ResumeTransformFeedback(void)
       return;
    }
 
+   /* From the ARB_transform_feedback2 specification:
+    * "The error INVALID_OPERATION is generated by ResumeTransformFeedback if
+    *  the program object being used by the current transform feedback object
+    *  is not active."
+    */
+   if (obj->shader_program != ctx->Shader.CurrentVertexProgram) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glResumeTransformFeedback(wrong vertex program bound)");
+      return;
+   }
+
    FLUSH_VERTICES(ctx, 0);
    ctx->NewDriverState |= ctx->DriverFlags.NewTransformFeedback;
 
-- 
1.8.3.4



More information about the mesa-dev mailing list