diff options
author | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
commit | 46d4f558531910ca1f3297da85b99334d6de2921 (patch) | |
tree | 60c37077eb160948fe317a17ec4c19bef679aa35 /mesalib/src/mesa/main/api_validate.c | |
parent | 0bf6df93b9fdbb7902bf1014d605c6876a3ad035 (diff) | |
parent | c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff) | |
download | vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.gz vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.bz2 vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/dpms.c
xorg-server/Xext/saver.c
xorg-server/Xext/security.c
xorg-server/Xext/shape.c
xorg-server/Xext/sync.c
xorg-server/Xi/opendev.c
xorg-server/fb/wfbrename.h
xorg-server/glx/glxserver.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/mi/miarc.c
xorg-server/mi/miwideline.c
xorg-server/os/io.c
xorg-server/render/mipict.c
Diffstat (limited to 'mesalib/src/mesa/main/api_validate.c')
-rw-r--r-- | mesalib/src/mesa/main/api_validate.c | 31 |
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; |