summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/state.c')
-rw-r--r--src/mesa/main/state.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 0ed7300c191..3e7554f44fa 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -740,16 +740,13 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
/*@{*/
-/*
- * Update items which depend on vertex/fragment programs.
- */
static void
-update_program( GLcontext *ctx )
+update_separate_specular( GLcontext *ctx )
{
- if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
- if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1))
- ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
- }
+ if (NEED_SECONDARY_COLOR(ctx))
+ ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
+ else
+ ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
}
@@ -872,7 +869,7 @@ update_arrays( GLcontext *ctx )
*/
void _mesa_update_state( GLcontext *ctx )
{
- const GLuint new_state = ctx->NewState;
+ GLuint new_state = ctx->NewState;
if (MESA_VERBOSE & VERBOSE_STATE)
_mesa_print_state("_mesa_update_state", new_state);
@@ -880,7 +877,7 @@ void _mesa_update_state( GLcontext *ctx )
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
_mesa_update_modelview_project( ctx, new_state );
- if (new_state & (_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
+ if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
_mesa_update_texture( ctx, new_state );
if (new_state & (_NEW_SCISSOR|_NEW_BUFFERS))
@@ -895,10 +892,10 @@ void _mesa_update_state( GLcontext *ctx )
if (new_state & _IMAGE_NEW_TRANSFER_STATE)
_mesa_update_pixel( ctx, new_state );
- if (new_state & _NEW_PROGRAM)
- update_program( ctx );
+ if (new_state & _DD_NEW_SEPARATE_SPECULAR)
+ update_separate_specular( ctx );
- if (new_state & _NEW_ARRAY)
+ if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
update_arrays( ctx );
/* ctx->_NeedEyeCoords is now up to date.
@@ -922,6 +919,7 @@ void _mesa_update_state( GLcontext *ctx )
* Set ctx->NewState to zero to avoid recursion if
* Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
*/
+ new_state = ctx->NewState;
ctx->NewState = 0;
ctx->Driver.UpdateState(ctx, new_state);
ctx->Array.NewState = 0;