Mesa (master): mesa: Additional error checks for transform feedback.
Paul Berry
stereotype441 at kemper.freedesktop.org
Wed Jan 4 23:00:18 UTC 2012
Module: Mesa
Branch: master
Commit: 86bb45ffc36280263ba99fdca0c341489ad99e7f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86bb45ffc36280263ba99fdca0c341489ad99e7f
Author: Paul Berry <stereotype441 at gmail.com>
Date: Fri Dec 30 10:14:35 2011 -0800
mesa: Additional error checks for transform feedback.
>From the EXT_transform_feedback spec:
The error INVALID_OPERATION is also generated by BeginTransformFeedbackEXT
if no binding points would be used, either because no program object is
active or because the active program object has specified no varying
variables to record.
...
The error INVALID_VALUE is generated by BindBufferRangeEXT or
BindBufferOffsetEXT if <offset> is not word-aligned.
Fixes Piglit tests:
- EXT_transform_feedback/api-errors no_prog_active
- EXT_transform_feedback/api-errors interleaved_no_varyings
- EXT_transform_feedback/api-errors separate_no_varyings
- EXT_transform_feedback/api-errors bind_offset_offset_1
- EXT_transform_feedback/api-errors bind_offset_offset_2
- EXT_transform_feedback/api-errors bind_offset_offset_3
- EXT_transform_feedback/api-errors bind_offset_offset_5
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
---
src/mesa/main/transformfeedback.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 6e93b3b..02681c6 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -347,8 +347,21 @@ _mesa_BeginTransformFeedback(GLenum mode)
GET_CURRENT_CONTEXT(ctx);
obj = ctx->TransformFeedback.CurrentObject;
+
+ if (ctx->Shader.CurrentVertexProgram == NULL) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(no program active)");
+ return;
+ }
+
info = &ctx->Shader.CurrentVertexProgram->LinkedTransformFeedback;
+ if (info->NumOutputs == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(no varyings to record)");
+ return;
+ }
+
switch (mode) {
case GL_POINTS:
case GL_LINES:
@@ -581,6 +594,13 @@ _mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
return;
}
+ if (offset & 0x3) {
+ /* must be multiple of four */
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferOffsetEXT(offset=%d)", (int) offset);
+ return;
+ }
+
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
More information about the mesa-commit
mailing list