From 9cc74c93f8983f978e7315e021eb59dfaca6404b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 6 Sep 2013 14:51:26 -0700 Subject: [PATCH] mesa: Reject ResumeTransformFeedback if the wrong program is bound. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák --- 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 c2c14a1d339..191e88c8033 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; -- 2.30.2