aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_program.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index fbf8930cb..926086bf8 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -275,17 +275,18 @@ st_prepare_vertex_program(struct gl_context *ctx,
case VARYING_SLOT_TEX5:
case VARYING_SLOT_TEX6:
case VARYING_SLOT_TEX7:
- stvp->output_semantic_name[slot] = st->needs_texcoord_semantic ?
- TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
- stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
- break;
-
+ if (st->needs_texcoord_semantic) {
+ stvp->output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
+ stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
+ break;
+ }
+ /* fall through */
case VARYING_SLOT_VAR0:
default:
assert(attr < VARYING_SLOT_MAX);
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stvp->output_semantic_index[slot] = st->needs_texcoord_semantic ?
- (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
+ stvp->output_semantic_index[slot] =
+ st_get_generic_varying_index(st, attr);
break;
}
}
@@ -655,9 +656,8 @@ st_translate_fragment_program(struct st_context *st,
* the user varyings on VAR0. Otherwise, we use TEX0 as base index.
*/
assert(attr >= VARYING_SLOT_TEX0);
- input_semantic_index[slot] = st->needs_texcoord_semantic ?
- (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+ input_semantic_index[slot] = st_get_generic_varying_index(st, attr);
if (attr == VARYING_SLOT_PNTC)
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
else
@@ -974,16 +974,18 @@ st_translate_geometry_program(struct st_context *st,
case VARYING_SLOT_TEX5:
case VARYING_SLOT_TEX6:
case VARYING_SLOT_TEX7:
- stgp->input_semantic_name[slot] = st->needs_texcoord_semantic ?
- TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
- stgp->input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0);
- break;
+ if (st->needs_texcoord_semantic) {
+ stgp->input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
+ stgp->input_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
+ break;
+ }
+ /* fall through */
case VARYING_SLOT_VAR0:
default:
assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX);
stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- stgp->input_semantic_index[slot] = st->needs_texcoord_semantic ?
- (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
+ stgp->input_semantic_index[slot] =
+ st_get_generic_varying_index(st, attr);
break;
}
}
@@ -1069,17 +1071,19 @@ st_translate_geometry_program(struct st_context *st,
case VARYING_SLOT_TEX5:
case VARYING_SLOT_TEX6:
case VARYING_SLOT_TEX7:
- gs_output_semantic_name[slot] = st->needs_texcoord_semantic ?
- TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
- gs_output_semantic_index[slot] = (attr - VARYING_SLOT_TEX0);
- break;
+ if (st->needs_texcoord_semantic) {
+ gs_output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
+ gs_output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
+ break;
+ }
+ /* fall through */
case VARYING_SLOT_VAR0:
default:
assert(slot < Elements(gs_output_semantic_name));
assert(attr >= VARYING_SLOT_VAR0);
gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- gs_output_semantic_index[slot] = st->needs_texcoord_semantic ?
- (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
+ gs_output_semantic_index[slot] =
+ st_get_generic_varying_index(st, attr);
break;
}
}