[Mesa-dev] [PATCH 07/10] mesa: create _mesa_bind_buffer_range_xfb() helper

Timothy Arceri tarceri at itsqueeze.com
Mon May 22 05:46:59 UTC 2017


---
 src/mesa/main/transformfeedback.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h
index c83f917..475f5f1 100644
--- a/src/mesa/main/transformfeedback.h
+++ b/src/mesa/main/transformfeedback.h
@@ -143,20 +143,40 @@ _mesa_set_transform_feedback_binding(struct gl_context *ctx,
    _mesa_reference_buffer_object(ctx, &tfObj->Buffers[index], bufObj);
 
    tfObj->BufferNames[index]   = bufObj->Name;
    tfObj->Offset[index]        = offset;
    tfObj->RequestedSize[index] = size;
 
    if (bufObj != ctx->Shared->NullBufferObj)
       bufObj->UsageHistory |= USAGE_TRANSFORM_FEEDBACK_BUFFER;
 }
 
+static inline void
+_mesa_bind_buffer_range_xfb(struct gl_context *ctx,
+                            struct gl_transform_feedback_object *obj,
+                            GLuint index, struct gl_buffer_object *bufObj,
+                            GLintptr offset, GLsizeiptr size)
+{
+   /* Note: no need to FLUSH_VERTICES or flag NewTransformFeedback, because
+    * transform feedback buffers can't be changed while transform feedback is
+    * active.
+    */
+
+   /* The general binding point */
+   _mesa_reference_buffer_object(ctx,
+                                 &ctx->TransformFeedback.CurrentBuffer,
+                                 bufObj);
+
+   /* The per-attribute binding point */
+   _mesa_set_transform_feedback_binding(ctx, obj, index, bufObj, offset, size);
+}
+
 /*** GL_ARB_direct_state_access ***/
 
 extern void GLAPIENTRY
 _mesa_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);
 
 extern void GLAPIENTRY
 _mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer,
                                    GLintptr offset, GLsizeiptr size);
 
 extern void GLAPIENTRY
-- 
2.9.4



More information about the mesa-dev mailing list