From 6cfedf8797f0ee3dd7c8cf9f28ee2c2b2d0eb2dc Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 18 Sep 2014 21:03:24 +0200 Subject: 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 --- src/mesa/state_tracker/st_program.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/mesa/state_tracker/st_program.h') 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, -- cgit v1.2.3