2 * Mesa 3-D graphics library
5 * Copyright (C) 2006 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 // This file defines nearly all constructors and operators for built-in data
27 // types, using extended language syntax. In general, compiler treats
28 // constructors and operators as ordinary functions with some exceptions.
29 // For example, the language does not allow functions to be called in
30 // constant expressions - here the exception is made to allow it.
32 // Each implementation provides its own version of this file. Each
33 // implementation can define the required set of operators and constructors
34 // in its own fashion.
36 // The extended language syntax is only present when compiling this file.
37 // It is implicitly included at the very beginning of the compiled shader,
38 // so no built-in functions can be used.
40 // To communicate with the implementation, a special extended "__asm" keyword
41 // is used, followed by an instruction name (any valid identifier), a
42 // destination variable identifier and a list of zero or more source
43 // variable identifiers.
45 // A variable identifier is a variable name declared earlier in the code
46 // (as a function parameter, local or global variable).
48 // An instruction name designates an instruction that must be exported
49 // by the implementation. Each instruction receives data from source
50 // variable identifiers and returns data in the destination variable
53 // It is up to the implementation how to define a particular operator
54 // or constructor. If it is expected to being used rarely, it can be
55 // defined in terms of other operators and constructors,
58 // ivec2 __operator + (const ivec2 x, const ivec2 y) {
59 // return ivec2 (x[0] + y[0], x[1] + y[1]);
62 // If a particular operator or constructor is expected to be used very
63 // often or is an atomic operation (that is, an operation that cannot be
64 // expressed in terms of other operations or would create a dependency
65 // cycle) it must be defined using one or more __asm constructs.
67 // Each implementation must define constructors for all scalar types
68 // (bool, float, int). There are 9 scalar-to-scalar constructors
69 // (including identity constructors). However, since the language
70 // introduces special constructors (like matrix constructor with a single
71 // scalar value), implementations must also implement these cases.
72 // The compiler provides the following algorithm when resolving a constructor:
73 // - try to find a constructor with a prototype matching ours,
74 // - if no constructor is found and this is a scalar-to-scalar constructor,
76 // - if a constructor is found, execute it and return,
77 // - count the size of the constructor parameter list - if it is less than
78 // the size of our constructor's type, raise an error,
79 // - for each parameter in the list do a recursive constructor matching for
80 // appropriate scalar fields in the constructed variable,
82 // Each implementation must also define a set of operators that deal with
83 // built-in data types.
84 // There are four kinds of operators:
85 // 1) Operators that are implemented only by the compiler: "()" (function
86 // call), "," (sequence) and "?:" (selection).
87 // 2) Operators that are implemented by the compiler by expressing it in
88 // terms of other operators:
89 // - "." (field selection) - translated to subscript access,
90 // - "&&" (logical and) - translated to "<left_expr> ? <right_expr> :
92 // - "||" (logical or) - translated to "<left_expr> ? true : <right_expr>",
93 // 3) Operators that can be defined by the implementation and if the required
94 // prototype is not found, standard behaviour is used:
95 // - "==", "!=", "=" (equality, assignment) - compare or assign
96 // matching fields one-by-one;
97 // note that at least operators for scalar data types must be defined
98 // by the implementation to get it work,
99 // 4) All other operators not mentioned above. If no required prototype is
100 // found, an error is raised. An implementation must follow the language
101 // specification to provide all valid operator prototypes.
106 //// Basic, scalar constructors/casts
108 int __constructor(const float f)
110 __asm float_to_int __retVal, f;
113 bool __constructor(const int i)
115 const float zero = 0.0;
116 __asm vec4_sne __retVal, i, zero;
119 bool __constructor(const float f)
121 const float zero = 0.0;
122 __asm vec4_sne __retVal, f, zero;
125 int __constructor(const bool b)
130 float __constructor(const bool b)
135 float __constructor(const int i)
137 __asm int_to_float __retVal, i;
140 bool __constructor(const bool b)
145 int __constructor(const int i)
150 float __constructor(const float f)
156 //// vec2 constructors
158 vec2 __constructor(const float x, const float y)
164 vec2 __constructor(const float f)
169 vec2 __constructor(const int i)
174 vec2 __constructor(const bool b)
179 vec2 __constructor(const bvec2 b)
184 vec2 __constructor(const vec3 v)
189 vec2 __constructor(const vec4 v)
195 //// vec3 constructors
197 vec3 __constructor(const float x, const float y, const float z)
204 vec3 __constructor(const float f)
206 __retVal.xyz = f.xxx;
209 vec3 __constructor(const int i)
211 __asm int_to_float __retVal.xyz, i.xxx;
214 vec3 __constructor(const bool b)
216 __retVal.xyz = b.xxx;
219 vec3 __constructor(const bvec3 b)
224 vec3 __constructor(const vec4 v)
226 __retVal.xyz = v.xyz;
230 //// vec4 constructors
232 vec4 __constructor(const float x, const float y, const float z, const float w)
240 vec4 __constructor(const float f)
245 vec4 __constructor(const int i)
250 vec4 __constructor(const bool b)
255 vec4 __constructor(const bvec4 b)
260 vec4 __constructor(const vec3 v3, const float f)
262 // XXX this constructor shouldn't be needed anymore
267 vec4 __constructor(const vec2 v2, const float f1, const float f2)
269 // XXX this constructor shouldn't be needed anymore
276 //// ivec2 constructors
278 ivec2 __constructor(const int i, const int j)
284 ivec2 __constructor(const int i)
289 ivec2 __constructor(const float f)
291 __asm float_to_int __retVal.xy, f.xx;
294 ivec2 __constructor(const bool b)
296 __asm float_to_int __retVal.xy, b.xx;
300 //// ivec3 constructors
302 ivec3 __constructor(const int i, const int j, const int k)
309 ivec3 __constructor(const int i)
311 __retVal.xyz = i.xxx;
314 ivec3 __constructor(const float f)
316 __retVal.xyz = f.xxx;
319 ivec3 __constructor(const bool b)
321 __retVal.xyz = b.xxx;
325 //// ivec4 constructors
327 ivec4 __constructor(const int x, const int y, const int z, const int w)
335 ivec4 __constructor(const int i)
340 ivec4 __constructor(const float f)
342 __asm float_to_int __retVal, f.xxxx;
345 ivec4 __constructor(const bool b)
351 //// bvec2 constructors
353 bvec2 __constructor(const bool b1, const bool b2)
359 bvec2 __constructor(const bool b)
364 bvec2 __constructor(const float f)
366 const vec2 zero = vec2(0.0, 0.0);
367 __asm vec4_sne __retVal.xy, f.xx, zero;
370 bvec2 __constructor(const int i)
372 const ivec2 zero = ivec2(0, 0);
373 __asm vec4_sne __retVal.xy, i.xx, zero;
376 bvec2 __constructor(const vec2 v)
378 __asm vec4_sne __retVal.xy, v, 0.0;
381 bvec2 __constructor(const ivec2 v)
383 const ivec2 zero = ivec2(0, 0);
384 __asm vec4_sne __retVal.xy, v, zero;
389 //// bvec3 constructors
391 bvec3 __constructor(const bool b1, const bool b2, const bool b3)
398 bvec3 __constructor(const bool b)
400 __retVal.xyz = b.xxx;
403 bvec3 __constructor(const float f)
405 const vec3 zero = vec3(0.0, 0.0, 0.0);
406 __asm vec4_sne __retVal.xyz, f.xxx, zero;
409 bvec3 __constructor(const int i)
411 const ivec3 zero = ivec3(0, 0, 0);
412 __asm vec4_sne __retVal.xyz, i.xxx, zero;
415 bvec3 __constructor(const vec3 v)
417 const vec3 zero = vec3(0.0, 0.0, 0.0);
418 __asm vec4_sne __retVal.xyz, v, zero;
421 bvec3 __constructor(const ivec3 v)
423 const ivec3 zero = ivec3(0, 0, 0);
424 __asm vec4_sne __retVal.xyz, v, zero;
429 //// bvec4 constructors
431 bvec4 __constructor(const bool b1, const bool b2, const bool b3, const bool b4)
439 bvec4 __constructor(const bool b)
441 __retVal.xyzw = b.xxxx;
444 bvec4 __constructor(const float f)
446 const vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
447 __asm vec4_sne __retVal, f.xxxx, zero;
450 bvec4 __constructor(const int i)
452 const ivec4 zero = ivec4(0, 0, 0, 0);
453 __asm vec4_sne __retVal, i.xxxx, zero;
456 bvec4 __constructor(const vec4 v)
458 const vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
459 __asm vec4_sne __retVal, v, zero;
462 bvec4 __constructor(const ivec4 v)
464 const ivec4 zero = ivec4(0, 0, 0, 0);
465 __asm vec4_sne __retVal, v, zero;
470 //// mat2 constructors
472 mat2 __constructor(const float m00, const float m10,
473 const float m01, const float m11)
481 mat2 __constructor(const float f)
489 mat2 __constructor(const int i)
491 return mat2(float(i));
494 mat2 __constructor(const bool b)
496 return mat2(float(b));
499 mat2 __constructor(const vec2 c0, const vec2 c1)
506 //// mat3 constructors
508 mat3 __constructor(const float m00, const float m10, const float m20,
509 const float m01, const float m11, const float m21,
510 const float m02, const float m12, const float m22)
523 mat3 __constructor(const float f)
525 vec2 v = vec2(f, 0.0);
531 mat3 __constructor(const int i)
533 return mat3(float(i));
536 mat3 __constructor(const bool b)
538 return mat3(float(b));
541 mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2)
549 //// mat4 constructors
551 mat4 __constructor(const float m00, const float m10, const float m20, const float m30,
552 const float m01, const float m11, const float m21, const float m31,
553 const float m02, const float m12, const float m22, const float m32,
554 const float m03, const float m13, const float m23, const float m33)
575 mat4 __constructor(const float f)
577 vec2 v = vec2(f, 0.0);
578 __retVal[0] = v.xyyy;
579 __retVal[1] = v.yxyy;
580 __retVal[2] = v.yyxy;
581 __retVal[3] = v.yyyx;
584 mat4 __constructor(const int i)
586 return mat4(float(i));
589 mat4 __constructor(const bool b)
591 return mat4(float(b));
594 mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3)
604 //// Basic int operators
606 int __operator + (const int a, const int b)
608 // XXX If we ever have int registers, we'll do something like this:
609 // XXX For now, mostly treat ints as floats.
611 // __asm int_to_float x, a;
612 // __asm int_to_float y, b;
613 // __asm vec4_add x.x, x.x, y.x;
614 // __asm float_to_int __retVal, x;
616 __asm vec4_add x, a, b;
617 __asm float_to_int __retVal, x;
620 int __operator - (const int a, const int b)
623 __asm vec4_subtract x, a, b;
624 __asm float_to_int __retVal, x;
627 int __operator * (const int a, const int b)
630 __asm vec4_multiply x, a, b;
631 __asm float_to_int __retVal, x;
634 int __operator / (const int a, const int b)
637 __asm float_rcp bInv, b;
638 __asm vec4_multiply x, a, bInv;
639 __asm float_to_int __retVal, x;
643 //// Basic ivec2 operators
645 ivec2 __operator + (const ivec2 a, const ivec2 b)
648 __asm vec4_add x, a, b;
649 __asm float_to_int __retVal, x;
652 ivec2 __operator - (const ivec2 a, const ivec2 b)
655 __asm vec4_subtract x, a, b;
656 __asm float_to_int __retVal, x;
659 ivec2 __operator * (const ivec2 a, const ivec2 b)
662 __asm vec4_multiply x, a, b;
663 __asm float_to_int __retVal, x;
666 ivec2 __operator / (const ivec2 a, const ivec2 b)
669 __asm float_rcp bInv.x, b.x;
670 __asm float_rcp bInv.y, b.y;
671 __asm vec4_multiply x, a, bInv;
672 __asm float_to_int __retVal, x;
676 //// Basic ivec3 operators
678 ivec3 __operator + (const ivec3 a, const ivec3 b)
681 __asm vec4_add x, a, b;
682 __asm float_to_int __retVal, x;
685 ivec3 __operator - (const ivec3 a, const ivec3 b)
688 __asm vec4_subtract x, a, b;
689 __asm float_to_int __retVal, x;
692 ivec3 __operator * (const ivec3 a, const ivec3 b)
695 __asm vec4_multiply x, a, b;
696 __asm float_to_int __retVal, x;
699 ivec3 __operator / (const ivec3 a, const ivec3 b)
702 __asm float_rcp bInv.x, b.x;
703 __asm float_rcp bInv.y, b.y;
704 __asm float_rcp bInv.z, b.z;
705 __asm vec4_multiply x, a, bInv;
706 __asm float_to_int __retVal, x;
710 //// Basic ivec4 operators
712 ivec4 __operator + (const ivec4 a, const ivec4 b)
715 __asm vec4_add x, a, b;
716 __asm float_to_int __retVal, x;
719 ivec4 __operator - (const ivec4 a, const ivec4 b)
722 __asm vec4_subtract x, a, b;
723 __asm float_to_int __retVal, x;
726 ivec4 __operator * (const ivec4 a, const ivec4 b)
729 __asm vec4_multiply x, a, b;
730 __asm float_to_int __retVal, x;
733 ivec4 __operator / (const ivec4 a, const ivec4 b)
736 __asm float_rcp bInv.x, b.x;
737 __asm float_rcp bInv.y, b.y;
738 __asm float_rcp bInv.z, b.z;
739 __asm float_rcp bInv.w, b.w;
740 __asm vec4_multiply x, a, bInv;
741 __asm float_to_int __retVal, x;
745 //// Basic float operators
747 float __operator + (const float a, const float b)
749 __asm vec4_add __retVal.x, a, b;
752 float __operator - (const float a, const float b)
754 __asm vec4_subtract __retVal.x, a, b;
757 float __operator * (const float a, const float b)
759 __asm vec4_multiply __retVal.x, a, b;
762 float __operator / (const float a, const float b)
765 __asm float_rcp bInv.x, b.x;
766 __asm vec4_multiply __retVal.x, a, bInv;
770 //// Basic vec2 operators
772 vec2 __operator + (const vec2 v, const vec2 u)
774 __asm vec4_add __retVal.xy, v, u;
777 vec2 __operator - (const vec2 v, const vec2 u)
779 __asm vec4_subtract __retVal.xy, v, u;
782 vec2 __operator * (const vec2 v, const vec2 u)
784 __asm vec4_multiply __retVal.xy, v, u;
787 vec2 __operator / (const vec2 v, const vec2 u)
790 __asm float_rcp w.x, u.x;
791 __asm float_rcp w.y, u.y;
792 __asm vec4_multiply __retVal.xy, v, w;
796 //// Basic vec3 operators
798 vec3 __operator + (const vec3 v, const vec3 u)
800 __asm vec4_add __retVal.xyz, v, u;
803 vec3 __operator - (const vec3 v, const vec3 u)
805 __asm vec4_subtract __retVal.xyz, v, u;
808 vec3 __operator * (const vec3 v, const vec3 u)
810 __asm vec4_multiply __retVal.xyz, v, u;
813 vec3 __operator / (const vec3 v, const vec3 u)
816 __asm float_rcp w.x, u.x;
817 __asm float_rcp w.y, u.y;
818 __asm float_rcp w.z, u.z;
819 __asm vec4_multiply __retVal.xyz, v, w;
823 //// Basic vec4 operators
825 vec4 __operator + (const vec4 v, const vec4 u)
827 __asm vec4_add __retVal, v, u;
830 vec4 __operator - (const vec4 v, const vec4 u)
832 __asm vec4_subtract __retVal, v, u;
835 vec4 __operator * (const vec4 v, const vec4 u)
837 __asm vec4_multiply __retVal, v, u;
840 vec4 __operator / (const vec4 v, const vec4 u)
843 __asm float_rcp w.x, u.x;
844 __asm float_rcp w.y, u.y;
845 __asm float_rcp w.z, u.z;
846 __asm float_rcp w.w, u.w;
847 __asm vec4_multiply __retVal, v, w;
853 //// Basic vec2/float operators
855 vec2 __operator + (const float a, const vec2 u)
857 __asm vec4_add __retVal.xy, a.xx, u.xy;
860 vec2 __operator + (const vec2 v, const float b)
862 __asm vec4_add __retVal.xy, v.xy, b.xx;
865 vec2 __operator - (const float a, const vec2 u)
867 __asm vec4_subtract __retVal.xy, a.xx, u.xy;
870 vec2 __operator - (const vec2 v, const float b)
872 __asm vec4_subtract __retVal.xy, v.xy, b.xx;
875 vec2 __operator * (const float a, const vec2 u)
877 __asm vec4_multiply __retVal.xy, a.xx, u.xy;
880 vec2 __operator * (const vec2 v, const float b)
882 __asm vec4_multiply __retVal.xy, v.xy, b.xx;
885 vec2 __operator / (const float a, const vec2 u)
888 __asm float_rcp invU.x, u.x;
889 __asm float_rcp invU.y, u.y;
890 __asm vec4_multiply __retVal.xy, a.xx, invU.xy;
893 vec2 __operator / (const vec2 v, const float b)
896 __asm float_rcp invB, b;
897 __asm vec4_multiply __retVal.xy, v.xy, invB.xx;
901 //// Basic vec3/float operators
903 vec3 __operator + (const float a, const vec3 u)
905 __asm vec4_add __retVal.xyz, a.xxx, u.xyz;
908 vec3 __operator + (const vec3 v, const float b)
910 __asm vec4_add __retVal.xyz, v.xyz, b.xxx;
913 vec3 __operator - (const float a, const vec3 u)
915 __asm vec4_subtract __retVal.xyz, a.xxx, u.xyz;
918 vec3 __operator - (const vec3 v, const float b)
920 __asm vec4_subtract __retVal.xyz, v.xyz, b.xxx;
923 vec3 __operator * (const float a, const vec3 u)
925 __asm vec4_multiply __retVal.xyz, a.xxx, u.xyz;
928 vec3 __operator * (const vec3 v, const float b)
930 __asm vec4_multiply __retVal.xyz, v.xyz, b.xxx;
933 vec3 __operator / (const float a, const vec3 u)
936 __asm float_rcp invU.x, u.x;
937 __asm float_rcp invU.y, u.y;
938 __asm float_rcp invU.z, u.z;
939 __asm vec4_multiply __retVal.xyz, a.xxx, invU.xyz;
942 vec3 __operator / (const vec3 v, const float b)
945 __asm float_rcp invB, b;
946 __asm vec4_multiply __retVal.xyz, v.xyz, invB.xxx;
950 //// Basic vec4/float operators
952 vec4 __operator + (const float a, const vec4 u)
954 __asm vec4_add __retVal, a.xxxx, u;
957 vec4 __operator + (const vec4 v, const float b)
959 __asm vec4_add __retVal, v, b.xxxx;
962 vec4 __operator - (const float a, const vec4 u)
964 __asm vec4_subtract __retVal, a.xxxx, u;
967 vec4 __operator - (const vec4 v, const float b)
969 __asm vec4_subtract __retVal, v, b.xxxx;
972 vec4 __operator * (const float a, const vec4 u)
974 __asm vec4_multiply __retVal, a.xxxx, u;
977 vec4 __operator * (const vec4 v, const float b)
979 __asm vec4_multiply __retVal, v, b.xxxx;
982 vec4 __operator / (const float a, const vec4 u)
985 __asm float_rcp invU.x, u.x;
986 __asm float_rcp invU.y, u.y;
987 __asm float_rcp invU.z, u.z;
988 __asm float_rcp invU.w, u.w;
989 __asm vec4_multiply __retVal, a.xxxx, invU;
992 vec4 __operator / (const vec4 v, const float b)
995 __asm float_rcp invB, b;
996 __asm vec4_multiply __retVal, v, invB.xxxx;
1001 //// Basic ivec2/int operators
1003 ivec2 __operator + (const int a, const ivec2 u)
1005 __retVal = ivec2(a) + u;
1008 ivec2 __operator + (const ivec2 v, const int b)
1010 __retVal = v + ivec2(b);
1013 ivec2 __operator - (const int a, const ivec2 u)
1015 __retVal = ivec2(a) - u;
1018 ivec2 __operator - (const ivec2 v, const int b)
1020 __retVal = v - ivec2(b);
1023 ivec2 __operator * (const int a, const ivec2 u)
1025 __retVal = ivec2(a) * u;
1028 ivec2 __operator * (const ivec2 v, const int b)
1030 __retVal = v * ivec2(b);
1033 ivec2 __operator / (const int a, const ivec2 u)
1035 __retVal = ivec2(a) / u;
1038 ivec2 __operator / (const ivec2 v, const int b)
1040 __retVal = v / ivec2(b);
1044 //// Basic ivec3/int operators
1046 ivec3 __operator + (const int a, const ivec3 u)
1048 __retVal = ivec3(a) + u;
1051 ivec3 __operator + (const ivec3 v, const int b)
1053 __retVal = v + ivec3(b);
1056 ivec3 __operator - (const int a, const ivec3 u)
1058 __retVal = ivec3(a) - u;
1061 ivec3 __operator - (const ivec3 v, const int b)
1063 __retVal = v - ivec3(b);
1066 ivec3 __operator * (const int a, const ivec3 u)
1068 __retVal = ivec3(a) * u;
1071 ivec3 __operator * (const ivec3 v, const int b)
1073 __retVal = v * ivec3(b);
1076 ivec3 __operator / (const int a, const ivec3 u)
1078 __retVal = ivec3(a) / u;
1081 ivec3 __operator / (const ivec3 v, const int b)
1083 __retVal = v / ivec3(b);
1087 //// Basic ivec4/int operators
1089 ivec4 __operator + (const int a, const ivec4 u)
1091 __retVal = ivec4(a) + u;
1094 ivec4 __operator + (const ivec4 v, const int b)
1096 __retVal = v + ivec4(b);
1099 ivec4 __operator - (const int a, const ivec4 u)
1101 __retVal = ivec4(a) - u;
1104 ivec4 __operator - (const ivec4 v, const int b)
1106 __retVal = v - ivec4(b);
1109 ivec4 __operator * (const int a, const ivec4 u)
1111 __retVal = ivec4(a) * u;
1114 ivec4 __operator * (const ivec4 v, const int b)
1116 __retVal = v * ivec4(b);
1119 ivec4 __operator / (const int a, const ivec4 u)
1121 __retVal = ivec4(a) / u;
1124 ivec4 __operator / (const ivec4 v, const int b)
1126 __retVal = v / ivec4(b);
1132 //// Unary negation operator
1134 int __operator - (const int a)
1136 __asm vec4_negate __retVal.x, a;
1139 ivec2 __operator - (const ivec2 v)
1141 __asm vec4_negate __retVal, v;
1144 ivec3 __operator - (const ivec3 v)
1146 __asm vec4_negate __retVal, v;
1149 ivec4 __operator - (const ivec4 v)
1151 __asm vec4_negate __retVal, v;
1154 float __operator - (const float a)
1156 __asm vec4_negate __retVal.x, a;
1159 vec2 __operator - (const vec2 v)
1161 __asm vec4_negate __retVal.xy, v.xy;
1164 vec3 __operator - (const vec3 v)
1166 __asm vec4_negate __retVal.xyz, v.xyz;
1169 vec4 __operator - (const vec4 v)
1171 __asm vec4_negate __retVal, v;
1174 mat2 __operator - (const mat2 m)
1176 __retVal[0] = -m[0];
1177 __retVal[1] = -m[1];
1180 mat3 __operator - (const mat3 m)
1182 __retVal[0] = -m[0];
1183 __retVal[1] = -m[1];
1184 __retVal[2] = -m[2];
1187 mat4 __operator - (const mat4 m)
1189 __retVal[0] = -m[0];
1190 __retVal[1] = -m[1];
1191 __retVal[2] = -m[2];
1192 __retVal[3] = -m[3];
1199 float dot(const float a, const float b)
1204 float dot(const vec2 a, const vec2 b)
1206 __retVal = a.x * b.x + a.y * b.y;
1209 float dot(const vec3 a, const vec3 b)
1211 __asm vec3_dot __retVal, a, b;
1214 float dot(const vec4 a, const vec4 b)
1216 __asm vec4_dot __retVal, a, b;
1221 //// int assignment operators
1223 void __operator += (inout int a, const int b)
1225 __asm vec4_add a, a, b;
1228 void __operator -= (inout int a, const int b)
1230 __asm vec4_subtract a, a, b;
1233 void __operator *= (inout int a, const int b)
1235 __asm vec4_multiply a, a, b;
1238 void __operator /= (inout int a, const int b)
1241 __asm float_rcp invB, b;
1242 __asm vec4_multiply a, a, invB;
1243 __asm float_to_int a, a;
1247 //// ivec2 assignment operators
1249 void __operator += (inout ivec2 v, const ivec2 u)
1251 __asm vec4_add v, v, u;
1254 void __operator -= (inout ivec2 v, const ivec2 u)
1256 __asm vec4_subtract v, v, u;
1259 void __operator *= (inout ivec2 v, const ivec2 u)
1261 __asm vec4_multiply v, v, u;
1264 void __operator /= (inout ivec2 v, const ivec2 u)
1267 __asm float_rcp inv.x, u.x;
1268 __asm float_rcp inv.y, u.y;
1269 __asm vec4_multiply z, v, inv;
1270 __asm float_to_int v, z;
1274 //// ivec3 assignment operators
1276 void __operator += (inout ivec3 v, const ivec3 u)
1278 __asm vec4_add v, v, u;
1281 void __operator -= (inout ivec3 v, const ivec3 u)
1283 __asm vec4_subtract v, v, u;
1286 void __operator *= (inout ivec3 v, const ivec3 u)
1288 __asm vec4_multiply v, v, u;
1291 void __operator /= (inout ivec3 v, const ivec3 u)
1294 __asm float_rcp inv.x, u.x;
1295 __asm float_rcp inv.y, u.y;
1296 __asm vec4_multiply z, v, inv;
1297 __asm float_to_int v, z;
1301 //// ivec4 assignment operators
1303 void __operator += (inout ivec4 v, const ivec4 u)
1305 __asm vec4_add v, v, u;
1308 void __operator -= (inout ivec4 v, const ivec4 u)
1310 __asm vec4_subtract v, v, u;
1313 void __operator *= (inout ivec4 v, const ivec4 u)
1315 __asm vec4_multiply v, v, u;
1318 void __operator /= (inout ivec4 v, const ivec4 u)
1321 __asm float_rcp inv.x, u.x;
1322 __asm float_rcp inv.y, u.y;
1323 __asm vec4_multiply z, v, inv;
1324 __asm float_to_int v, z;
1328 //// float assignment operators
1330 void __operator += (inout float a, const float b)
1332 __asm vec4_add a.x, a.x, b.x;
1335 void __operator -= (inout float a, const float b)
1337 __asm vec4_subtract a.x, a, b;
1340 void __operator *= (inout float a, const float b)
1342 __asm vec4_multiply a.x, a, b;
1345 void __operator /= (inout float a, const float b)
1348 __asm float_rcp w.x, b;
1349 __asm vec4_multiply a.x, a, w;
1353 //// vec2 assignment operators
1355 void __operator += (inout vec2 v, const vec2 u)
1357 __asm vec4_add v.xy, v.xy, u.xy;
1360 void __operator -= (inout vec2 v, const vec2 u)
1362 __asm vec4_subtract v.xy, v.xy, u.xy;
1365 void __operator *= (inout vec2 v, const vec2 u)
1367 __asm vec4_multiply v.xy, v.xy, u.xy;
1370 void __operator /= (inout vec2 v, const vec2 u)
1373 __asm float_rcp w.x, u.x;
1374 __asm float_rcp w.y, u.y;
1375 __asm vec4_multiply v.xy, v.xy, w.xy;
1379 //// vec3 assignment operators
1381 void __operator += (inout vec3 v, const vec3 u)
1383 __asm vec4_add v.xyz, v, u;
1386 void __operator -= (inout vec3 v, const vec3 u)
1388 __asm vec4_subtract v.xyz, v, u;
1391 void __operator *= (inout vec3 v, const vec3 u)
1393 __asm vec4_multiply v.xyz, v, u;
1396 void __operator /= (inout vec3 v, const vec3 u)
1399 __asm float_rcp w.x, u.x;
1400 __asm float_rcp w.y, u.y;
1401 __asm float_rcp w.z, u.z;
1402 __asm vec4_multiply v.xyz, v.xyz, w.xyz;
1406 //// vec4 assignment operators
1408 void __operator += (inout vec4 v, const vec4 u)
1410 __asm vec4_add v, v, u;
1413 void __operator -= (inout vec4 v, const vec4 u)
1415 __asm vec4_subtract v, v, u;
1418 void __operator *= (inout vec4 v, const vec4 u)
1420 __asm vec4_multiply v, v, u;
1423 void __operator /= (inout vec4 v, const vec4 u)
1426 __asm float_rcp w.x, u.x;
1427 __asm float_rcp w.y, u.y;
1428 __asm float_rcp w.z, u.z;
1429 __asm float_rcp w.w, u.w;
1430 __asm vec4_multiply v, v, w;
1435 //// ivec2/int assignment operators
1437 void __operator += (inout ivec2 v, const int a)
1439 __asm vec4_add v.xy, v.xy, a.xx;
1442 void __operator -= (inout ivec2 v, const int a)
1444 __asm vec4_subtract v.xy, v.xy, a.xx;
1447 void __operator *= (inout ivec2 v, const int a)
1449 __asm vec4_multiply v.xy, v.xy, a.xx;
1454 void __operator /= (inout ivec2 v, const int a)
1462 //// ivec3/int assignment operators
1464 void __operator += (inout ivec3 v, const int a)
1466 __asm vec4_add v.xyz, v.xyz, a.xxx;
1469 void __operator -= (inout ivec3 v, const int a)
1471 __asm vec4_subtract v.xyz, v.xyz, a.xxx;
1474 void __operator *= (inout ivec3 v, const int a)
1476 __asm vec4_multiply v.xyz, v.xyz, a.xxx;
1479 void __operator /= (inout ivec3 v, const int a)
1488 //// ivec4/int assignment operators
1490 void __operator += (inout ivec4 v, const int a)
1492 __asm vec4_add v, v, a.xxxx;
1495 void __operator -= (inout ivec4 v, const int a)
1497 __asm vec4_subtract v, v, a.xxxx;
1500 void __operator *= (inout ivec4 v, const int a)
1502 __asm vec4_multiply v, v, a.xxxx;
1505 void __operator /= (inout ivec4 v, const int a)
1515 //// vec2/float assignment operators
1517 void __operator += (inout vec2 v, const float a)
1519 __asm vec4_add v.xy, v, a.xx;
1522 void __operator -= (inout vec2 v, const float a)
1524 __asm vec4_subtract v.xy, v, a.xx;
1527 void __operator *= (inout vec2 v, const float a)
1529 __asm vec4_multiply v.xy, v, a.xx;
1532 void __operator /= (inout vec2 v, const float a)
1535 __asm float_rcp invA, a;
1536 __asm vec4_multiply v.xy, v.xy, invA.xx;
1540 //// vec3/float assignment operators
1542 void __operator += (inout vec3 v, const float a)
1544 __asm vec4_add v.xyz, v, a.xxx;
1547 void __operator -= (inout vec3 v, const float a)
1549 __asm vec4_subtract v.xyz, v, a.xxx;
1552 void __operator *= (inout vec3 v, const float a)
1554 __asm vec4_multiply v.xyz, v, a.xxx;
1557 void __operator /= (inout vec3 v, const float a)
1560 __asm float_rcp invA, a;
1561 __asm vec4_multiply v.xyz, v.xyz, invA.xxx;
1565 //// vec4/float assignment operators
1567 void __operator += (inout vec4 v, const float a)
1569 __asm vec4_add v, v, a.xxxx;
1572 void __operator -= (inout vec4 v, const float a)
1574 __asm vec4_subtract v, v, a.xxxx;
1577 void __operator *= (inout vec4 v, const float a)
1579 __asm vec4_multiply v, v, a.xxxx;
1582 void __operator /= (inout vec4 v, const float a)
1585 __asm float_rcp invA, a;
1586 __asm vec4_multiply v, v, invA.xxxx;
1593 //// Basic mat2 operations
1595 mat2 __operator + (const mat2 m, const mat2 n)
1597 __retVal[0] = m[0] + n[0];
1598 __retVal[1] = m[1] + n[1];
1601 mat2 __operator - (const mat2 m, const mat2 n)
1603 __retVal[0] = m[0] - n[0];
1604 __retVal[1] = m[1] - n[1];
1607 mat2 __operator * (const mat2 m, const mat2 n)
1609 __retVal[0] = m[0] * n[0].xx + m[1] * n[0].yy;
1610 __retVal[1] = m[0] * n[1].xx + m[1] * n[1].yy;
1613 mat2 __operator / (const mat2 m, const mat2 n)
1615 __retVal[0] = m[0] / n[0];
1616 __retVal[1] = m[1] / n[1];
1620 //// Basic mat3 operations
1622 mat3 __operator + (const mat3 m, const mat3 n)
1624 __retVal[0] = m[0] + n[0];
1625 __retVal[1] = m[1] + n[1];
1626 __retVal[2] = m[2] + n[2];
1629 mat3 __operator - (const mat3 m, const mat3 n)
1631 __retVal[0] = m[0] - n[0];
1632 __retVal[1] = m[1] - n[1];
1633 __retVal[2] = m[2] - n[2];
1636 mat3 __operator * (const mat3 m, const mat3 n)
1638 __retVal[0] = m[0] * n[0].xxx + m[1] * n[0].yyy + m[2] * n[0].zzz;
1639 __retVal[1] = m[0] * n[1].xxx + m[1] * n[1].yyy + m[2] * n[1].zzz;
1640 __retVal[2] = m[0] * n[2].xxx + m[1] * n[2].yyy + m[2] * n[2].zzz;
1643 mat3 __operator / (const mat3 m, const mat3 n)
1645 __retVal[0] = m[0] / n[0];
1646 __retVal[1] = m[1] / n[1];
1647 __retVal[2] = m[2] / n[2];
1651 //// Basic mat4 operations
1653 mat4 __operator + (const mat4 m, const mat4 n)
1655 __retVal[0] = m[0] + n[0];
1656 __retVal[1] = m[1] + n[1];
1657 __retVal[2] = m[2] + n[2];
1658 __retVal[3] = m[3] + n[3];
1661 mat4 __operator - (const mat4 m, const mat4 n)
1663 __retVal[0] = m[0] - n[0];
1664 __retVal[1] = m[1] - n[1];
1665 __retVal[2] = m[2] - n[2];
1666 __retVal[3] = m[3] - n[3];
1669 mat4 __operator * (const mat4 m, const mat4 n)
1671 __retVal[0] = m[0] * n[0].xxxx + m[1] * n[0].yyyy + m[2] * n[0].zzzz + m[3] * n[0].wwww;
1672 __retVal[1] = m[0] * n[1].xxxx + m[1] * n[1].yyyy + m[2] * n[1].zzzz + m[3] * n[1].wwww;
1673 __retVal[2] = m[0] * n[2].xxxx + m[1] * n[2].yyyy + m[2] * n[2].zzzz + m[3] * n[2].wwww;
1674 __retVal[3] = m[0] * n[3].xxxx + m[1] * n[3].yyyy + m[2] * n[3].zzzz + m[3] * n[3].wwww;
1677 mat4 __operator / (const mat4 m, const mat4 n)
1679 __retVal[0] = m[0] / n[0];
1680 __retVal[1] = m[1] / n[1];
1681 __retVal[2] = m[2] / n[2];
1682 __retVal[3] = m[3] / n[3];
1686 //// mat2/float operations
1688 mat2 __operator + (const float a, const mat2 n)
1690 __retVal[0] = a + n[0];
1691 __retVal[1] = a + n[1];
1694 mat2 __operator + (const mat2 m, const float b)
1696 __retVal[0] = m[0] + b;
1697 __retVal[1] = m[1] + b;
1700 mat2 __operator - (const float a, const mat2 n)
1702 __retVal[0] = a - n[0];
1703 __retVal[1] = a - n[1];
1706 mat2 __operator - (const mat2 m, const float b)
1708 __retVal[0] = m[0] - b;
1709 __retVal[1] = m[1] - b;
1712 mat2 __operator * (const float a, const mat2 n)
1714 __retVal[0] = a * n[0];
1715 __retVal[1] = a * n[1];
1718 mat2 __operator * (const mat2 m, const float b)
1720 __retVal[0] = m[0] * b;
1721 __retVal[1] = m[1] * b;
1724 mat2 __operator / (const float a, const mat2 n)
1726 __retVal[0] = a / n[0];
1727 __retVal[1] = a / n[1];
1730 mat2 __operator / (const mat2 m, const float b)
1732 __retVal[0] = m[0] / b;
1733 __retVal[1] = m[1] / b;
1737 //// mat3/float operations
1739 mat3 __operator + (const float a, const mat3 n)
1741 __retVal[0] = a + n[0];
1742 __retVal[1] = a + n[1];
1743 __retVal[2] = a + n[2];
1746 mat3 __operator + (const mat3 m, const float b)
1748 __retVal[0] = m[0] + b;
1749 __retVal[1] = m[1] + b;
1750 __retVal[2] = m[2] + b;
1753 mat3 __operator - (const float a, const mat3 n)
1755 __retVal[0] = a - n[0];
1756 __retVal[1] = a - n[1];
1757 __retVal[2] = a - n[2];
1760 mat3 __operator - (const mat3 m, const float b)
1762 __retVal[0] = m[0] - b;
1763 __retVal[1] = m[1] - b;
1764 __retVal[2] = m[2] - b;
1767 mat3 __operator * (const float a, const mat3 n)
1769 __retVal[0] = a * n[0];
1770 __retVal[1] = a * n[1];
1771 __retVal[2] = a * n[2];
1774 mat3 __operator * (const mat3 m, const float b)
1776 __retVal[0] = m[0] * b;
1777 __retVal[1] = m[1] * b;
1778 __retVal[2] = m[2] * b;
1781 mat3 __operator / (const float a, const mat3 n)
1783 __retVal[0] = a / n[0];
1784 __retVal[1] = a / n[1];
1785 __retVal[2] = a / n[2];
1788 mat3 __operator / (const mat3 m, const float b)
1790 __retVal[0] = m[0] / b;
1791 __retVal[1] = m[1] / b;
1792 __retVal[2] = m[2] / b;
1796 //// mat4/float operations
1798 mat4 __operator + (const float a, const mat4 n)
1800 __retVal[0] = a + n[0];
1801 __retVal[1] = a + n[1];
1802 __retVal[2] = a + n[2];
1803 __retVal[3] = a + n[3];
1806 mat4 __operator + (const mat4 m, const float b)
1808 __retVal[0] = m[0] + b;
1809 __retVal[1] = m[1] + b;
1810 __retVal[2] = m[2] + b;
1811 __retVal[3] = m[3] + b;
1814 mat4 __operator - (const float a, const mat4 n)
1816 __retVal[0] = a - n[0];
1817 __retVal[1] = a - n[1];
1818 __retVal[2] = a - n[2];
1819 __retVal[3] = a - n[3];
1822 mat4 __operator - (const mat4 m, const float b)
1824 __retVal[0] = m[0] - b;
1825 __retVal[1] = m[1] - b;
1826 __retVal[2] = m[2] - b;
1827 __retVal[3] = m[3] - b;
1830 mat4 __operator * (const float a, const mat4 n)
1832 __retVal[0] = a * n[0];
1833 __retVal[1] = a * n[1];
1834 __retVal[2] = a * n[2];
1835 __retVal[3] = a * n[3];
1838 mat4 __operator * (const mat4 m, const float b)
1840 __retVal[0] = m[0] * b;
1841 __retVal[1] = m[1] * b;
1842 __retVal[2] = m[2] * b;
1843 __retVal[3] = m[3] * b;
1846 mat4 __operator / (const float a, const mat4 n)
1848 __retVal[0] = a / n[0];
1849 __retVal[1] = a / n[1];
1850 __retVal[2] = a / n[2];
1851 __retVal[3] = a / n[3];
1854 mat4 __operator / (const mat4 m, const float b)
1856 __retVal[0] = m[0] / b;
1857 __retVal[1] = m[1] / b;
1858 __retVal[2] = m[2] / b;
1859 __retVal[3] = m[3] / b;
1864 //// matrix / vector products
1866 vec2 __operator * (const mat2 m, const vec2 v)
1868 __retVal = m[0] * v.xx
1872 vec2 __operator * (const vec2 v, const mat2 m)
1874 __retVal.x = dot(v, m[0]);
1875 __retVal.y = dot(v, m[1]);
1878 vec3 __operator * (const mat3 m, const vec3 v)
1880 __retVal = m[0] * v.xxx
1885 vec3 __operator * (const vec3 v, const mat3 m)
1887 __retVal.x = dot(v, m[0]);
1888 __retVal.y = dot(v, m[1]);
1889 __retVal.z = dot(v, m[2]);
1892 vec4 __operator * (const mat4 m, const vec4 v)
1894 __retVal = m[0] * v.xxxx
1900 vec4 __operator * (const vec4 v, const mat4 m)
1902 __retVal.x = dot(v, m[0]);
1903 __retVal.y = dot(v, m[1]);
1904 __retVal.z = dot(v, m[2]);
1905 __retVal.w = dot(v, m[3]);
1910 //// mat2 assignment operators
1912 void __operator += (inout mat2 m, const mat2 n)
1918 void __operator -= (inout mat2 m, const mat2 n)
1924 void __operator *= (inout mat2 m, const mat2 n)
1929 void __operator /= (inout mat2 m, const mat2 n)
1936 //// mat3 assignment operators
1938 void __operator += (inout mat3 m, const mat3 n)
1945 void __operator -= (inout mat3 m, const mat3 n)
1952 void __operator *= (inout mat3 m, const mat3 n)
1957 void __operator /= (inout mat3 m, const mat3 n)
1965 // mat4 assignment operators
1967 void __operator += (inout mat4 m, const mat4 n)
1975 void __operator -= (inout mat4 m, const mat4 n) {
1982 void __operator *= (inout mat4 m, const mat4 n)
1987 void __operator /= (inout mat4 m, const mat4 n)
1996 //// mat2/float assignment operators
1998 void __operator += (inout mat2 m, const float a) {
2003 void __operator -= (inout mat2 m, const float a) {
2008 void __operator *= (inout mat2 m, const float a) {
2013 void __operator /= (inout mat2 m, const float a) {
2019 //// mat3/float assignment operators
2021 void __operator += (inout mat3 m, const float a) {
2027 void __operator -= (inout mat3 m, const float a) {
2033 void __operator *= (inout mat3 m, const float a) {
2039 void __operator /= (inout mat3 m, const float a) {
2046 //// mat4/float assignment operators
2048 void __operator += (inout mat4 m, const float a) {
2055 void __operator -= (inout mat4 m, const float a) {
2062 void __operator *= (inout mat4 m, const float a) {
2069 void __operator /= (inout mat4 m, const float a) {
2078 //// vec/mat assignment operators
2080 void __operator *= (inout vec2 v, const mat2 m)
2085 void __operator *= (inout vec3 v, const mat3 m)
2090 void __operator *= (inout vec4 v, const mat4 m)
2097 //// pre-decrement operators
2099 int __operator --(inout int a)
2105 ivec2 __operator --(inout ivec2 v)
2111 ivec3 __operator --(inout ivec3 v)
2117 ivec4 __operator --(inout ivec4 v)
2124 float __operator --(inout float a)
2130 vec2 __operator --(inout vec2 v)
2136 vec3 __operator --(inout vec3 v)
2142 vec4 __operator --(inout vec4 v)
2149 mat2 __operator --(inout mat2 m)
2151 m[0] = m[0] - vec2(1.0);
2152 m[1] = m[1] - vec2(1.0);
2156 mat3 __operator --(inout mat3 m)
2158 m[0] = m[0] - vec3(1.0);
2159 m[1] = m[1] - vec3(1.0);
2160 m[2] = m[2] - vec3(1.0);
2164 mat4 __operator --(inout mat4 m)
2166 m[0] = m[0] - vec4(1.0);
2167 m[1] = m[1] - vec4(1.0);
2168 m[2] = m[2] - vec4(1.0);
2169 m[3] = m[3] - vec4(1.0);
2174 //// pre-increment operators
2176 int __operator ++(inout int a)
2182 ivec2 __operator ++(inout ivec2 v)
2188 ivec3 __operator ++(inout ivec3 v)
2194 ivec4 __operator ++(inout ivec4 v)
2201 float __operator ++(inout float a)
2207 vec2 __operator ++(inout vec2 v)
2213 vec3 __operator ++(inout vec3 v)
2219 vec4 __operator ++(inout vec4 v)
2226 mat2 __operator ++(inout mat2 m)
2228 m[0] = m[0] + vec2(1.0);
2229 m[1] = m[1] + vec2(1.0);
2233 mat3 __operator ++(inout mat3 m)
2235 m[0] = m[0] + vec3(1.0);
2236 m[1] = m[1] + vec3(1.0);
2237 m[2] = m[2] + vec3(1.0);
2241 mat4 __operator ++(inout mat4 m)
2243 m[0] = m[0] + vec4(1.0);
2244 m[1] = m[1] + vec4(1.0);
2245 m[2] = m[2] + vec4(1.0);
2246 m[3] = m[3] + vec4(1.0);
2254 int __postDecr(inout int a)
2260 ivec2 __postDecr(inout ivec2 v)
2266 ivec3 __postDecr(inout ivec3 v)
2272 ivec4 __postDecr(inout ivec4 v)
2279 float __postDecr(inout float a)
2285 vec2 __postDecr(inout vec2 v)
2291 vec3 __postDecr(inout vec3 v)
2297 vec4 __postDecr(inout vec4 v)
2304 mat2 __postDecr(inout mat2 m)
2307 m[0] = m[0] - vec2(1.0);
2308 m[1] = m[1] - vec2(1.0);
2311 mat3 __postDecr(inout mat3 m)
2314 m[0] = m[0] - vec3(1.0);
2315 m[1] = m[1] - vec3(1.0);
2316 m[2] = m[2] - vec3(1.0);
2319 mat4 __postDecr(inout mat4 m)
2322 m[0] = m[0] - vec4(1.0);
2323 m[1] = m[1] - vec4(1.0);
2324 m[2] = m[2] - vec4(1.0);
2325 m[3] = m[3] - vec4(1.0);
2331 float __postIncr(inout float a)
2337 vec2 __postIncr(inout vec2 v)
2343 vec3 __postIncr(inout vec3 v)
2349 vec4 __postIncr(inout vec4 v)
2356 int __postIncr(inout int a)
2362 ivec2 __postIncr(inout ivec2 v)
2368 ivec3 __postIncr(inout ivec3 v)
2374 ivec4 __postIncr(inout ivec4 v)
2381 mat2 __postIncr(inout mat2 m)
2384 m[0] = m[0] + vec2(1.0);
2385 m[1] = m[1] + vec2(1.0);
2389 mat3 __postIncr(inout mat3 m)
2392 m[0] = m[0] + vec3(1.0);
2393 m[1] = m[1] + vec3(1.0);
2394 m[2] = m[2] + vec3(1.0);
2398 mat4 __postIncr(inout mat4 m)
2401 m[0] = m[0] + vec4(1.0);
2402 m[1] = m[1] + vec4(1.0);
2403 m[2] = m[2] + vec4(1.0);
2404 m[3] = m[3] + vec4(1.0);
2410 //// inequality operators
2413 // XXX are the inequality operators for floats/ints really needed????
2414 bool __operator < (const float a, const float b)
2416 __asm vec4_sgt __retVal.x, b, a;
2420 bool __operator < (const int a, const int b) {
2421 return float (a) < float (b);
2424 bool __operator > (const float a, const float b) {
2426 __asm float_less c, b, a;
2430 bool __operator > (const int a, const int b) {
2431 return float (a) > float (b);
2434 bool __operator >= (const float a, const float b) {
2436 __asm float_less g, b, a;
2437 __asm float_equal e, a, b;
2441 bool __operator >= (const int a, const int b) {
2442 return float (a) >= float (b);
2445 bool __operator <= (const float a, const float b) {
2447 __asm float_less g, a, b;
2448 __asm float_equal e, a, b;
2452 bool __operator <= (const int a, const int b) {
2453 return float (a) <= float (b);
2459 // MESA-specific extension functions.
2462 void printMESA (const float f) {
2463 __asm float_print f;
2466 void printMESA (const int i) {
2470 void printMESA (const bool b) {
2474 void printMESA (const vec2 v) {
2479 void printMESA (const vec3 v) {
2485 void printMESA (const vec4 v) {
2492 void printMESA (const ivec2 v) {
2497 void printMESA (const ivec3 v) {
2503 void printMESA (const ivec4 v) {
2510 void printMESA (const bvec2 v) {
2515 void printMESA (const bvec3 v) {
2521 void printMESA (const bvec4 v) {
2528 void printMESA (const mat2 m) {
2533 void printMESA (const mat3 m) {
2539 void printMESA (const mat4 m) {
2546 void printMESA (const sampler1D e) {
2550 void printMESA (const sampler2D e) {
2554 void printMESA (const sampler3D e) {
2558 void printMESA (const samplerCube e) {
2562 void printMESA (const sampler1DShadow e) {
2566 void printMESA (const sampler2DShadow e) {