summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Oliveira <igor.oliveira@openbossa.org>2010-01-19 19:21:47 -0400
committerMichal Krol <michal@vmware.com>2010-01-20 13:05:32 +0100
commite2e4e4309494d7727485652d90fc91ad27a1655a (patch)
treec6b9c864b8b84a8053b439b55d9ada383ddc8234
parent15681c5f83181574b8853e2c96a695d3b4a1843d (diff)
tgsi: implement DFRACEXP
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c40
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_info.c3
2 files changed, 42 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index efb9ea19cdf..09c4d3aea53 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -310,6 +310,17 @@ micro_dldexp(union tgsi_double_channel *dst,
}
static void
+micro_dfracexp(union tgsi_double_channel *dst,
+ union tgsi_exec_channel *dst_exp,
+ const union tgsi_double_channel *src)
+{
+ dst->d[0] = frexp(src->d[0], &dst_exp->i[0]);
+ dst->d[1] = frexp(src->d[1], &dst_exp->i[1]);
+ dst->d[2] = frexp(src->d[2], &dst_exp->i[2]);
+ dst->d[3] = frexp(src->d[3], &dst_exp->i[3]);
+}
+
+static void
micro_exp2(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
@@ -2453,6 +2464,31 @@ exec_d2f(struct tgsi_exec_machine *mach,
}
static void
+exec_dfracexp(struct tgsi_exec_machine *mach,
+ const struct tgsi_full_instruction *inst)
+{
+ union tgsi_double_channel src;
+ union tgsi_double_channel dst;
+ union tgsi_exec_channel dst_exp;
+
+ if (((inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_XY) == TGSI_WRITEMASK_XY) &&
+ ((inst->Dst[1].Register.WriteMask & TGSI_WRITEMASK_X) == TGSI_WRITEMASK_X)) {
+ fetch_double_channel(mach, &src, &inst->Src[0], CHAN_X, CHAN_Y);
+ micro_dfracexp(&dst, &dst_exp, &src);
+ store_double_channel(mach, &dst, &inst->Dst[0], inst, CHAN_X, CHAN_Y);
+ store_dest(mach, &dst_exp, &inst->Dst[1], inst, CHAN_X, TGSI_EXEC_DATA_INT);
+ }
+ if (((inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_ZW) == TGSI_WRITEMASK_ZW) &&
+ ((inst->Dst[1].Register.WriteMask & TGSI_WRITEMASK_Y) == TGSI_WRITEMASK_Y)) {
+ fetch_double_channel(mach, &src, &inst->Src[0], CHAN_Z, CHAN_W);
+ micro_dfracexp(&dst, &dst_exp, &src);
+ store_double_channel(mach, &dst, &inst->Dst[0], inst, CHAN_Z, CHAN_W);
+ store_dest(mach, &dst_exp, &inst->Dst[1], inst, CHAN_Y, TGSI_EXEC_DATA_INT);
+ }
+}
+
+
+static void
micro_i2f(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src)
{
@@ -3935,6 +3971,10 @@ exec_instruction(
exec_double_binary(mach, inst, micro_dldexp);
break;
+ case TGSI_OPCODE_DFRACEXP:
+ exec_dfracexp(mach, inst);
+ break;
+
default:
printf("%d", inst->Instruction.Opcode);
assert( 0 );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 8340b072d8e..cc8d6e5ac05 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -192,7 +192,8 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0 ,0, 0, "DSQRT", TGSI_OPCODE_DSQRT },
{ 1, 3, 0, 0 ,0, 0, "DMAD", TGSI_OPCODE_DMAD },
{ 1, 1, 0, 0, 0, 0, "DFRAC", TGSI_OPCODE_DFRAC},
- { 1, 2, 0, 0, 0, 0, "DLDEXP", TGSI_OPCODE_DLDEXP}
+ { 1, 2, 0, 0, 0, 0, "DLDEXP", TGSI_OPCODE_DLDEXP},
+ { 2, 1, 0, 0, 0, 0, "DFRACEXP", TGSI_OPCODE_DFRACEXP}
};
const struct tgsi_opcode_info *