diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/mtypes.h | 25 | ||||
-rw-r--r-- | src/mesa/shader/nvfragparse.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 12 | ||||
-rw-r--r-- | src/mesa/shader/program.h | 21 |
4 files changed, 28 insertions, 34 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index cc44acf3cf..3271cb0772 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1723,20 +1723,23 @@ struct atifs_machine /** - * Names of the various vertex/fragment register files + * Names of the various vertex/fragment program register files, etc. + * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c) + * All values should fit in a 4-bit field. */ enum register_file { - PROGRAM_TEMPORARY, - PROGRAM_INPUT, - PROGRAM_OUTPUT, - PROGRAM_LOCAL_PARAM, - PROGRAM_ENV_PARAM, - PROGRAM_NAMED_PARAM, - PROGRAM_STATE_VAR, - PROGRAM_WRITE_ONLY, - PROGRAM_ADDRESS, - PROGRAM_UNDEFINED /* invalid value */ + PROGRAM_TEMPORARY = 0, + PROGRAM_LOCAL_PARAM = 1, + PROGRAM_ENV_PARAM = 2, + PROGRAM_STATE_VAR = 3, + PROGRAM_INPUT = 4, + PROGRAM_OUTPUT = 5, + PROGRAM_NAMED_PARAM = 6, + PROGRAM_CONSTANT = 7, + PROGRAM_WRITE_ONLY = 8, + PROGRAM_ADDRESS = 9, + PROGRAM_UNDEFINED = 15 /* invalid value */ }; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 2e1113267a..41344ec869 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -1582,7 +1582,7 @@ PrintSrcReg(const struct fragment_program *program, _mesa_printf("-"); } if (src->File == PROGRAM_NAMED_PARAM) { - if (program->Parameters->Parameters[src->Index].Type == CONSTANT) { + if (program->Parameters->Parameters[src->Index].Type == PROGRAM_CONSTANT) { _mesa_printf("{%g, %g, %g, %g}", program->Parameters->ParameterValues[src->Index][0], program->Parameters->ParameterValues[src->Index][1], @@ -1591,7 +1591,7 @@ PrintSrcReg(const struct fragment_program *program, } else { ASSERT(program->Parameters->Parameters[src->Index].Type - == NAMED_PARAMETER); + == PROGRAM_NAMED_PARAM); _mesa_printf("%s", program->Parameters->Parameters[src->Index].Name); } } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 7b9185a6a8..b4ac8f51d4 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -388,7 +388,7 @@ _mesa_free_parameters(struct program_parameter_list *paramList) static GLint add_parameter(struct program_parameter_list *paramList, const char *name, const GLfloat values[4], - enum parameter_type type) + enum register_file type) { const GLuint n = paramList->NumParameters; @@ -443,7 +443,7 @@ GLint _mesa_add_named_parameter(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]) { - return add_parameter(paramList, name, values, NAMED_PARAMETER); + return add_parameter(paramList, name, values, PROGRAM_NAMED_PARAM); } @@ -457,7 +457,7 @@ GLint _mesa_add_named_constant(struct program_parameter_list *paramList, const char *name, const GLfloat values[4]) { - return add_parameter(paramList, name, values, CONSTANT); + return add_parameter(paramList, name, values, PROGRAM_CONSTANT); } @@ -471,7 +471,7 @@ GLint _mesa_add_unnamed_constant(struct program_parameter_list *paramList, const GLfloat values[4]) { - return add_parameter(paramList, NULL, values, CONSTANT); + return add_parameter(paramList, NULL, values, PROGRAM_CONSTANT); } @@ -491,7 +491,7 @@ _mesa_add_state_reference(struct program_parameter_list *paramList, */ GLint index; - index = add_parameter(paramList, NULL, NULL, STATE); + index = add_parameter(paramList, NULL, NULL, PROGRAM_STATE_VAR); if (index >= 0) { GLuint i; for (i = 0; i < 6; i++) @@ -953,7 +953,7 @@ _mesa_load_state_parameters(GLcontext *ctx, return; for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Type == STATE) { + if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { _mesa_fetch_state(ctx, paramList->Parameters[i].StateIndexes, paramList->ParameterValues[i]); diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index 776062f7d0..2d8ff4ab14 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -190,35 +190,26 @@ enum state_index { -/* +/** * Named program parameters * Used for NV_fragment_program "DEFINE"d constants and "DECLARE"d parameters, * and ARB_fragment_program global state references. For the later, Name * might be "state.light[0].diffuse", for example. */ - -enum parameter_type -{ - NAMED_PARAMETER, - CONSTANT, - STATE -}; - - struct program_parameter { const char *Name; /* Null-terminated */ - enum parameter_type Type; + enum register_file Type; /** PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ enum state_index StateIndexes[6]; /* Global state reference */ }; struct program_parameter_list { - GLuint Size; - GLuint NumParameters; - struct program_parameter *Parameters; - GLfloat (*ParameterValues)[4]; + GLuint Size; /** allocated size of Parameters, ParameterValues */ + GLuint NumParameters; /** number of parameters in arrays */ + struct program_parameter *Parameters; /** Array [Size] */ + GLfloat (*ParameterValues)[4]; /** Array [Size] */ }; |