aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/api_validate.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
committermarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
commit53192e17e55aa9ed3e3721bf4fdcb2b01a595202 (patch)
tree01d81bc7cfb5dc92584f4b7615d2ac1b09fe5411 /mesalib/src/mesa/main/api_validate.c
parent05d67ae9117e5157fd1a5175dde6d7e48caf4653 (diff)
downloadvcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.gz
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.bz2
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.zip
randrproto xwininfo fontconfig libxcb mesa xkeyboard-config pixman xserver
git update 31 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main/api_validate.c')
-rw-r--r--mesalib/src/mesa/main/api_validate.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index b15dfba73..d0d2ca4d4 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -22,6 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <stdbool.h>
#include "glheader.h"
#include "api_validate.h"
#include "bufferobj.h"
@@ -209,12 +210,36 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
GLboolean
_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;
+ bool valid_enum;
+
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_LINE_LOOP:
+ case GL_LINE_STRIP:
+ case GL_TRIANGLES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ valid_enum = true;
+ break;
+ case GL_QUADS:
+ case GL_QUAD_STRIP:
+ case GL_POLYGON:
+ valid_enum = (ctx->API == API_OPENGL);
+ break;
+ case GL_LINES_ADJACENCY:
+ case GL_LINE_STRIP_ADJACENCY:
+ case GL_TRIANGLES_ADJACENCY:
+ case GL_TRIANGLE_STRIP_ADJACENCY:
+ valid_enum = _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_geometry_shader4;
+ break;
+ default:
+ valid_enum = false;
+ break;
}
- else if (mode > GL_POLYGON) {
+
+ if (!valid_enum) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
return GL_FALSE;
}