summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/ir/distance
blob: 1595bf669bb07995e3660f5aa0205f83e332db40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
((function distance
   (signature float
     (parameters
       (declare (in) float p0)
       (declare (in) float p1))
     ((declare () float p)
      (assign (constant bool (1)) (x) (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)) (xy) (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)) (xyz) (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)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
      (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
))