From: Keith Whitwell Date: Tue, 30 Jun 2009 16:04:11 +0000 (+0100) Subject: mesa/dlist: invalidate cached dlist compile state after CallList X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e91d035b9ef65adda39c8b164afa363477d7893;p=mesa.git 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. --- diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 93b8a8f56d2..3e8b5a94245 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;