* Convert Mesa program inputs to TGSI input register semantics.
*/
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
- if ((prog->info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
- const GLuint slot = num_inputs++;
+ if ((prog->info.inputs_read & BITFIELD64_BIT(attr)) == 0)
+ continue;
- inputMapping[attr] = slot;
- inputSlotToAttr[slot] = attr;
+ unsigned slot = num_inputs++;
- switch (attr) {
- case VARYING_SLOT_PRIMITIVE_ID:
- assert(tgsi_processor == PIPE_SHADER_GEOMETRY);
- input_semantic_name[slot] = TGSI_SEMANTIC_PRIMID;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_POS:
- input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_COL0:
- input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_COL1:
- input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- input_semantic_index[slot] = 1;
- break;
- case VARYING_SLOT_FOGC:
- input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_CLIP_VERTEX:
- input_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_CLIP_DIST0:
- input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_CLIP_DIST1:
- input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- input_semantic_index[slot] = 1;
- break;
- case VARYING_SLOT_CULL_DIST0:
- case VARYING_SLOT_CULL_DIST1:
- /* these should have been lowered by GLSL */
- assert(0);
- break;
- case VARYING_SLOT_PSIZ:
- input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE;
- input_semantic_index[slot] = 0;
- break;
- case VARYING_SLOT_TEX0:
- case VARYING_SLOT_TEX1:
- case VARYING_SLOT_TEX2:
- case VARYING_SLOT_TEX3:
- case VARYING_SLOT_TEX4:
- case VARYING_SLOT_TEX5:
- case VARYING_SLOT_TEX6:
- case VARYING_SLOT_TEX7:
- if (st->needs_texcoord_semantic) {
- input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
- input_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
- break;
- }
- /* fall through */
- case VARYING_SLOT_VAR0:
- default:
- assert(attr >= VARYING_SLOT_VAR0 ||
- (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7));
- input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- input_semantic_index[slot] =
- st_get_generic_varying_index(st, attr);
- break;
- }
- }
+ inputMapping[attr] = slot;
+ inputSlotToAttr[slot] = attr;
+
+ unsigned semantic_name, semantic_index;
+ tgsi_get_gl_varying_semantic(attr, st->needs_texcoord_semantic,
+ &semantic_name, &semantic_index);
+ input_semantic_name[slot] = semantic_name;
+ input_semantic_index[slot] = semantic_index;
}
/* Also add patch inputs. */