Mesa (gallium-double-opcodes): tgsi: implement DFRACEXP
MichaŠKról
michal at kemper.freedesktop.org
Wed Jan 20 12:24:08 UTC 2010
Module: Mesa
Branch: gallium-double-opcodes
Commit: e2e4e4309494d7727485652d90fc91ad27a1655a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2e4e4309494d7727485652d90fc91ad27a1655a
Author: Igor Oliveira <igor.oliveira at openbossa.org>
Date: Tue Jan 19 19:21:47 2010 -0400
tgsi: implement DFRACEXP
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 40 ++++++++++++++++++++++++++++++++
src/gallium/auxiliary/tgsi/tgsi_info.c | 3 +-
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 efb9ea1..09c4d3a 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 8340b07..cc8d6e5 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 *
More information about the mesa-commit
mailing list