save_Begin(GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
- Node *n;
- GLboolean error = GL_FALSE;
- if (ctx->ExecuteFlag && !_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
- * a begin/end or not.
- */
- ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
+ if (!_mesa_is_valid_prim_mode(ctx, mode)) {
+ /* compile this error into the display list */
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
}
- else if (!_mesa_inside_dlist_begin_end(ctx)) {
- ctx->Driver.CurrentSavePrimitive = mode;
+ else if (_mesa_inside_dlist_begin_end(ctx) &&
+ ctx->Driver.CurrentSavePrimitive != PRIM_UNKNOWN) {
+ /* compile this error into the display list */
+ _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
}
else {
- _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin");
- error = GL_TRUE;
- }
+ Node *n;
+
+ ctx->Driver.CurrentSavePrimitive = mode;
- if (!error) {
/* Give the driver an opportunity to hook in an optimized
* display list compiler.
*/
if (n) {
n[1].e = mode;
}
- }
- if (ctx->ExecuteFlag) {
- CALL_Begin(ctx->Exec, (mode));
+ if (ctx->ExecuteFlag) {
+ CALL_Begin(ctx->Exec, (mode));
+ }
}
}