summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/ir/distance
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-08-16 19:08:53 -0700
committerIan Romanick <[email protected]>2010-08-16 19:08:53 -0700
commit6c03c576cc49bbb008de66d374f4302ff0fe0390 (patch)
tree7ddeb3ee88532d9aef8728b9aa256edf7c125247 /src/glsl/builtins/ir/distance
parent15a3b42e135a3a2cb463ec3cff80a55dd8528051 (diff)
parenta433cd286c60eb9d4c2114f042709eda0f3de676 (diff)
Merge branch 'glsl2'
Conflicts: src/mesa/program/prog_optimize.c
Diffstat (limited to 'src/glsl/builtins/ir/distance')
-rw-r--r--src/glsl/builtins/ir/distance33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/glsl/builtins/ir/distance b/src/glsl/builtins/ir/distance
new file mode 100644
index 00000000000..a2309c484f9
--- /dev/null
+++ b/src/glsl/builtins/ir/distance
@@ -0,0 +1,33 @@
+((function distance
+ (signature float
+ (parameters
+ (declare (in) float p0)
+ (declare (in) float p1))
+ ((declare () float p)
+ (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))
+ (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
+
+ (signature float
+ (parameters
+ (declare (in) vec2 p0)
+ (declare (in) vec2 p1))
+ ((declare () vec2 p)
+ (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
+ (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
+
+ (signature float
+ (parameters
+ (declare (in) vec3 p0)
+ (declare (in) vec3 p1))
+ ((declare () vec3 p)
+ (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
+ (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
+
+ (signature float
+ (parameters
+ (declare (in) vec4 p0)
+ (declare (in) vec4 p1))
+ ((declare () vec4 p)
+ (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
+ (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
+))