[Mesa-dev] [PATCH 1/2] Make IsTransformFeedback() return false before BindTransformFeedback()
Matt Turner
mattst88 at gmail.com
Thu Dec 20 19:47:54 PST 2012
The GL 4.3 an ES 3.0 specs say
A transform feedback object is created by binding a name returned by
GenTransformFeedbacks with the command
void BindTransformFeedback( enum target, uint id );
Fixes arb_transform_feedback2-istransformfeedback and part of
es3conform's CoverageES30.test.
---
src/mesa/main/mtypes.h | 1 +
src/mesa/main/transformfeedback.c | 13 ++++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6fde421..9e7c47a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1818,6 +1818,7 @@ struct gl_transform_feedback_object
GLboolean Paused; /**< Is transform feedback paused? */
GLboolean EndedAnytime; /**< Has EndTransformFeedback been called
at least once? */
+ GLboolean EverBound; /**< Has this object been bound? */
/** The feedback buffers */
GLuint BufferNames[MAX_FEEDBACK_BUFFERS];
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 22060c3..6f5873c 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -79,6 +79,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr,
}
else {
obj->RefCount++;
+ obj->EverBound = GL_TRUE;
*ptr = obj;
}
}
@@ -177,6 +178,7 @@ new_transform_feedback(struct gl_context *ctx, GLuint name)
if (obj) {
obj->Name = name;
obj->RefCount = 1;
+ obj->EverBound = GL_FALSE;
}
return obj;
}
@@ -708,14 +710,19 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)
GLboolean GLAPIENTRY
_mesa_IsTransformFeedback(GLuint name)
{
+ struct gl_transform_feedback_object *obj;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- if (name && _mesa_lookup_transform_feedback_object(ctx, name))
- return GL_TRUE;
- else
+ if (name == 0)
+ return GL_FALSE;
+
+ obj = _mesa_lookup_transform_feedback_object(ctx, name);
+ if (obj == NULL)
return GL_FALSE;
+
+ return obj->EverBound;
}
--
1.7.8.6
More information about the mesa-dev
mailing list