Mesa (master): gallium: Add UMOD TGSI opcode.

Michał Król michal at kemper.freedesktop.org
Tue Jan 5 08:29:33 UTC 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Sat Jan  2 11:00:40 2010 +0100

gallium: Add UMOD TGSI opcode.

Either that or have UDIV have two destination operands.

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c       |   14 ++++++++++++++
 src/gallium/auxiliary/tgsi/tgsi_info.c       |    1 +
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |    1 +
 src/gallium/include/pipe/p_shader_tokens.h   |   23 ++++++++++++-----------
 4 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 0a27648..4d56cac 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2090,6 +2090,16 @@ micro_umin(union tgsi_exec_channel *dst,
 }
 
 static void
+micro_umod(union tgsi_exec_channel *dst,
+           const union tgsi_exec_channel *src)
+{
+   dst->u[0] = src[0].u[0] % src[1].u[0];
+   dst->u[1] = src[0].u[1] % src[1].u[1];
+   dst->u[2] = src[0].u[2] % src[1].u[2];
+   dst->u[3] = src[0].u[3] % src[1].u[3];
+}
+
+static void
 micro_umul(union tgsi_exec_channel *dst,
            const union tgsi_exec_channel *src)
 {
@@ -3491,6 +3501,10 @@ exec_instruction(
       exec_vector_binary(mach, inst, micro_umin);
       break;
 
+   case TGSI_OPCODE_UMOD:
+      exec_vector_binary(mach, inst, micro_umod);
+      break;
+
    case TGSI_OPCODE_UMUL:
       exec_vector_binary(mach, inst, micro_umul);
       break;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 8e06356..de0e09c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -165,6 +165,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 3, 0, 0, 0, 0, "UMAD", TGSI_OPCODE_UMAD },
    { 1, 2, 0, 0, 0, 0, "UMAX", TGSI_OPCODE_UMAX },
    { 1, 2, 0, 0, 0, 0, "UMIN", TGSI_OPCODE_UMIN },
+   { 1, 2, 0, 0, 0, 0, "UMOD", TGSI_OPCODE_UMOD },
    { 1, 2, 0, 0, 0, 0, "UMUL", TGSI_OPCODE_UMUL },
    { 1, 2, 0, 0, 0, 0, "USEQ", TGSI_OPCODE_USEQ },
    { 1, 2, 0, 0, 0, 0, "USGE", TGSI_OPCODE_USGE },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index a35186c..e4af15c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -160,6 +160,7 @@ OP12(UDIV)
 OP13(UMAD)
 OP12(UMAX)
 OP12(UMIN)
+OP12(UMOD)
 OP12(UMUL)
 OP12(USEQ)
 OP12(USGE)
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index f8d4a45..550e2ab 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -308,17 +308,18 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_UMAD                131
 #define TGSI_OPCODE_UMAX                132
 #define TGSI_OPCODE_UMIN                133
-#define TGSI_OPCODE_UMUL                134
-#define TGSI_OPCODE_USEQ                135
-#define TGSI_OPCODE_USGE                136
-#define TGSI_OPCODE_USHR                137
-#define TGSI_OPCODE_USLT                138
-#define TGSI_OPCODE_USNE                139
-#define TGSI_OPCODE_SWITCH              140
-#define TGSI_OPCODE_CASE                141
-#define TGSI_OPCODE_DEFAULT             142
-#define TGSI_OPCODE_ENDSWITCH           143
-#define TGSI_OPCODE_LAST                144
+#define TGSI_OPCODE_UMOD                134
+#define TGSI_OPCODE_UMUL                135
+#define TGSI_OPCODE_USEQ                136
+#define TGSI_OPCODE_USGE                137
+#define TGSI_OPCODE_USHR                138
+#define TGSI_OPCODE_USLT                139
+#define TGSI_OPCODE_USNE                140
+#define TGSI_OPCODE_SWITCH              141
+#define TGSI_OPCODE_CASE                142
+#define TGSI_OPCODE_DEFAULT             143
+#define TGSI_OPCODE_ENDSWITCH           144
+#define TGSI_OPCODE_LAST                145
 
 #define TGSI_SAT_NONE            0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */




More information about the mesa-commit mailing list