Mesa (gallium-0.1): tgsi: Implement RCC opcode.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Thu Aug 27 08:30:20 UTC 2009
Module: Mesa
Branch: gallium-0.1
Commit: 6a35d85fbc34f5b53e3b9d0a88261cf70299f03c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a35d85fbc34f5b53e3b9d0a88261cf70299f03c
Author: Michal Krol <michal at vmware.com>
Date: Wed Mar 11 12:10:16 2009 +0100
tgsi: Implement RCC opcode.
---
src/gallium/auxiliary/tgsi/tgsi_exec.c | 33 +++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 8f2986e..9178f48 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -478,6 +478,32 @@ micro_f2ut(
}
static void
+micro_float_clamp(union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src)
+{
+ uint i;
+
+ for (i = 0; i < 4; i++) {
+ if (src->f[i] > 0.0f) {
+ if (src->f[i] > 1.884467e+019f)
+ dst->f[i] = 1.884467e+019f;
+ else if (src->f[i] < 5.42101e-020f)
+ dst->f[i] = 5.42101e-020f;
+ else
+ dst->f[i] = src->f[i];
+ }
+ else {
+ if (src->f[i] < -1.884467e+019f)
+ dst->f[i] = -1.884467e+019f;
+ else if (src->f[i] > -5.42101e-020f)
+ dst->f[i] = -5.42101e-020f;
+ else
+ dst->f[i] = src->f[i];
+ }
+ }
+}
+
+static void
micro_flr(
union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src )
@@ -2203,7 +2229,12 @@ exec_instruction(
break;
case TGSI_OPCODE_RCC:
- assert (0);
+ FETCH(&r[0], 0, CHAN_X);
+ micro_div(&r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &r[0]);
+ micro_float_clamp(&r[0], &r[0]);
+ FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) {
+ STORE(&r[0], 0, chan_index);
+ }
break;
case TGSI_OPCODE_DPH:
More information about the mesa-commit
mailing list