summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-11-13 11:58:59 +1100
committerTimothy Arceri <[email protected]>2017-11-15 08:26:34 +1100
commit4ae9f0b58059b39907b1725a822b54a9f8555967 (patch)
treeea67d1466041bd27907ba8cc28ce38613ab3c8fe /src/mesa
parent3d21eb3b7d81f1f97673298b7fb7913a5d5e8220 (diff)
st/glsl_to_tgsi: make use of tgsi_get_gl_varying_semantic()
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_program.c82
1 files changed, 11 insertions, 71 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 70b63a37471..7c8f65a3d63 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1318,79 +1318,19 @@ st_translate_program_common(struct st_context *st,
* 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. */