- switch (lpfs->info.input_semantic_name[i]) {
- case TGSI_SEMANTIC_FACE:
- inputs[i].interp = LP_INTERP_FACING;
- break;
- case TGSI_SEMANTIC_POSITION:
- /* Position was already emitted above
- */
- inputs[i].interp = LP_INTERP_POSITION;
- inputs[i].src_index = 0;
- continue;
- case TGSI_SEMANTIC_COLOR:
- /* Colors are linearly inputs[i].interpolated in the fragment shader
- * even when flatshading is active. This just tells the
- * setup module to use coefficients with ddx==0 and
- * ddy==0.
+ if (fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_FACE) {
+ llvmpipe->face_slot = (int)vinfo->num_attribs;
+ draw_emit_vertex_attr(vinfo, EMIT_4F, vs_index);
+ /*
+ * For vp index and layer, if the fs requires them but the vs doesn't
+ * provide them, draw (vbuf) will give us the required 0 (slot -1).
+ * (This means in this case we'll also use those slots in setup, which
+ * isn't necessary but they'll contain the correct (0) value.)
+ */
+ } else if (fsInfo->input_semantic_name[i] ==
+ TGSI_SEMANTIC_VIEWPORT_INDEX) {
+ llvmpipe->viewport_index_slot = (int)vinfo->num_attribs;
+ draw_emit_vertex_attr(vinfo, EMIT_4F, vs_index);
+ } else if (fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_LAYER) {
+ llvmpipe->layer_slot = (int)vinfo->num_attribs;
+ draw_emit_vertex_attr(vinfo, EMIT_4F, vs_index);
+ } else {
+ /*
+ * Note that we'd actually want to skip position (as we won't use
+ * the attribute in the fs) but can't. The reason is that we don't
+ * actually have an input/output map for setup (even though it looks
+ * like we do...). Could adjust for this though even without a map
+ * (in llvmpipe_create_fs_state()).