From 4ae9f0b58059b39907b1725a822b54a9f8555967 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 13 Nov 2017 11:58:59 +1100 Subject: st/glsl_to_tgsi: make use of tgsi_get_gl_varying_semantic() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_program.c | 82 +++++-------------------------------- 1 file changed, 11 insertions(+), 71 deletions(-) (limited to 'src') 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. */ -- cgit v1.2.3