aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/transformfeedback.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-08-24 11:34:38 +0200
committerSamuel Pitoiset <[email protected]>2017-08-25 11:35:30 +0200
commitdc058f850c0720880b2738cccde1c7f6e06f2e25 (patch)
tree21342a2b4c226bfb268f06eecc9ee15d7fb86e1e /src/mesa/main/transformfeedback.c
parent83690d45908010b484d3314fd4133d9fff849a92 (diff)
mesa: add bind_buffer_offset() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/transformfeedback.c')
-rw-r--r--src/mesa/main/transformfeedback.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index b79b41d35ef..44a6e149dba 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -779,12 +779,33 @@ _mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer,
* offset in the buffer to start placing results.
* This function is part of GL_EXT_transform_feedback, but not GL3.
*/
+static ALWAYS_INLINE void
+bind_buffer_offset(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj, GLuint index,
+ GLuint buffer, GLintptr offset, bool no_error)
+{
+ struct gl_buffer_object *bufObj;
+
+ if (buffer == 0) {
+ bufObj = ctx->Shared->NullBufferObj;
+ } else {
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!no_error && !bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferOffsetEXT(invalid buffer=%u)", buffer);
+ return;
+ }
+ }
+
+ _mesa_bind_buffer_range_xfb(ctx, obj, index, bufObj, offset, 0);
+}
+
+
void GLAPIENTRY
_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
GLintptr offset)
{
struct gl_transform_feedback_object *obj;
- struct gl_buffer_object *bufObj;
GET_CURRENT_CONTEXT(ctx);
if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
@@ -813,18 +834,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return;
}
- if (buffer == 0) {
- bufObj = ctx->Shared->NullBufferObj;
- } else {
- bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferOffsetEXT(invalid buffer=%u)", buffer);
- return;
- }
- }
-
- _mesa_bind_buffer_range_xfb(ctx, obj, index, bufObj, offset, 0);
+ bind_buffer_offset(ctx, obj, index, buffer, offset, false);
}