mesa: add bind_transform_feedback() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 24 Aug 2017 09:39:59 +0000 (11:39 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 25 Aug 2017 09:24:08 +0000 (11:24 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/transformfeedback.c

index a075d0875ac6640b106c2986217ca69252735ccb..d61db4eb62811ca4c8b776060a49130b38ae38ac 100644 (file)
@@ -1062,10 +1062,26 @@ _mesa_IsTransformFeedback(GLuint name)
  * Bind the given transform feedback object.
  * Part of GL_ARB_transform_feedback2.
  */
+static ALWAYS_INLINE void
+bind_transform_feedback(struct gl_context *ctx, GLuint name, bool no_error)
+{
+   struct gl_transform_feedback_object *obj;
+
+   obj = _mesa_lookup_transform_feedback_object(ctx, name);
+   if (!no_error && !obj) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glBindTransformFeedback(name=%u)", name);
+      return;
+   }
+
+   reference_transform_feedback_object(&ctx->TransformFeedback.CurrentObject,
+                                       obj);
+}
+
+
 void GLAPIENTRY
 _mesa_BindTransformFeedback(GLenum target, GLuint name)
 {
-   struct gl_transform_feedback_object *obj;
    GET_CURRENT_CONTEXT(ctx);
 
    if (target != GL_TRANSFORM_FEEDBACK) {
@@ -1079,15 +1095,7 @@ _mesa_BindTransformFeedback(GLenum target, GLuint name)
       return;
    }
 
-   obj = _mesa_lookup_transform_feedback_object(ctx, name);
-   if (!obj) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glBindTransformFeedback(name=%u)", name);
-      return;
-   }
-
-   reference_transform_feedback_object(&ctx->TransformFeedback.CurrentObject,
-                                       obj);
+   bind_transform_feedback(ctx, name, false);
 }