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
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;
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;
}
/*
* 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);
{
struct pipe_shader_state vs;
const struct cso_vertex_shader *cso;
- GLuint i;
+ GLuint attr;
memset(&vs, 0, sizeof(vs));
* 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;
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:
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);
* 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;
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++;