aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-09-18 21:03:24 +0200
committerMarek Olšák <[email protected]>2014-09-24 14:48:02 +0200
commit6cfedf8797f0ee3dd7c8cf9f28ee2c2b2d0eb2dc (patch)
tree4f1449b62d45410cdf2c4d23b30a5ee252cd3146 /src/mesa/state_tracker/st_program.h
parent77038cd35ab94f2574925343149943cbef632b2b (diff)
st/mesa: redefine mapping from VARYING_SLOT_TEXi/PNTC/VARi to TGSI GENERIC[i]
Generic varyings in TGSI were based on the value of VARYING_SLOT_TEX0, so VAR0 was always GENERIC[22] (with tessellation patches). Some drivers might not be able to cope with that. This commit defines a proper mapping, so that PNTC is GENERIC[8] and VAR0 is GENERIC[9]. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.h')
-rw-r--r--src/mesa/state_tracker/st_program.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 9a5b6a847a5..cf1b40a55fc 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -270,6 +270,31 @@ st_reference_fragprog(struct st_context *st,
(struct gl_program *) prog);
}
+/**
+ * This defines mapping from Mesa VARYING_SLOTs to TGSI GENERIC slots.
+ */
+static INLINE unsigned
+st_get_generic_varying_index(struct st_context *st, GLuint attr)
+{
+ if (attr >= VARYING_SLOT_VAR0) {
+ if (st->needs_texcoord_semantic)
+ return attr - VARYING_SLOT_VAR0;
+ else
+ return 9 + (attr - VARYING_SLOT_VAR0);
+ }
+ if (attr == VARYING_SLOT_PNTC) {
+ assert(!st->needs_texcoord_semantic);
+ return 8;
+ }
+ if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) {
+ assert(!st->needs_texcoord_semantic);
+ return attr - VARYING_SLOT_TEX0;
+ }
+
+ assert(0);
+ return 0;
+}
+
extern struct st_vp_variant *
st_get_vp_variant(struct st_context *st,