From: Matt Turner Date: Wed, 19 Dec 2012 21:43:31 +0000 (-0800) Subject: Make IsTransformFeedback() return false before BindTransformFeedback() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd93d55141f11069fb76a9b377ad1af88d0ecdd3;p=mesa.git Make IsTransformFeedback() return false before BindTransformFeedback() 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. Reviewed-by: Jordan Justen Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 097cdc14f58..a14520fb23c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1807,6 +1807,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? */ /** * GLES: if Active is true, remaining number of primitives which can be diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 42f38e0cc4a..1bf4beaeb08 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -80,6 +80,7 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr, } else { obj->RefCount++; + obj->EverBound = GL_TRUE; *ptr = obj; } } @@ -178,6 +179,7 @@ new_transform_feedback(struct gl_context *ctx, GLuint name) if (obj) { obj->Name = name; obj->RefCount = 1; + obj->EverBound = GL_FALSE; } return obj; } @@ -793,14 +795,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; }