aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2011-12-29 15:55:01 -0800
committerPaul Berry <[email protected]>2012-01-04 14:54:48 -0800
commitebfad9f6a125738b9bfc5d5f7d09a8b57856674a (patch)
tree1c27d79680f7e1bf6c91e13dae96ef2f21f789c1 /src/mesa/main
parent1979e22e13dd28553bcc67cc51e56684e6ee4768 (diff)
mesa: Check that all buffers are bound in BeginTransformFeedback.
From the EXT_transform_feedback spec: The error INVALID_OPERATION is generated by BeginTransformFeedbackEXT if any transform feedback buffer object binding point used in transform feedback mode does not have a buffer object bound. This required adding a new NumBuffers field to the gl_transform_feedback_info struct, to keep track of how many transform feedback buffers are required by the current program. Fixes Piglit tests: - EXT_transform_feedback/api-errors interleaved_unbound - EXT_transform_feedback/api-errors separate_unbound_0_1 - EXT_transform_feedback/api-errors separate_unbound_0_2 - EXT_transform_feedback/api-errors separate_unbound_1_2 Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h5
-rw-r--r--src/mesa/main/transformfeedback.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 107371e5299..35458e396ad 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1821,6 +1821,11 @@ struct gl_uniform_list;
struct gl_transform_feedback_info {
unsigned NumOutputs;
+ /**
+ * Number of transform feedback buffers in use by this program.
+ */
+ unsigned NumBuffers;
+
struct {
unsigned OutputRegister;
unsigned OutputBuffer;
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 305589df75a..6e93b3b49d1 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -342,9 +342,12 @@ void GLAPIENTRY
_mesa_BeginTransformFeedback(GLenum mode)
{
struct gl_transform_feedback_object *obj;
+ struct gl_transform_feedback_info *info;
+ int i;
GET_CURRENT_CONTEXT(ctx);
obj = ctx->TransformFeedback.CurrentObject;
+ info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback;
switch (mode) {
case GL_POINTS:
@@ -363,6 +366,15 @@ _mesa_BeginTransformFeedback(GLenum mode)
return;
}
+ for (i = 0; i < info->NumBuffers; ++i) {
+ if (obj->BufferNames[i] == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(binding point %d does not have "
+ "a buffer object bound)", i);
+ return;
+ }
+ }
+
FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK);
obj->Active = GL_TRUE;
ctx->TransformFeedback.Mode = mode;