diff options
author | Samuel Pitoiset <[email protected]> | 2017-08-24 11:39:59 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-08-25 11:24:08 +0200 |
commit | efb981168050defefc531ab0eb315a780681a07e (patch) | |
tree | 0910927a98d46da2a4042c75a5ecac86014e87c1 | |
parent | 5946806064db29f6bf13a44307326be4d1a0f3f4 (diff) |
mesa: add bind_transform_feedback() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r-- | src/mesa/main/transformfeedback.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index a075d0875ac..d61db4eb628 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -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); } |