replace GLint with gl_state_index
This commit is contained in:
@@ -1085,7 +1085,8 @@ parse_matrix (GLcontext * ctx, const GLubyte ** inst, struct arb_program *Progra
|
|||||||
*/
|
*/
|
||||||
static GLuint
|
static GLuint
|
||||||
parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
|
parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
|
||||||
struct arb_program *Program, GLint * state_tokens)
|
struct arb_program *Program,
|
||||||
|
gl_state_index state_tokens[STATE_LENGTH])
|
||||||
{
|
{
|
||||||
switch (*(*inst)++) {
|
switch (*(*inst)++) {
|
||||||
case STATE_MATERIAL_PARSER:
|
case STATE_MATERIAL_PARSER:
|
||||||
@@ -1269,7 +1270,8 @@ parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
|
|||||||
case STATE_CLIP_PLANE:
|
case STATE_CLIP_PLANE:
|
||||||
state_tokens[0] = STATE_CLIPPLANE;
|
state_tokens[0] = STATE_CLIPPLANE;
|
||||||
state_tokens[1] = parse_integer (inst, Program);
|
state_tokens[1] = parse_integer (inst, Program);
|
||||||
if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1]))
|
if (parse_clipplane_num (ctx, inst, Program,
|
||||||
|
(GLint *) &state_tokens[1]))
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1287,9 +1289,10 @@ parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
|
|||||||
|
|
||||||
/* XXX: I think this is the correct format for a matrix row */
|
/* XXX: I think this is the correct format for a matrix row */
|
||||||
case STATE_MATRIX_ROWS:
|
case STATE_MATRIX_ROWS:
|
||||||
if (parse_matrix
|
if (parse_matrix(ctx, inst, Program,
|
||||||
(ctx, inst, Program, &state_tokens[0], &state_tokens[1],
|
(GLint *) &state_tokens[0],
|
||||||
&state_tokens[4]))
|
(GLint *) &state_tokens[1],
|
||||||
|
(GLint *) &state_tokens[4]))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
state_tokens[2] = parse_integer (inst, Program); /* The first row to grab */
|
state_tokens[2] = parse_integer (inst, Program); /* The first row to grab */
|
||||||
@@ -1345,7 +1348,8 @@ parse_state_single_item (GLcontext * ctx, const GLubyte ** inst,
|
|||||||
*/
|
*/
|
||||||
static GLuint
|
static GLuint
|
||||||
parse_program_single_item (GLcontext * ctx, const GLubyte ** inst,
|
parse_program_single_item (GLcontext * ctx, const GLubyte ** inst,
|
||||||
struct arb_program *Program, GLint * state_tokens)
|
struct arb_program *Program,
|
||||||
|
gl_state_index state_tokens[STATE_LENGTH])
|
||||||
{
|
{
|
||||||
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
|
if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
|
||||||
state_tokens[0] = STATE_FRAGMENT_PROGRAM;
|
state_tokens[0] = STATE_FRAGMENT_PROGRAM;
|
||||||
@@ -1720,7 +1724,7 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
|
|||||||
{
|
{
|
||||||
GLint idx;
|
GLint idx;
|
||||||
GLuint err = 0;
|
GLuint err = 0;
|
||||||
GLint state_tokens[STATE_LENGTH];
|
gl_state_index state_tokens[STATE_LENGTH];
|
||||||
GLfloat const_values[4];
|
GLfloat const_values[4];
|
||||||
|
|
||||||
switch (*(*inst)++) {
|
switch (*(*inst)++) {
|
||||||
|
@@ -370,7 +370,7 @@ sizeof_state_reference(const GLint *stateTokens)
|
|||||||
*/
|
*/
|
||||||
GLint
|
GLint
|
||||||
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
|
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
|
||||||
const GLint stateTokens[STATE_LENGTH])
|
const gl_state_index stateTokens[STATE_LENGTH])
|
||||||
{
|
{
|
||||||
const GLuint size = 4; /* XXX fix */
|
const GLuint size = 4; /* XXX fix */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@@ -50,7 +50,7 @@ struct gl_program_parameter
|
|||||||
/**
|
/**
|
||||||
* A sequence of STATE_* tokens and integers to identify GL state.
|
* A sequence of STATE_* tokens and integers to identify GL state.
|
||||||
*/
|
*/
|
||||||
GLint StateIndexes[STATE_LENGTH];
|
gl_state_index StateIndexes[STATE_LENGTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ _mesa_add_attribute(struct gl_program_parameter_list *paramList,
|
|||||||
|
|
||||||
extern GLint
|
extern GLint
|
||||||
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
|
_mesa_add_state_reference(struct gl_program_parameter_list *paramList,
|
||||||
const GLint stateTokens[STATE_LENGTH]);
|
const gl_state_index stateTokens[STATE_LENGTH]);
|
||||||
|
|
||||||
extern GLfloat *
|
extern GLfloat *
|
||||||
_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
|
_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
|
||||||
|
@@ -439,7 +439,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
|
|||||||
* some GL state has changed.
|
* some GL state has changed.
|
||||||
*/
|
*/
|
||||||
GLbitfield
|
GLbitfield
|
||||||
_mesa_program_state_flags(const GLint state[STATE_LENGTH])
|
_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
|
||||||
{
|
{
|
||||||
switch (state[0]) {
|
switch (state[0]) {
|
||||||
case STATE_MATERIAL:
|
case STATE_MATERIAL:
|
||||||
@@ -678,7 +678,7 @@ append_index(char *dst, GLint index)
|
|||||||
* Use _mesa_free() to deallocate the string.
|
* Use _mesa_free() to deallocate the string.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
_mesa_program_state_string(const GLint state[STATE_LENGTH])
|
_mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
|
||||||
{
|
{
|
||||||
char str[1000] = "";
|
char str[1000] = "";
|
||||||
char tmp[30];
|
char tmp[30];
|
||||||
|
@@ -119,11 +119,11 @@ _mesa_load_state_parameters(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
extern GLbitfield
|
extern GLbitfield
|
||||||
_mesa_program_state_flags(const GLint state[STATE_LENGTH]);
|
_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
|
||||||
|
|
||||||
|
|
||||||
extern const char *
|
extern const char *
|
||||||
_mesa_program_state_string(const GLint state[STATE_LENGTH]);
|
_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
|
||||||
|
|
||||||
|
|
||||||
#endif /* PROG_STATEVARS_H */
|
#endif /* PROG_STATEVARS_H */
|
||||||
|
@@ -56,7 +56,7 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
|
|||||||
* Setup state references for the modelview/projection matrix.
|
* Setup state references for the modelview/projection matrix.
|
||||||
* XXX we should check if these state vars are already declared.
|
* XXX we should check if these state vars are already declared.
|
||||||
*/
|
*/
|
||||||
static const GLint mvpState[4][STATE_LENGTH] = {
|
static const gl_state_index mvpState[4][STATE_LENGTH] = {
|
||||||
{ STATE_MVP_MATRIX, 0, 0, 0, 0 }, /* state.matrix.mvp.row[0] */
|
{ STATE_MVP_MATRIX, 0, 0, 0, 0 }, /* state.matrix.mvp.row[0] */
|
||||||
{ STATE_MVP_MATRIX, 0, 1, 1, 0 }, /* state.matrix.mvp.row[1] */
|
{ STATE_MVP_MATRIX, 0, 1, 1, 0 }, /* state.matrix.mvp.row[1] */
|
||||||
{ STATE_MVP_MATRIX, 0, 2, 2, 0 }, /* state.matrix.mvp.row[2] */
|
{ STATE_MVP_MATRIX, 0, 2, 2, 0 }, /* state.matrix.mvp.row[2] */
|
||||||
@@ -125,9 +125,9 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
|
|||||||
void
|
void
|
||||||
_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
|
_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
|
||||||
{
|
{
|
||||||
static const GLint fogPStateOpt[STATE_LENGTH]
|
static const gl_state_index fogPStateOpt[STATE_LENGTH]
|
||||||
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
|
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
|
||||||
static const GLint fogColorState[STATE_LENGTH]
|
static const gl_state_index fogColorState[STATE_LENGTH]
|
||||||
= { STATE_FOG_COLOR, 0, 0, 0, 0};
|
= { STATE_FOG_COLOR, 0, 0, 0, 0};
|
||||||
struct prog_instruction *newInst, *inst;
|
struct prog_instruction *newInst, *inst;
|
||||||
const GLuint origLen = fprog->Base.NumInstructions;
|
const GLuint origLen = fprog->Base.NumInstructions;
|
||||||
|
@@ -309,7 +309,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
|
|||||||
GLuint j;
|
GLuint j;
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
tokens[2] = tokens[3] = j; /* jth row of matrix */
|
tokens[2] = tokens[3] = j; /* jth row of matrix */
|
||||||
pos[j] = _mesa_add_state_reference(paramList, (GLint *) tokens);
|
pos[j] = _mesa_add_state_reference(paramList, tokens);
|
||||||
assert(pos[j] >= 0);
|
assert(pos[j] >= 0);
|
||||||
ASSERT(pos[j] >= 0);
|
ASSERT(pos[j] >= 0);
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* allocate a single register */
|
/* allocate a single register */
|
||||||
GLint pos = _mesa_add_state_reference(paramList, (GLint *) tokens);
|
GLint pos = _mesa_add_state_reference(paramList, tokens);
|
||||||
ASSERT(pos >= 0);
|
ASSERT(pos >= 0);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@@ -199,7 +199,7 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog)
|
|||||||
j = _mesa_add_named_constant(shProg->Uniforms, p->Name, pVals, p->Size);
|
j = _mesa_add_named_constant(shProg->Uniforms, p->Name, pVals, p->Size);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_STATE_VAR:
|
case PROGRAM_STATE_VAR:
|
||||||
j = _mesa_add_state_reference(shProg->Uniforms, (const GLint *) p->StateIndexes);
|
j = _mesa_add_state_reference(shProg->Uniforms, p->StateIndexes);
|
||||||
break;
|
break;
|
||||||
case PROGRAM_UNIFORM:
|
case PROGRAM_UNIFORM:
|
||||||
j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size);
|
j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size);
|
||||||
|
Reference in New Issue
Block a user