summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-08-17 16:12:15 -0700
committerEric Anholt <[email protected]>2010-08-17 16:39:18 -0700
commit02e16398292825924d4c7ffb884961275dbadacd (patch)
treea182361f79c19fba790e1238e92e85f41f908a86 /src/mesa
parente43b250fc076aea9e4b5319fdf409e95b28ac8fc (diff)
i915: Add support for SSG opcode.
Fixes glsl-fs-sign and many of the tests of trig builtins.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 3101bd17001..4a2e6209d07 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -983,6 +983,41 @@ upload_program(struct i915_fragment_program *p)
0);
break;
+ case OPCODE_SSG:
+ dst = get_result_vector(p, inst);
+ flags = get_result_flags(inst);
+ src0 = src_vector(p, &inst->SrcReg[0], program);
+ tmp = i915_get_utemp(p);
+
+ /* tmp = (src < 0.0) */
+ i915_emit_arith(p,
+ A0_SLT,
+ tmp,
+ flags, 0,
+ src0,
+ swizzle(src0, ZERO, ZERO, ZERO, ZERO),
+ 0);
+
+ /* dst = (0.0 < src) */
+ i915_emit_arith(p,
+ A0_SLT,
+ dst,
+ flags, 0,
+ swizzle(src0, ZERO, ZERO, ZERO, ZERO),
+ src0,
+ 0);
+
+ /* dst = (src > 0.0) - (src < 0.0) */
+ i915_emit_arith(p,
+ A0_ADD,
+ dst,
+ flags, 0,
+ dst,
+ negate(tmp, 1, 1, 1, 1),
+ 0);
+
+ break;
+
case OPCODE_SUB:
src0 = src_vector(p, &inst->SrcReg[0], program);
src1 = src_vector(p, &inst->SrcReg[1], program);