summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-05-03 21:29:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-05-14 16:34:46 -0700
commit6a9b1e1f06c2859f0c20375189c6ff02ed769d1a (patch)
treeb2ac9162cbfaa3ed6f38a4f780d4e519fca4fbcf
parentd9bda3c29d23f99598645902c8ba3b7666341c9b (diff)
Implement "cross" builtin.
-rw-r--r--builtins/110/cross17
1 files changed, 17 insertions, 0 deletions
diff --git a/builtins/110/cross b/builtins/110/cross
new file mode 100644
index 0000000000..deb2f952bf
--- /dev/null
+++ b/builtins/110/cross
@@ -0,0 +1,17 @@
+((function cross
+ (signature vec3
+ (parameters
+ (declare (in) vec3 arg0)
+ (declare (in) vec3 arg1))
+ ((declare () vec3 t)
+ (assign (constant bool (1)) (swiz x (var_ref t))
+ (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1)))
+ (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0)))))
+ (assign (constant bool (1)) (swiz y (var_ref t))
+ (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1)))
+ (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0)))))
+ (assign (constant bool (1)) (swiz z (var_ref t))
+ (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1)))
+ (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0)))))
+ (return (var_ref t))))
+))