summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2016-04-12 18:24:06 -0700
committerMatt Turner <[email protected]>2016-04-18 15:48:54 -0700
commitb1d9353cb5d46ad3ea1802fb32ead06772dd126e (patch)
treee2c4d46754877a970553b4005959f486ca895ad9 /src
parent3a26ef23e78f811abdfe657b52b9bc057b9ce5b6 (diff)
glsl: Properly handle ldexp(0.0f, non-zero-exp).
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/lower_instructions.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/glsl/lower_instructions.cpp b/src/compiler/glsl/lower_instructions.cpp
index 1875149b7a6..16d92d64cd9 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -347,7 +347,7 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
* extracted_biased_exp = rshift(bitcast_f2i(abs(x)), exp_shift);
* resulting_biased_exp = extracted_biased_exp + exp;
*
- * if (resulting_biased_exp < 1) {
+ * if (resulting_biased_exp < 1 || x == 0.0f) {
* return copysign(0.0, x);
* }
*
@@ -361,7 +361,8 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
* extracted_biased_exp = rshift(bitcast_f2i(abs(x)), exp_shift);
* resulting_biased_exp = extracted_biased_exp + exp;
*
- * is_not_zero_or_underflow = gequal(resulting_biased_exp, 1);
+ * is_not_zero_or_underflow = logic_and(nequal(x, 0.0f),
+ * gequal(resulting_biased_exp, 1);
* x = csel(is_not_zero_or_underflow, x, copysign(0.0f, x));
* resulting_biased_exp = csel(is_not_zero_or_underflow,
* resulting_biased_exp, 0);
@@ -427,8 +428,9 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
i.insert_before(is_not_zero_or_underflow);
i.insert_before(assign(is_not_zero_or_underflow,
- gequal(resulting_biased_exp,
- new(ir) ir_constant(0x1, vec_elem))));
+ logic_and(nequal(x, new(ir) ir_constant(0.0f, vec_elem)),
+ gequal(resulting_biased_exp,
+ new(ir) ir_constant(0x1, vec_elem)))));
i.insert_before(assign(x, csel(is_not_zero_or_underflow,
x, zero_sign_x)));
i.insert_before(assign(resulting_biased_exp,