Hi,

the patches add support to double opcodes in gallium/tgsi.
It just implement some opcodes i like to know if someone has
suggestion about the patches.

Igor
From e856e2aa3b801fc6f386a88df646a396c27d8ee8 Mon Sep 17 00:00:00 2001
From: Igor Oliveira <igor.olive...@openbossa.org>
Date: Wed, 6 Jan 2010 15:50:00 -0400
Subject: [PATCH 1/2] gallium: Add double opcodes

---
 src/gallium/include/pipe/p_shader_tokens.h |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 550e2ab..efbbafe 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -319,7 +319,15 @@ struct tgsi_property_data {
 #define TGSI_OPCODE_CASE                142
 #define TGSI_OPCODE_DEFAULT             143
 #define TGSI_OPCODE_ENDSWITCH           144
-#define TGSI_OPCODE_LAST                145
+
+#define TGSI_OPCODE_MOVD                145
+#define TGSI_OPCODE_DDIV                146
+#define TGSI_OPCODE_DMAX                147
+#define TGSI_OPCODE_DMIN                148
+#define TGSI_OPCODE_DNEG                149
+#define TGSI_OPCODE_DSGE                150
+#define TGSI_OPCODE_DSLT                151
+#define TGSI_OPCODE_LAST                152
 
 #define TGSI_SAT_NONE            0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */
-- 
1.6.3.3

From 8be48c41cfc988279832d60f02c2cf496590e162 Mon Sep 17 00:00:00 2001
From: Igor Oliveira <igor.olive...@openbossa.org>
Date: Wed, 6 Jan 2010 15:51:09 -0400
Subject: [PATCH 2/2] tgsi: implement double opcodes

---
 src/gallium/auxiliary/tgsi/tgsi_exec.c       |  113 +++++++++++++++++++++++++-
 src/gallium/auxiliary/tgsi/tgsi_exec.h       |    1 +
 src/gallium/auxiliary/tgsi/tgsi_info.c       |    7 ++
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |    7 ++
 4 files changed, 126 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index f43233b..ddcc829 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -380,6 +380,85 @@ micro_trunc(union tgsi_exec_channel *dst,
    dst->f[3] = (float)(int)src->f[3];
 }
 
+static void
+micro_movd(union tgsi_exec_channel *dst,
+           const union tgsi_exec_channel *src)
+{
+   dst->d[0] = src->d[0];
+   dst->d[1] = src->d[1];
+   dst->d[2] = src->d[2];
+   dst->d[3] = src->d[3];
+}
+
+static void
+micro_ddiv(union tgsi_exec_channel *dst,
+           const union tgsi_exec_channel *src0,
+           const union tgsi_exec_channel *src1)
+{
+   if (src1->d[0] != 0)
+      dst->d[0] = src0->d[0]/src1->d[0];
+   if (src1->d[1] != 0)
+      dst->d[1] = src0->d[1]/src1->d[1];
+   if (src1->d[2] != 0)
+      dst->d[2] = src0->d[2]/src1->d[2];
+   if (src1->d[3] != 0)
+      dst->d[3] = src0->d[3]/src1->d[3];
+}
+
+static void
+micro_dmax(
+   union tgsi_exec_channel *dst,
+   const union tgsi_exec_channel *src0,
+   const union tgsi_exec_channel *src1)
+{
+   dst->d[0] = src0->d[0] > src1->d[0] ? src0->d[0] : src1->d[0];
+   dst->d[1] = src0->d[1] > src1->d[1] ? src0->d[1] : src1->d[1];
+   dst->d[2] = src0->d[2] > src1->d[2] ? src0->d[2] : src1->d[2];
+   dst->d[3] = src0->d[3] > src1->d[3] ? src0->d[3] : src1->d[3];
+}
+
+static void
+micro_dmin(
+   union tgsi_exec_channel *dst,
+   const union tgsi_exec_channel *src0,
+   const union tgsi_exec_channel *src1)
+{
+   dst->d[0] = src0->d[0] > src1->d[0] ? src0->d[0] : src1->d[0];
+   dst->d[1] = src0->d[1] > src1->d[1] ? src0->d[1] : src1->d[1];
+   dst->d[2] = src0->d[2] > src1->d[2] ? src0->d[2] : src1->d[2];
+   dst->d[3] = src0->d[3] > src1->d[3] ? src0->d[3] : src1->d[3];
+}
+
+static void
+micro_dneg(
+   union tgsi_exec_channel *dst,
+   const union tgsi_exec_channel *src )
+{
+   dst->d[0] = -src->d[0];
+   dst->d[1] = -src->d[1];
+   dst->d[2] = -src->d[2];
+   dst->d[3] = -src->d[3];
+}
+
+static void
+micro_dsge(union tgsi_exec_channel *dst,
+          const union tgsi_exec_channel *src)
+{
+   dst->d[0] = src[0].d[0] >= src[1].d[0] ? 1.0f : 0.0f;
+   dst->d[1] = src[0].d[1] >= src[1].d[1] ? 1.0f : 0.0f;
+   dst->d[2] = src[0].d[2] >= src[1].d[2] ? 1.0f : 0.0f;
+   dst->d[3] = src[0].d[3] >= src[1].d[3] ? 1.0f : 0.0f;
+}
+
+static void
+micro_dslt(union tgsi_exec_channel *dst,
+          const union tgsi_exec_channel *src)
+{
+   dst->d[0] = src[0].d[0] < src[1].d[0] ? 1.0f : 0.0f;
+   dst->d[1] = src[0].d[1] < src[1].d[1] ? 1.0f : 0.0f;
+   dst->d[2] = src[0].d[2] < src[1].d[2] ? 1.0f : 0.0f;
+   dst->d[3] = src[0].d[3] < src[1].d[3] ? 1.0f : 0.0f;
+}
 
 #define CHAN_X  0
 #define CHAN_Y  1
@@ -389,7 +468,8 @@ micro_trunc(union tgsi_exec_channel *dst,
 enum tgsi_exec_datatype {
    TGSI_EXEC_DATA_FLOAT,
    TGSI_EXEC_DATA_INT,
-   TGSI_EXEC_DATA_UINT
+   TGSI_EXEC_DATA_UINT,
+   TGSI_EXEC_DATA_DOUBLE
 };
 
 /*
@@ -3491,6 +3571,34 @@ exec_instruction(
       exec_vector_binary(mach, inst, micro_usne, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_UINT);
       break;
 
+   case TGSI_OPCODE_MOVD:
+      exec_vector_unary(mach, inst, micro_movd, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DDIV:
+      exec_vector_binary(mach, inst, micro_ddiv, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DMAX:
+      exec_vector_binary(mach, inst, micro_dmax, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DMIN:
+      exec_vector_binary(mach, inst, micro_dmin, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DNEG:
+      exec_vector_unary(mach, inst, micro_dneg, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DSGE:
+      exec_vector_binary(mach, inst, micro_dsge, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
+   case TGSI_OPCODE_DSLT:
+      exec_vector_binary(mach, inst, micro_dslt, TGSI_EXEC_DATA_DOUBLE, TGSI_EXEC_DATA_DOUBLE);
+      break;
+
    case TGSI_OPCODE_SWITCH:
       exec_switch(mach, inst);
       break;
@@ -3503,7 +3611,8 @@ exec_instruction(
       exec_default(mach);
       break;
 
-   case TGSI_OPCODE_ENDSWITCH:
+
+       case TGSI_OPCODE_ENDSWITCH:
       exec_endswitch(mach);
       break;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index aa3a98d..39e0b8c 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -48,6 +48,7 @@ union tgsi_exec_channel
    float    f[QUAD_SIZE];
    int      i[QUAD_SIZE];
    unsigned u[QUAD_SIZE];
+   double   d[QUAD_SIZE];
 };
 
 /**
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index de0e09c..923aa61 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -171,6 +171,13 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 2, 0, 0, 0, 0, "USGE", TGSI_OPCODE_USGE },
    { 1, 2, 0, 0, 0, 0, "USHR", TGSI_OPCODE_USHR },
    { 1, 2, 0, 0, 0, 0, "USLT", TGSI_OPCODE_USLT },
+   { 1, 1, 0, 0, 0, 0, "MOVD", TGSI_OPCODE_MOVD },
+   { 1, 2, 0, 0, 0, 0, "DDIV", TGSI_OPCODE_DDIV },
+   { 1, 2, 0, 0, 0, 0, "DMAX", TGSI_OPCODE_DMAX },
+   { 1, 2, 0, 0, 0, 0, "DMIN", TGSI_OPCODE_DMIN },
+   { 1, 1, 0, 0, 0, 0, "DNEG", TGSI_OPCODE_DNEG },
+   { 1, 2, 0, 0, 0, 0, "DSGE", TGSI_OPCODE_DSGE },
+   { 1, 2, 0, 0, 0, 0, "DSLT", TGSI_OPCODE_DSLT },
    { 1, 2, 0, 0, 0, 0, "USNE", TGSI_OPCODE_USNE },
    { 0, 1, 0, 0, 0, 0, "SWITCH", TGSI_OPCODE_SWITCH },
    { 0, 1, 0, 0, 0, 0, "CASE", TGSI_OPCODE_CASE },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index e4af15c..047af98 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -167,6 +167,13 @@ OP12(USGE)
 OP12(USHR)
 OP12(USLT)
 OP12(USNE)
+OP11(MOVD)
+OP12(DDIV)
+OP12(DMAX)
+OP12(DMIN)
+OP11(DNEG)
+OP12(DSGE)
+OP12(DSLT)
 
 
 #undef OP00
-- 
1.6.3.3

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to