diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-06-30 17:04:11 +0100 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-06-30 17:04:11 +0100 |
commit | 7e91d035b9ef65adda39c8b164afa363477d7893 (patch) | |
tree | 80abadd678a8b3acc0e3db8fd7deca03cac70051 /src | |
parent | 2e570be85211f603b820dd2c5e9aa2f29a51fc66 (diff) |
mesa/dlist: invalidate cached dlist compile state after CallList
When compiling a display list containing a CallList, it is necessary to
invalidate any assumption about the GL state after the recursive call
completes.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/dlist.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 93b8a8f56d..3e8b5a9424 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -957,6 +957,20 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) } } +static void invalidate_saved_current_state( GLcontext *ctx ) +{ + GLint i; + + for (i = 0; i < VERT_ATTRIB_MAX; i++) + ctx->ListState.ActiveAttribSize[i] = 0; + + for (i = 0; i < MAT_ATTRIB_MAX; i++) + ctx->ListState.ActiveMaterialSize[i] = 0; + + memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current); + + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; +} void GLAPIENTRY _mesa_save_CallList(GLuint list) @@ -970,9 +984,10 @@ _mesa_save_CallList(GLuint list) n[1].ui = list; } - /* After this, we don't know what begin/end state we're in: + /* After this, we don't know what state we're in. Invalidate all + * cached information previously gathered: */ - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + invalidate_saved_current_state( ctx ); if (ctx->ExecuteFlag) { _mesa_CallList(list); @@ -1015,9 +1030,10 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) } } - /* After this, we don't know what begin/end state we're in: + /* After this, we don't know what state we're in. Invalidate all + * cached information previously gathered: */ - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; + invalidate_saved_current_state( ctx ); if (ctx->ExecuteFlag) { CALL_CallLists(ctx->Exec, (n, type, lists)); @@ -6795,7 +6811,6 @@ void GLAPIENTRY _mesa_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); - GLint i; FLUSH_CURRENT(ctx, 0); /* must be called before assert */ ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -6823,22 +6838,15 @@ _mesa_NewList(GLuint name, GLenum mode) ctx->CompileFlag = GL_TRUE; ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); + /* Reset acumulated list state: + */ + invalidate_saved_current_state( ctx ); + /* Allocate new display list */ ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE); ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head; ctx->ListState.CurrentPos = 0; - /* Reset acumulated list state: - */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) - ctx->ListState.ActiveAttribSize[i] = 0; - - for (i = 0; i < MAT_ATTRIB_MAX; i++) - ctx->ListState.ActiveMaterialSize[i] = 0; - - memset(&ctx->ListState.Current, 0, sizeof ctx->ListState.Current); - - ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; ctx->Driver.NewList(ctx, name, mode); ctx->CurrentDispatch = ctx->Save; |