summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/ir/atan
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-08-31 19:13:09 -0600
committerBrian Paul <[email protected]>2010-08-31 19:15:07 -0600
commit16c733495d74d8c2443aa915a55df97c02b415c7 (patch)
tree4917991d2a6398cffe82d232c13c085f0bec9650 /src/glsl/builtins/ir/atan
parent9b075cb9fa9eb6a95d0816283ef01ae72dafa680 (diff)
glsl2: fix bug in atan(y, x) function
When x==0, the result was wrong. Fixes piglit glsl-fs-atan-1.shader_test
Diffstat (limited to 'src/glsl/builtins/ir/atan')
-rw-r--r--src/glsl/builtins/ir/atan10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan
index 84048293870..04e1898f9f3 100644
--- a/src/glsl/builtins/ir/atan
+++ b/src/glsl/builtins/ir/atan
@@ -80,13 +80,9 @@
)
(
- (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (
- (assign (constant bool (1)) (var_ref r) (constant float (1.570796)) )
- )
- (
- (assign (constant bool (1)) (var_ref r) (constant float (-1.570796)) )
- ))
-
+ (declare () float sgn)
+ (assign (constant bool (1)) (var_ref sgn) (expression float sign (var_ref y)))
+ (assign (constant bool (1)) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
))
(return (var_ref r) )