aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
committermarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
commitc1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (patch)
tree8874978d314129a4f47ee575b076c2d8eb1a8738 /mesalib/src/mesa/main/api_validate.c
parent37466741e35c5eb3b204863a5023bf8d192efc06 (diff)
downloadvcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.gz
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.bz2
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.zip
libxtrans libX11 libX11 libXext mesa xserver git update 22 sep 2011
Diffstat (limited to 'mesalib/src/mesa/main/api_validate.c')
-rw-r--r--mesalib/src/mesa/main/api_validate.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 699b414f5..1fcf5cd68 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -199,6 +199,27 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
/**
+ * Is 'mode' a valid value for glBegin(), glDrawArrays(), glDrawElements(),
+ * etc? The set of legal values depends on whether geometry shaders/programs
+ * are supported.
+ */
+GLboolean
+_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode)
+{
+ if (ctx->Extensions.ARB_geometry_shader4 &&
+ mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ return GL_FALSE;
+ }
+ else if (mode > GL_POLYGON) {
+ return GL_FALSE;
+ }
+ else {
+ return GL_TRUE;
+ }
+}
+
+
+/**
* Error checking for glDrawElements(). Includes parameter checking
* and VBO bounds checking.
* \return GL_TRUE if OK to render, GL_FALSE if error found
@@ -216,7 +237,7 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" );
return GL_FALSE;
}
@@ -273,7 +294,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
}
- if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
return GL_FALSE;
}
@@ -332,7 +353,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
return GL_FALSE;
}
- if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
return GL_FALSE;
}
@@ -362,7 +383,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
return GL_FALSE;
}
- if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glDrawArraysInstanced(mode=0x%x)", mode);
return GL_FALSE;
@@ -408,7 +429,7 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
}
- if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glDrawElementsInstanced(mode = 0x%x)", mode);
return GL_FALSE;