From 7273e9820e19130fe7f09b92e808fc4473839ab1 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 13 Nov 2017 12:55:34 +1100 Subject: [PATCH] st/glsl_to_tgsi: use tgsi_get_gl_varying_semantic() for gs/tes outputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/mesa/state_tracker/st_program.c | 96 ++--------------------------- 1 file changed, 5 insertions(+), 91 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 7c8f65a3d63..97b2e1234b1 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1362,97 +1362,11 @@ st_translate_program_common(struct st_context *st, outputMapping[attr] = slot; - switch (attr) { - case VARYING_SLOT_POS: - assert(slot == 0); - output_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_COL0: - output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_COL1: - output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - output_semantic_index[slot] = 1; - break; - case VARYING_SLOT_BFC0: - output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_BFC1: - output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; - output_semantic_index[slot] = 1; - break; - case VARYING_SLOT_FOGC: - output_semantic_name[slot] = TGSI_SEMANTIC_FOG; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_PSIZ: - output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_CLIP_VERTEX: - output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_CLIP_DIST0: - output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_CLIP_DIST1: - output_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; - output_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_LAYER: - output_semantic_name[slot] = TGSI_SEMANTIC_LAYER; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_PRIMITIVE_ID: - output_semantic_name[slot] = TGSI_SEMANTIC_PRIMID; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_VIEWPORT: - output_semantic_name[slot] = TGSI_SEMANTIC_VIEWPORT_INDEX; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_TESS_LEVEL_OUTER: - output_semantic_name[slot] = TGSI_SEMANTIC_TESSOUTER; - output_semantic_index[slot] = 0; - break; - case VARYING_SLOT_TESS_LEVEL_INNER: - output_semantic_name[slot] = TGSI_SEMANTIC_TESSINNER; - output_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) { - output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD; - output_semantic_index[slot] = attr - VARYING_SLOT_TEX0; - break; - } - /* fall through */ - case VARYING_SLOT_VAR0: - default: - assert(slot < ARRAY_SIZE(output_semantic_name)); - assert(attr >= VARYING_SLOT_VAR0 || - (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7)); - output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - output_semantic_index[slot] = - st_get_generic_varying_index(st, attr); - break; - } + unsigned semantic_name, semantic_index; + tgsi_get_gl_varying_semantic(attr, st->needs_texcoord_semantic, + &semantic_name, &semantic_index); + output_semantic_name[slot] = semantic_name; + output_semantic_index[slot] = semantic_index; } } -- 2.30.2