summaryrefslogtreecommitdiff
path: root/src/glsl/builtins/ir/atan
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-08-11 16:53:52 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-08-13 19:09:36 -0700
commit43ff8f1a4b90554eae489cebb7e05f983dd9ad66 (patch)
treed9a63bb1ce1257b45aea4bbcae450959b75cc64c /src/glsl/builtins/ir/atan
parentd802ba110f78c3eee9541867cde819ada1b2c449 (diff)
glsl2: Rework builtin function generation.
Each language version/extension and target now has a "profile" containing all of the available builtin function prototypes. These are written in GLSL, and come directly out of the GLSL spec (except for expanding genType). A new builtins/ir/ folder contains the hand-written IR for each builtin, regardless of what version includes it. Only those definitions that have prototypes in the profile will be included. The autogenerated IR for texture builtins is no longer written to disk, so there's no longer any confusion as to what's hand-written or generated. All scripts are now in python instead of perl.
Diffstat (limited to 'src/glsl/builtins/ir/atan')
-rw-r--r--src/glsl/builtins/ir/atan154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan
new file mode 100644
index 0000000000..8404829387
--- /dev/null
+++ b/src/glsl/builtins/ir/atan
@@ -0,0 +1,154 @@
+((function atan
+ (signature float
+ (parameters
+ (declare (in) float x))
+ ((return (call asin ((expression float *
+ (var_ref x)
+ (expression float rsq
+ (expression float +
+ (expression float *
+ (var_ref x)
+ (var_ref x))
+ (constant float (1.0))))))))))
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 y_over_x))
+ ((return (call asin ((expression vec2 *
+ (var_ref y_over_x)
+ (expression vec2 rsq
+ (expression vec2 +
+ (expression vec2 *
+ (var_ref y_over_x)
+ (var_ref y_over_x))
+ (constant float (1.0))))))))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 y_over_x))
+ ((return (call asin ((expression vec3 *
+ (var_ref y_over_x)
+ (expression vec3 rsq
+ (expression vec3 +
+ (expression vec3 *
+ (var_ref y_over_x)
+ (var_ref y_over_x))
+ (constant float (1.0))))))))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 y_over_x))
+ ((return (call asin ((expression vec4 *
+ (var_ref y_over_x)
+ (expression vec4 rsq
+ (expression vec4 +
+ (expression vec4 *
+ (var_ref y_over_x)
+ (var_ref y_over_x))
+ (constant float (1.0))))))))))
+
+ (signature float
+ (parameters
+ (declare (in ) float y)
+ (declare (in ) float x)
+ )
+ (
+ (declare () float r)
+ (declare ( ) float abs_retval)
+ (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))
+)
+ (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (
+ (declare ( ) float atan_retval)
+ (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))
+)
+ (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) )
+ (if (expression bool < (var_ref x) (constant float (0.000000)) ) (
+ (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (
+ (declare ( ) float assignment_tmp)
+ (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )
+ (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
+ )
+ (
+ (declare ( ) float assignment_tmp)
+ (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )
+ (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
+ ))
+
+ )
+ (
+ ))
+
+ )
+ (
+ (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)) )
+ ))
+
+ ))
+
+ (return (var_ref r) )
+ ))
+
+
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 y)
+ (declare (in) vec2 x))
+ ((declare () vec2 r)
+ (assign (constant bool (1))
+ (swiz x (var_ref r))
+ (call atan ((swiz x (var_ref y))
+ (swiz x (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz y (var_ref r))
+ (call atan ((swiz y (var_ref y))
+ (swiz y (var_ref x)))))
+ (return (var_ref r))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 y)
+ (declare (in) vec3 x))
+ ((declare () vec3 r)
+ (assign (constant bool (1))
+ (swiz x (var_ref r))
+ (call atan ((swiz x (var_ref y))
+ (swiz x (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz y (var_ref r))
+ (call atan ((swiz y (var_ref y))
+ (swiz y (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz z (var_ref r))
+ (call atan ((swiz z (var_ref y))
+ (swiz z (var_ref x)))))
+ (return (var_ref r))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 y)
+ (declare (in) vec4 x))
+ ((declare () vec4 r)
+ (assign (constant bool (1))
+ (swiz x (var_ref r))
+ (call atan ((swiz x (var_ref y))
+ (swiz x (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz y (var_ref r))
+ (call atan ((swiz y (var_ref y))
+ (swiz y (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz z (var_ref r))
+ (call atan ((swiz z (var_ref y))
+ (swiz z (var_ref x)))))
+ (assign (constant bool (1))
+ (swiz w (var_ref r))
+ (call atan ((swiz w (var_ref y))
+ (swiz w (var_ref x)))))
+ (return (var_ref r)))))
+
+))