summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-03-11 12:10:16 +0100
committerMichal Krol <michal@vmware.com>2009-03-11 12:11:50 +0100
commitae7ae570ef9f61073a2c0e4b77fc23094767f74c (patch)
tree61c2fd7874953ea252ee5ed40d52b0727e75717d
parent94cf8ea3b69038a1245c0b4546dbd8e4a32725f5 (diff)
tgsi: Implement RCC opcode.
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c33
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 1ec1088389..d9dc217e52 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -486,6 +486,32 @@ micro_f2ut(
#endif
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 )
@@ -2279,7 +2305,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: