aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-25 14:28:24 -0600
committerBrian <[email protected]>2007-07-25 14:28:24 -0600
commit8b2955b736086103ac0d184a4b3f89d8ab8baab1 (patch)
tree321fff9fa0a68e61b6bf3cb42f3e04837134a353 /src
parentbe8725321ccbc4ca5f52afc9a3e257c91f43a119 (diff)
implement DDX, DDY instructions
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_exec.c34
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c6
2 files changed, 38 insertions, 2 deletions
diff --git a/src/mesa/pipe/tgsi/core/tgsi_exec.c b/src/mesa/pipe/tgsi/core/tgsi_exec.c
index db965ccbecd..6aaaef98a83 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/core/tgsi_exec.c
@@ -229,6 +229,28 @@ micro_cos(
}
static void
+micro_ddx(
+ union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src )
+{
+ dst->f[0] =
+ dst->f[1] =
+ dst->f[2] =
+ dst->f[3] = src->f[TILE_BOTTOM_RIGHT] - src->f[TILE_BOTTOM_LEFT];
+}
+
+static void
+micro_ddy(
+ union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src )
+{
+ dst->f[0] =
+ dst->f[1] =
+ dst->f[2] =
+ dst->f[3] = src->f[TILE_TOP_LEFT] - src->f[TILE_BOTTOM_LEFT];
+}
+
+static void
micro_div(
union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
@@ -1715,11 +1737,19 @@ exec_instruction(
break;
case TGSI_OPCODE_DDX:
- assert (0);
+ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
+ FETCH( &r[0], 0, chan_index );
+ micro_ddx( &r[0], &r[0] );
+ STORE( &r[0], 0, chan_index );
+ }
break;
case TGSI_OPCODE_DDY:
- assert (0);
+ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
+ FETCH( &r[0], 0, chan_index );
+ micro_ddy( &r[0], &r[0] );
+ STORE( &r[0], 0, chan_index );
+ }
break;
case TGSI_OPCODE_KIL:
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 21b488c98f1..a9415ac15bc 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -261,6 +261,12 @@ compile_instruction(
case OPCODE_DP3:
fullinst->Instruction.Opcode = TGSI_OPCODE_DP3;
break;
+ case OPCODE_DDX:
+ fullinst->Instruction.Opcode = TGSI_OPCODE_DDX;
+ break;
+ case OPCODE_DDY:
+ fullinst->Instruction.Opcode = TGSI_OPCODE_DDY;
+ break;
case OPCODE_DP4:
fullinst->Instruction.Opcode = TGSI_OPCODE_DP4;
break;