summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-03-14 14:39:15 -0700
committerEric Anholt <eric@anholt.net>2012-03-19 22:01:22 -0700
commit7ca4f07b5b77ccac0a9b60dc5ac9082906b5947e (patch)
tree95685d366aef37c3d16c5f6dccc3b3dd5777a3dd /src/mesa/main/api_validate.c
parentca760181b4420696c7e86aa2951d7203522ad1e8 (diff)
downloadexternal_mesa3d-7ca4f07b5b77ccac0a9b60dc5ac9082906b5947e.zip
external_mesa3d-7ca4f07b5b77ccac0a9b60dc5ac9082906b5947e.tar.gz
external_mesa3d-7ca4f07b5b77ccac0a9b60dc5ac9082906b5947e.tar.bz2
mesa: Fold error generation into _mesa_valid_prim_mode().
We want to start emitting an INVALID_OPERATION from here for transform feedback. Note that this forced dlist.c to almost not use this function, since it wants different behavior during dlist compile. Just pull the non-TF, non-GS test out for compile, because: 1) TF doesn't matter in that case because there's no drawing. 2) I don't think we're going to see GSes and display lists in the same context, if we don't do GL_ARB_compatibility. Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/api_validate.c')
-rw-r--r--src/mesa/main/api_validate.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
index 4e94f47..17da5d0 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;
}