summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-05-01 19:15:32 -0600
committerBrian Paul <[email protected]>2013-05-02 09:03:15 -0600
commitd6f3ef92d7cdc48c3fee50aac09e33148aec035f (patch)
treea2452b32c728d7f70cd0719333f9bcc2491c6026 /src
parent94c7caf406debc0d35153267f491e30a203f9a72 (diff)
vbo: fix parameter validation for saving dlist glDraw* functions
The _save_OBE_DrawArrays/Elements/RangeElements() functions are called when building a display list and we know we're outside glBegin/End. We shouldn't call the normal _mesa_validate_DrawArrays/Elements() functions here because those functions only work properly in immediate mode or during dlist execution. At dlist compile time, we can't call _mesa_update_state(), etc. and examine the current state since it won't apply when the list is executed later. Fixes several failures in piglit's gl-1.0-beginend-coverage test. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/vbo/vbo_save_api.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 4fae37a2afe..1b080f4ec22 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1232,8 +1232,14 @@ _save_OBE_DrawArrays(GLenum mode, GLint start, GLsizei count)
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
- if (!_mesa_validate_DrawArrays(ctx, mode, start, count))
+ if (!_mesa_is_valid_prim_mode(ctx, mode)) {
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)");
return;
+ }
+ if (count < 0) {
+ _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count<0)");
+ return;
+ }
if (save->out_of_memory)
return;
@@ -1262,8 +1268,20 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type,
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
- if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices, 0))
+ if (!_mesa_is_valid_prim_mode(ctx, mode)) {
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)");
+ return;
+ }
+ if (count < 0) {
+ _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawElements(count<0)");
+ return;
+ }
+ if (type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT &&
+ type != GL_UNSIGNED_INT) {
+ _mesa_compile_error(ctx, GL_INVALID_VALUE, "glDrawElements(count<0)");
return;
+ }
if (save->out_of_memory)
return;
@@ -1309,9 +1327,26 @@ _save_OBE_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
GET_CURRENT_CONTEXT(ctx);
struct vbo_save_context *save = &vbo_context(ctx)->save;
- if (!_mesa_validate_DrawRangeElements(ctx, mode,
- start, end, count, type, indices, 0))
+ if (!_mesa_is_valid_prim_mode(ctx, mode)) {
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)");
return;
+ }
+ if (count < 0) {
+ _mesa_compile_error(ctx, GL_INVALID_VALUE,
+ "glDrawRangeElements(count<0)");
+ return;
+ }
+ if (type != GL_UNSIGNED_BYTE &&
+ type != GL_UNSIGNED_SHORT &&
+ type != GL_UNSIGNED_INT) {
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)");
+ return;
+ }
+ if (end < start) {
+ _mesa_compile_error(ctx, GL_INVALID_VALUE,
+ "glDrawRangeElements(end < start)");
+ return;
+ }
if (save->out_of_memory)
return;