- /* Now match FS inputs against emitted vertex data. It's also
- * entirely possible to just have a fixed layout for FS input,
- * determined by the fragment shader itself, and adjust the draw
- * outputs to match that.
+ if (fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR &&
+ fsInfo->input_semantic_index[i] < 2) {
+ int idx = fsInfo->input_semantic_index[i];
+ llvmpipe->color_slot[idx] = (int)vinfo->num_attribs;
+ }
+
+ 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()).
+ */
+ draw_emit_vertex_attr(vinfo, EMIT_4F, vs_index);
+ }
+ }
+
+ /* Figure out if we need bcolor as well.