diff options
author | Keith Whitwell <[email protected]> | 2005-11-22 12:12:17 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2005-11-22 12:12:17 +0000 |
commit | ec1ffd9f2578ec2f289a9dbd8e08c8821bafb169 (patch) | |
tree | 45e8482ce0db978b8b7e607506b00e457c7963da /src | |
parent | 5a771857d9069773e5a6ede9694b0e5b8a03ff67 (diff) |
track state flags which might invalidate parameter lists
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/shader/program.c | 77 | ||||
-rw-r--r-- | src/mesa/shader/program.h | 3 |
2 files changed, 80 insertions, 0 deletions
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index b6371329a5c..c668ce8a5a0 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -45,6 +45,9 @@ static const char * make_state_string(const GLint stateTokens[6]); +static GLuint +make_state_flags(const GLint state[]); + /**********************************************************************/ /* Utility functions */ @@ -459,6 +462,9 @@ _mesa_add_state_reference(struct program_parameter_list *paramList, for (i = 0; i < 6; i++) paramList->Parameters[index].StateIndexes[i] = (enum state_index) stateTokens[i]; + + paramList->StateFlags |= + make_state_flags(stateTokens); } return index; @@ -899,6 +905,77 @@ _mesa_fetch_state(GLcontext *ctx, const enum state_index state[], } +/* Return a bit mask of the Mesa state flags under which a parameter's + * value might change. + */ +static GLuint make_state_flags(const GLint state[]) +{ + switch (state[0]) { + case STATE_MATERIAL: + case STATE_LIGHT: + case STATE_LIGHTMODEL_AMBIENT: + case STATE_LIGHTMODEL_SCENECOLOR: + case STATE_LIGHTPROD: + return _NEW_LIGHT; + + case STATE_TEXGEN: + case STATE_TEXENV_COLOR: + return _NEW_TEXTURE; + + case STATE_FOG_COLOR: + case STATE_FOG_PARAMS: + return _NEW_FOG; + + case STATE_CLIPPLANE: + return _NEW_TRANSFORM; + + case STATE_POINT_SIZE: + case STATE_POINT_ATTENUATION: + return _NEW_POINT; + + case STATE_MATRIX: + switch (state[1]) { + case STATE_MODELVIEW: + return _NEW_MODELVIEW; + case STATE_PROJECTION: + return _NEW_PROJECTION; + case STATE_MVP: + return _NEW_MODELVIEW | _NEW_PROJECTION; + case STATE_TEXTURE: + return _NEW_TEXTURE_MATRIX; + case STATE_PROGRAM: + return _NEW_TRACK_MATRIX; + default: + assert(0); + return 0; + } + + case STATE_DEPTH_RANGE: + return _NEW_VIEWPORT; + + case STATE_FRAGMENT_PROGRAM: + case STATE_VERTEX_PROGRAM: + return _NEW_PROGRAM; + + case STATE_INTERNAL: + switch (state[1]) { + case STATE_NORMAL_SCALE: + return _NEW_MODELVIEW; + default: + assert(0); + return 0; + } + + default: + assert(0); + return 0; + } +} + + + + + static void append(char *dst, const char *src) { diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index a1ee3349dce..3e6c8a7d98a 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -204,6 +204,9 @@ struct program_parameter_list GLuint NumParameters; /** number of parameters in arrays */ struct program_parameter *Parameters; /** Array [Size] */ GLfloat (*ParameterValues)[4]; /** Array [Size] */ + GLuint StateFlags; /** _NEW_* flags indicating which + statechanges might invalidate + ParameterValues[] */ }; |