diff options
author | Brian Paul <[email protected]> | 2013-05-01 19:15:32 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-05-02 09:03:15 -0600 |
commit | d5bdce1142d23e68404487e107532fd8dd545b1a (patch) | |
tree | 6a3461233952e4f6260d65c3b2e94f209ce652ee /src/mesa/main | |
parent | bb459f6295736d55ab5855d7b19e5e49aaf9af41 (diff) |
mesa: simplify save_Begin() error checking
The old code was hard to understand and not entirely correct.
Note that PRIM_INSIDE_UNKNOWN_PRIM is no longer set anywhere so
we'll be able to remove that next.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dlist.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 9eb13fb385e..57f862be2af 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5646,28 +5646,21 @@ static void GLAPIENTRY 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. */ @@ -5679,10 +5672,10 @@ save_Begin(GLenum mode) if (n) { n[1].e = mode; } - } - if (ctx->ExecuteFlag) { - CALL_Begin(ctx->Exec, (mode)); + if (ctx->ExecuteFlag) { + CALL_Begin(ctx->Exec, (mode)); + } } } |