* 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 {
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;
}
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;
}
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;
}
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;
}
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;
}
{
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;
}
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