diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-09-21 11:01:26 -0600 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-09-21 11:14:49 -0600 |
commit | 97b81eb98f57e9405ce3665df24eedd1a1af39fc (patch) | |
tree | e0445e3dab0d1147faa5b037229d6f4490bbb9c2 | |
parent | 8d987d3c4edf489880e5e852e31b6883a15b6a14 (diff) |
rename index var from i to attr, use FRAG_ATTRIB_MAX instead of 16
-rw-r--r-- | src/mesa/state_tracker/st_atom_fs.c | 24 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_vs.c | 32 |
2 files changed, 28 insertions, 28 deletions
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c index 8ee4f407c7..dd9d2476ba 100644 --- a/src/mesa/state_tracker/st_atom_fs.c +++ b/src/mesa/state_tracker/st_atom_fs.c @@ -60,7 +60,7 @@ st_translate_fragment_shader(struct st_context *st, struct pipe_shader_state fs; const struct cso_fragment_shader *cso; GLuint interpMode[16]; /* XXX size? */ - GLuint i; + GLuint attr; GLbitfield inputsRead = stfp->Base.Base.InputsRead; /* Check if all fragment programs need the fragment position (in order @@ -71,11 +71,11 @@ st_translate_fragment_shader(struct st_context *st, memset(&fs, 0, sizeof(fs)); - for (i = 0; i < 16; i++) { - if (inputsRead & (1 << i)) { - inputMapping[i] = fs.num_inputs; + for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) { + if (inputsRead & (1 << attr)) { + inputMapping[attr] = fs.num_inputs; - switch (i) { + switch (attr) { case FRAG_ATTRIB_WPOS: fs.input_semantic_name[fs.num_inputs] = TGSI_SEMANTIC_POSITION; fs.input_semantic_index[fs.num_inputs] = 0; @@ -103,14 +103,14 @@ st_translate_fragment_shader(struct st_context *st, case FRAG_ATTRIB_TEX6: case FRAG_ATTRIB_TEX7: fs.input_semantic_name[fs.num_inputs] = TGSI_SEMANTIC_TEXCOORD; - fs.input_semantic_index[fs.num_inputs] = i - FRAG_ATTRIB_TEX0; + fs.input_semantic_index[fs.num_inputs] = attr - FRAG_ATTRIB_TEX0; interpMode[fs.num_inputs] = TGSI_INTERPOLATE_PERSPECTIVE; break; case FRAG_ATTRIB_VAR0: /* fall-through */ default: fs.input_semantic_name[fs.num_inputs] = TGSI_SEMANTIC_GENERIC; - fs.input_semantic_index[fs.num_inputs] = i - FRAG_ATTRIB_VAR0; + fs.input_semantic_index[fs.num_inputs] = attr - FRAG_ATTRIB_VAR0; interpMode[fs.num_inputs] = TGSI_INTERPOLATE_PERSPECTIVE; } @@ -121,16 +121,16 @@ st_translate_fragment_shader(struct st_context *st, /* * Outputs */ - for (i = 0; i < FRAG_RESULT_MAX; i++) { - if (stfp->Base.Base.OutputsWritten & (1 << i)) { - switch (i) { + for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { + if (stfp->Base.Base.OutputsWritten & (1 << attr)) { + switch (attr) { case FRAG_RESULT_DEPR: fs.output_semantic_name[fs.num_outputs] = TGSI_SEMANTIC_POSITION; - outputMapping[i] = fs.num_outputs; + outputMapping[attr] = fs.num_outputs; break; case FRAG_RESULT_COLR: fs.output_semantic_name[fs.num_outputs] = TGSI_SEMANTIC_COLOR; - outputMapping[i] = fs.num_outputs; + outputMapping[attr] = fs.num_outputs; break; default: assert(0); diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c index c1bcdbe5a1..2add3dcfef 100644 --- a/src/mesa/state_tracker/st_atom_vs.c +++ b/src/mesa/state_tracker/st_atom_vs.c @@ -59,7 +59,7 @@ st_translate_vertex_shader(struct st_context *st, { struct pipe_shader_state vs; const struct cso_vertex_shader *cso; - GLuint i; + GLuint attr; memset(&vs, 0, sizeof(vs)); @@ -67,11 +67,11 @@ st_translate_vertex_shader(struct st_context *st, * Determine number of inputs, the mappings between VERT_ATTRIB_x * and TGSI generic input indexes, plus input attrib semantic info. */ - for (i = 0; i < MAX_VERTEX_PROGRAM_ATTRIBS; i++) { - if (stvp->Base.Base.InputsRead & (1 << i)) { - stvp->input_to_index[i] = vs.num_inputs; - stvp->index_to_input[vs.num_inputs] = i; - switch (i) { + for (attr = 0; attr < MAX_VERTEX_PROGRAM_ATTRIBS; attr++) { + if (stvp->Base.Base.InputsRead & (1 << attr)) { + stvp->input_to_index[attr] = vs.num_inputs; + stvp->index_to_input[vs.num_inputs] = attr; + switch (attr) { case VERT_ATTRIB_POS: vs.input_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_POSITION; vs.input_semantic_index[vs.num_inputs] = 0; @@ -100,7 +100,7 @@ st_translate_vertex_shader(struct st_context *st, case VERT_ATTRIB_TEX6: case VERT_ATTRIB_TEX7: vs.input_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_TEXCOORD; - vs.input_semantic_index[vs.num_inputs] = i - VERT_ATTRIB_TEX0; + vs.input_semantic_index[vs.num_inputs] = attr - VERT_ATTRIB_TEX0; break; case VERT_ATTRIB_GENERIC0: case VERT_ATTRIB_GENERIC1: @@ -110,9 +110,9 @@ st_translate_vertex_shader(struct st_context *st, case VERT_ATTRIB_GENERIC5: case VERT_ATTRIB_GENERIC6: case VERT_ATTRIB_GENERIC7: - assert(i < VERT_ATTRIB_MAX); + assert(attr < VERT_ATTRIB_MAX); vs.input_semantic_name[vs.num_inputs] = TGSI_SEMANTIC_GENERIC; - vs.input_semantic_index[vs.num_inputs] = i - VERT_ATTRIB_GENERIC0; + vs.input_semantic_index[vs.num_inputs] = attr - VERT_ATTRIB_GENERIC0; break; default: assert(0); @@ -125,12 +125,12 @@ st_translate_vertex_shader(struct st_context *st, * Determine number of outputs, the register mapping and * the semantic information for each vertex output/result. */ - for (i = 0; i < VERT_RESULT_MAX; i++) { - if (stvp->Base.Base.OutputsWritten & (1 << i)) { + for (attr = 0; attr < VERT_RESULT_MAX; attr++) { + if (stvp->Base.Base.OutputsWritten & (1 << attr)) { /* put this attrib in the next available slot */ - st->vertex_attrib_to_slot[i] = vs.num_outputs; + st->vertex_attrib_to_slot[attr] = vs.num_outputs; - switch (i) { + switch (attr) { case VERT_RESULT_HPOS: vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_POSITION; vs.output_semantic_index[vs.num_outputs] = 0; @@ -165,14 +165,14 @@ st_translate_vertex_shader(struct st_context *st, case VERT_RESULT_TEX6: case VERT_RESULT_TEX7: vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_TEXCOORD; - vs.output_semantic_index[vs.num_outputs] = i - VERT_RESULT_TEX0; + vs.output_semantic_index[vs.num_outputs] = attr - VERT_RESULT_TEX0; break; case VERT_RESULT_VAR0: /* fall-through */ default: - assert(i - VERT_RESULT_VAR0 < MAX_VARYING); + assert(attr - VERT_RESULT_VAR0 < MAX_VARYING); vs.output_semantic_name[vs.num_outputs] = TGSI_SEMANTIC_GENERIC; - vs.output_semantic_index[vs.num_outputs] = i - VERT_RESULT_VAR0; + vs.output_semantic_index[vs.num_outputs] = attr - VERT_RESULT_VAR0; } vs.num_outputs++; |