Mesa (master): tgsi: handle TG4 opcode in tgsi exec

Dave Airlie airlied at kemper.freedesktop.org
Wed May 20 02:37:09 UTC 2015


Module: Mesa
Branch: master
Commit: a6861ecfc91973ba97989def97dd571e0e096888
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6861ecfc91973ba97989def97dd571e0e096888

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue May 19 16:16:07 2015 +1000

tgsi: handle TG4 opcode in tgsi exec

This just adds a new modifier interface for drivers to implement.

Reviewed-by: Brian Paul <brianp at vmware.com>
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,
 };
 
 /**




More information about the mesa-commit mailing list