summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-11-13 12:55:34 +1100
committerTimothy Arceri <[email protected]>2017-11-15 08:26:34 +1100
commit7273e9820e19130fe7f09b92e808fc4473839ab1 (patch)
treef9cf51b548d97d4ef971f606ec818b2d945bf4d4
parentbc308122ccfc1903276bc8f0ab40b07175929527 (diff)
st/glsl_to_tgsi: use tgsi_get_gl_varying_semantic() for gs/tes outputs
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_program.c96
1 files 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;
}
}