/**
- * 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 */
};
_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],
}
else {
ASSERT(program->Parameters->Parameters[src->Index].Type
- == NAMED_PARAMETER);
+ == PROGRAM_NAMED_PARAM);
_mesa_printf("%s", program->Parameters->Parameters[src->Index].Name);
}
}
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;
_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);
}
_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);
}
_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);
}
*/
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++)
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]);
-/*
+/**
* 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] */
};