From a6861ecfc91973ba97989def97dd571e0e096888 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 19 May 2015 16:16:07 +1000 Subject: [PATCH] tgsi: handle TG4 opcode in tgsi exec This just adds a new modifier interface for drivers to implement. Reviewed-by: Brian Paul Signed-off-by: Dave Airlie --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 11 ++++++++++- src/gallium/auxiliary/tgsi/tgsi_exec.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index d9e40506afa..6512e80ba2e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1952,7 +1952,7 @@ fetch_texel( struct tgsi_sampler *sampler, #define TEX_MODIFIER_LOD_BIAS 2 #define TEX_MODIFIER_EXPLICIT_LOD 3 #define TEX_MODIFIER_LEVEL_ZERO 4 - +#define TEX_MODIFIER_GATHER 5 /* * Fetch all 3 (for s,t,r coords) texel offsets, put them into int array. @@ -2069,6 +2069,8 @@ exec_tex(struct tgsi_exec_machine *mach, control = tgsi_sampler_lod_explicit; else if (modifier == TEX_MODIFIER_LOD_BIAS) control = tgsi_sampler_lod_bias; + else if (modifier == TEX_MODIFIER_GATHER) + control = tgsi_sampler_gather; } else { for (i = dim; i < Elements(args); i++) @@ -4374,6 +4376,13 @@ exec_instruction( exec_tex(mach, inst, TEX_MODIFIER_PROJECTED, 1); break; + case TGSI_OPCODE_TG4: + /* src[0] = texcoord */ + /* src[1] = component */ + /* src[2] = sampler unit */ + exec_tex(mach, inst, TEX_MODIFIER_GATHER, 2); + break; + case TGSI_OPCODE_UP2H: assert (0); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 0e59b884897..0f4c966cc11 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -93,7 +93,8 @@ enum tgsi_sampler_control { tgsi_sampler_lod_bias, tgsi_sampler_lod_explicit, tgsi_sampler_lod_zero, - tgsi_sampler_derivs_explicit + tgsi_sampler_derivs_explicit, + tgsi_sampler_gather, }; /** -- 2.30.2