diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/api_validate.c | 24 | ||||
-rw-r--r-- | src/mesa/main/api_validate.h | 2 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 10 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 3 |
4 files changed, 19 insertions, 20 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 4e94f47e328..17da5d01b7e 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -204,13 +204,15 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, * are supported. */ GLboolean -_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode) +_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name) { if (ctx->Extensions.ARB_geometry_shader4 && mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode); return GL_FALSE; } else if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode); return GL_FALSE; } else { @@ -237,8 +239,7 @@ _mesa_validate_DrawElements(struct gl_context *ctx, return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) { return GL_FALSE; } @@ -294,8 +295,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) { return GL_FALSE; } @@ -353,8 +353,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArrays")) { return GL_FALSE; } @@ -389,9 +388,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glDrawArraysInstanced(mode=0x%x)", mode); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArraysInstanced")) { return GL_FALSE; } @@ -429,9 +426,7 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, return GL_FALSE; } - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glDrawElementsInstanced(mode = 0x%x)", mode); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) { return GL_FALSE; } @@ -485,8 +480,7 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, { ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glDrawTransformFeedback(mode)"); + if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback")) { return GL_FALSE; } diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h index f4948424c36..d92fd433f3e 100644 --- a/src/mesa/main/api_validate.h +++ b/src/mesa/main/api_validate.h @@ -43,7 +43,7 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, extern GLboolean -_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode); +_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name); extern GLboolean diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 420ddcc0cce..f113573d883 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5767,10 +5767,16 @@ save_Begin(GLenum mode) Node *n; GLboolean error = GL_FALSE; - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)"); + if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBegin(mode=%x)", mode); error = GL_TRUE; } + if (ctx->ExecuteFlag) { + if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) { + error = GL_TRUE; + } + } + else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) { /* Typically the first begin. This may raise an error on * playback, depending on whether CallList is issued from inside diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index cb5f9ae522b..30619906706 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -696,8 +696,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) struct vbo_exec_context *exec = &vbo_context(ctx)->exec; int i; - if (!_mesa_valid_prim_mode(ctx, mode)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBegin"); + if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) { return; } |