[Mesa-dev] [PATCH 4/6] tgsi: handle TG4 opcode in tgsi exec
Dave Airlie
airlied at gmail.com
Tue May 19 15:48:07 PDT 2015
From: Dave Airlie <airlied at redhat.com>
This just adds a new modifier interface for drivers to implement.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
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 d9e4050..6512e80 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 0e59b88..0f4c966 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.1.0
More information about the mesa-dev
mailing list