summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/transformfeedback.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/transformfeedback.c')
-rw-r--r--src/mesa/main/transformfeedback.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index c3aa61c2f6e..fdc3152a091 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -541,19 +541,16 @@ bind_buffer_range(struct gl_context *ctx,
/**
- * Specify a buffer object to receive transform feedback results. Plus,
- * specify the starting offset to place the results, and max size.
+ * Validate the buffer object to receive transform feedback results. Plus,
+ * validate the starting offset to place the results, and max size.
* Called from the glBindBufferRange() and glTransformFeedbackBufferRange
* functions.
*/
-void
-_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
- struct gl_transform_feedback_object *obj,
- GLuint index,
- struct gl_buffer_object *bufObj,
- GLintptr offset,
- GLsizeiptr size,
- bool dsa)
+bool
+_mesa_validate_buffer_range_xfb(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj,
+ GLuint index, struct gl_buffer_object *bufObj,
+ GLintptr offset, GLsizeiptr size, bool dsa)
{
const char *gl_methd_name;
if (dsa)
@@ -565,7 +562,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
if (obj->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback active)",
gl_methd_name);
- return;
+ return false;
}
if (index >= ctx->Const.MaxTransformFeedbackBuffers) {
@@ -575,21 +572,21 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
*/
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)",
gl_methd_name, index);
- return;
+ return false;
}
if (size & 0x3) {
/* OpenGL 4.5 core profile, 6.7, pdf page 103: multiple of 4 */
_mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of "
"four)", gl_methd_name, (int) size);
- return;
+ return false;
}
if (offset & 0x3) {
/* OpenGL 4.5 core profile, 6.7, pdf page 103: multiple of 4 */
_mesa_error(ctx, GL_INVALID_VALUE, "%s(offset=%d must be a multiple "
"of four)", gl_methd_name, (int) offset);
- return;
+ return false;
}
if (offset < 0) {
@@ -602,7 +599,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
_mesa_error(ctx, GL_INVALID_VALUE, "%s(offset=%d must be >= 0)",
gl_methd_name,
(int) offset);
- return;
+ return false;
}
if (size <= 0 && (dsa || bufObj != ctx->Shared->NullBufferObj)) {
@@ -616,10 +613,10 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
*/
_mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be > 0)",
gl_methd_name, (int) size);
- return;
+ return false;
}
- bind_buffer_range(ctx, obj, index, bufObj, offset, size, dsa);
+ return true;
}
@@ -743,8 +740,13 @@ _mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer,
return;
}
- _mesa_bind_buffer_range_transform_feedback(ctx, obj, index, bufObj, offset,
- size, true);
+ if (!_mesa_validate_buffer_range_xfb(ctx, obj, index, bufObj, offset,
+ size, true))
+ return;
+
+ /* The per-attribute binding point */
+ _mesa_set_transform_feedback_binding(ctx, obj, index, bufObj, offset,
+ size);
}
/**
@@ -798,7 +800,7 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return;
}
- bind_buffer_range(ctx, obj, index, bufObj, offset, 0, false);
+ _mesa_bind_buffer_range_xfb(ctx, obj, index, bufObj, offset, 0);
}