diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/main/state.c | 36 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 3f315900000..30c7cca3b5a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2615,6 +2615,7 @@ struct gl_matrix_stack #define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */ +#define _NEW_PROGRAM_CONSTANTS 0x20000000 #define _NEW_ALL ~0 /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4f9088dd22f..f18fc8f6837 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -44,6 +44,7 @@ #include "pixel.h" #endif #include "shader/program.h" +#include "shader/prog_parameter.h" #include "state.h" #include "stencil.h" #include "texenvprogram.h" @@ -303,6 +304,36 @@ update_program(GLcontext *ctx) } +/** + * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0. + */ +static GLbitfield +update_program_constants(GLcontext *ctx) +{ + GLbitfield new_state = 0x0; + + if (ctx->FragmentProgram._Current) { + const struct gl_program_parameter_list *params = + ctx->FragmentProgram._Current->Base.Parameters; + if (params && params->StateFlags & ctx->NewState) { + new_state |= _NEW_PROGRAM_CONSTANTS; + } + } + + if (ctx->VertexProgram._Current) { + const struct gl_program_parameter_list *params = + ctx->VertexProgram._Current->Base.Parameters; + if (params && params->StateFlags & ctx->NewState) { + new_state |= _NEW_PROGRAM_CONSTANTS; + } + } + + return new_state; +} + + + + static void update_viewport_matrix(GLcontext *ctx) { @@ -554,6 +585,10 @@ _mesa_update_state_locked( GLcontext *ctx ) new_prog_state |= update_program( ctx ); } + + out: + new_prog_state |= update_program_constants(ctx); + /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. @@ -563,7 +598,6 @@ _mesa_update_state_locked( GLcontext *ctx ) * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ - out: new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); |