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 vec4_to_ivec4 __retVal, f;
113 int __constructor(const bool b)
118 int __constructor(const int i)
123 bool __constructor(const int i)
125 __asm vec4_sne __retVal, i, 0.0;
128 bool __constructor(const float f)
130 __asm vec4_sne __retVal, f, 0.0;
133 bool __constructor(const bool b)
138 float __constructor(const int i)
140 __asm ivec4_to_vec4 __retVal, i;
143 float __constructor(const bool b)
145 __asm ivec4_to_vec4 __retVal, b;
148 float __constructor(const float f)
154 //// vec2 constructors
156 vec2 __constructor(const float x, const float y)
162 vec2 __constructor(const float f)
164 __asm vec4_move __retVal.xy, f;
167 vec2 __constructor(const int i)
169 __asm ivec4_to_vec4 __retVal.xy, i;
172 vec2 __constructor(const bool b)
174 __asm ivec4_to_vec4 __retVal.xy, b;
177 vec2 __constructor(const bvec2 b)
180 __asm ivec4_to_vec4 __retVal.xy, b;
183 vec2 __constructor(const vec3 v)
185 __asm vec4_move __retVal.xy, v.xy;
188 vec2 __constructor(const vec4 v)
190 __asm vec4_move __retVal.xy, v.xy;
194 //// vec3 constructors
196 vec3 __constructor(const float x, const float y, const float z)
203 vec3 __constructor(const float f)
205 // Note: this could be "__retVal.xyz = f" but that's an illegal assignment
206 __asm vec4_move __retVal.xyz, f;
209 vec3 __constructor(const int i)
211 __asm ivec4_to_vec4 __retVal.xyz, i;
214 vec3 __constructor(const bool b)
216 __asm ivec4_to_vec4 __retVal.xyz, b;
219 vec3 __constructor(const bvec3 b)
221 __asm ivec4_to_vec4 __retVal.xyz, b;
224 vec3 __constructor(const vec4 v)
226 __asm vec4_move __retVal.xyz, v;
230 //// vec4 constructors
232 vec4 __constructor(const float x, const float y, const float z, const float w)
240 vec4 __constructor(const float f)
242 // Note: this could be "__retVal = f" but that's an illegal assignment
243 __asm vec4_move __retVal, f;
246 vec4 __constructor(const int i)
248 __asm ivec4_to_vec4 __retVal, i;
251 vec4 __constructor(const bool b)
253 __asm ivec4_to_vec4 __retVal, b;
256 vec4 __constructor(const bvec4 b)
258 __asm ivec4_to_vec4 __retVal, b;
261 vec4 __constructor(const ivec4 i)
263 __asm ivec4_to_vec4 __retVal, i;
266 vec4 __constructor(const vec3 v3, const float f)
268 // XXX this constructor shouldn't be needed anymore
273 vec4 __constructor(const vec2 v2, const float f1, const float f2)
275 // XXX this constructor shouldn't be needed anymore
282 //// ivec2 constructors
284 ivec2 __constructor(const int i, const int j)
290 ivec2 __constructor(const int i)
292 __asm vec4_move __retVal.xy, i;
295 ivec2 __constructor(const float f)
297 __asm vec4_to_ivec4 __retVal.xy, f;
300 ivec2 __constructor(const bool b)
302 __asm vec4_to_ivec4 __retVal.xy, b;
306 //// ivec3 constructors
308 ivec3 __constructor(const int i, const int j, const int k)
315 ivec3 __constructor(const int i)
317 __asm vec4_move __retVal.xyz, i;
320 ivec3 __constructor(const float f)
322 __asm vec4_to_ivec4 __retVal.xyz, f;
325 ivec3 __constructor(const bool b)
327 __asm vec4_move __retVal.xyz, b;
331 //// ivec4 constructors
333 ivec4 __constructor(const int x, const int y, const int z, const int w)
341 ivec4 __constructor(const int i)
343 __asm vec4_move __retVal, i;
346 ivec4 __constructor(const float f)
348 __asm vec4_to_ivec4 __retVal, f;
351 ivec4 __constructor(const bool b)
353 __asm vec4_to_ivec4 __retVal, b;
357 //// bvec2 constructors
359 bvec2 __constructor(const bool b1, const bool b2)
365 bvec2 __constructor(const int i1, const int i2)
367 __asm vec4_sne __retVal.x, i1, 0.0;
368 __asm vec4_sne __retVal.y, i2, 0.0;
372 bvec2 __constructor(const bool b)
374 __asm vec4_move __retVal.xy, b;
377 bvec2 __constructor(const float f)
379 __asm vec4_sne __retVal.xy, f, 0.0;
382 bvec2 __constructor(const int i)
384 __asm vec4_sne __retVal.xy, i, 0.0;
387 bvec2 __constructor(const vec2 v)
389 __asm vec4_sne __retVal.xy, v, 0.0;
392 bvec2 __constructor(const ivec2 v)
394 __asm vec4_sne __retVal.xy, v, 0.0;
399 //// bvec3 constructors
401 bvec3 __constructor(const bool b1, const bool b2, const bool b3)
408 bvec3 __constructor(const float f1, const float f2, const float f3)
410 __asm vec4_sne __retVal.x, f1, 0.0;
411 __asm vec4_sne __retVal.y, f2, 0.0;
412 __asm vec4_sne __retVal.z, f3, 0.0;
415 bvec3 __constructor(const bool b)
417 __asm vec4_move __retVal.xyz, b;
420 bvec3 __constructor(const float f)
422 __asm vec4_sne __retVal.xyz, f, 0.0;
425 bvec3 __constructor(const int i)
427 __asm vec4_sne __retVal.xyz, i, 0.0;
430 bvec3 __constructor(const vec3 v)
432 __asm vec4_sne __retVal.xyz, v, 0.0;
435 bvec3 __constructor(const ivec3 v)
437 __asm vec4_sne __retVal.xyz, v, 0.0;
442 //// bvec4 constructors
444 bvec4 __constructor(const bool b1, const bool b2, const bool b3, const bool b4)
452 bvec4 __constructor(const float f1, const float f2, const float f3, const float f4)
454 const float zero = 0.0;
455 __asm vec4_sne __retVal.x, f1, zero;
456 __asm vec4_sne __retVal.y, f2, zero;
457 __asm vec4_sne __retVal.z, f3, zero;
458 __asm vec4_sne __retVal.w, f4, zero;
461 bvec4 __constructor(const bool b)
463 __asm vec4_move __retVal.xyzw, b;
466 bvec4 __constructor(const float f)
468 __asm vec4_sne __retVal.xyzw, f, 0.0;
471 bvec4 __constructor(const int i)
473 __asm vec4_sne __retVal.xyzw, i, 0.0;
476 bvec4 __constructor(const vec4 v)
478 __asm vec4_sne __retVal.xyzw, v, 0.0;
481 bvec4 __constructor(const ivec4 v)
483 __asm vec4_sne __retVal.xyzw, v, 0.0;
488 //// mat2 constructors
490 mat2 __constructor(const float m00, const float m10,
491 const float m01, const float m11)
499 mat2 __constructor(const float f)
507 mat2 __constructor(const int i)
509 return mat2(float(i));
512 mat2 __constructor(const bool b)
514 return mat2(float(b));
517 mat2 __constructor(const vec2 c0, const vec2 c1)
524 //// mat3 constructors
526 mat3 __constructor(const float m00, const float m10, const float m20,
527 const float m01, const float m11, const float m21,
528 const float m02, const float m12, const float m22)
541 mat3 __constructor(const float f)
543 vec2 v = vec2(f, 0.0);
549 mat3 __constructor(const int i)
551 return mat3(float(i));
554 mat3 __constructor(const bool b)
556 return mat3(float(b));
559 mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2)
567 //// mat4 constructors
569 mat4 __constructor(const float m00, const float m10, const float m20, const float m30,
570 const float m01, const float m11, const float m21, const float m31,
571 const float m02, const float m12, const float m22, const float m32,
572 const float m03, const float m13, const float m23, const float m33)
593 mat4 __constructor(const float f)
595 vec2 v = vec2(f, 0.0);
596 __retVal[0] = v.xyyy;
597 __retVal[1] = v.yxyy;
598 __retVal[2] = v.yyxy;
599 __retVal[3] = v.yyyx;
602 mat4 __constructor(const int i)
604 return mat4(float(i));
607 mat4 __constructor(const bool b)
609 return mat4(float(b));
612 mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3)
622 //// Basic int operators
624 int __operator + (const int a, const int b)
626 __asm vec4_add __retVal, a, b;
629 int __operator - (const int a, const int b)
631 __asm vec4_subtract __retVal, a, b;
634 int __operator * (const int a, const int b)
636 __asm vec4_multiply __retVal, a, b;
639 int __operator / (const int a, const int b)
642 __asm float_rcp bInv, b;
643 __asm vec4_multiply x, a, bInv;
644 __asm vec4_to_ivec4 __retVal, x;
648 //// Basic ivec2 operators
650 ivec2 __operator + (const ivec2 a, const ivec2 b)
652 __asm vec4_add __retVal, a, b;
655 ivec2 __operator - (const ivec2 a, const ivec2 b)
657 __asm vec4_subtract __retVal, a, b;
660 ivec2 __operator * (const ivec2 a, const ivec2 b)
662 __asm vec4_multiply __retVal, a, b;
665 ivec2 __operator / (const ivec2 a, const ivec2 b)
668 __asm float_rcp bInv.x, b.x;
669 __asm float_rcp bInv.y, b.y;
670 __asm vec4_multiply x, a, bInv;
671 __asm vec4_to_ivec4 __retVal, x;
675 //// Basic ivec3 operators
677 ivec3 __operator + (const ivec3 a, const ivec3 b)
679 __asm vec4_add __retVal, a, b;
682 ivec3 __operator - (const ivec3 a, const ivec3 b)
684 __asm vec4_subtract __retVal, a, b;
687 ivec3 __operator * (const ivec3 a, const ivec3 b)
689 __asm vec4_multiply __retVal, a, b;
692 ivec3 __operator / (const ivec3 a, const ivec3 b)
695 __asm float_rcp bInv.x, b.x;
696 __asm float_rcp bInv.y, b.y;
697 __asm float_rcp bInv.z, b.z;
698 __asm vec4_multiply x, a, bInv;
699 __asm vec4_to_ivec4 __retVal, x;
703 //// Basic ivec4 operators
705 ivec4 __operator + (const ivec4 a, const ivec4 b)
707 __asm vec4_add __retVal, a, b;
710 ivec4 __operator - (const ivec4 a, const ivec4 b)
712 __asm vec4_subtract __retVal, a, b;
715 ivec4 __operator * (const ivec4 a, const ivec4 b)
717 __asm vec4_multiply __retVal, a, b;
720 ivec4 __operator / (const ivec4 a, const ivec4 b)
723 __asm float_rcp bInv.x, b.x;
724 __asm float_rcp bInv.y, b.y;
725 __asm float_rcp bInv.z, b.z;
726 __asm float_rcp bInv.w, b.w;
727 __asm vec4_multiply x, a, bInv;
728 __asm vec4_to_ivec4 __retVal, x;
732 //// Basic float operators
734 float __operator + (const float a, const float b)
736 __asm vec4_add __retVal, a, b;
739 float __operator - (const float a, const float b)
741 __asm vec4_subtract __retVal, a, b;
744 float __operator * (const float a, const float b)
746 __asm vec4_multiply __retVal, a, b;
749 float __operator / (const float a, const float b)
752 __asm float_rcp bInv.x, b;
753 __asm vec4_multiply __retVal, a, bInv;
757 //// Basic vec2 operators
759 vec2 __operator + (const vec2 v, const vec2 u)
761 __asm vec4_add __retVal.xy, v, u;
764 vec2 __operator - (const vec2 v, const vec2 u)
766 __asm vec4_subtract __retVal.xy, v, u;
769 vec2 __operator * (const vec2 v, const vec2 u)
771 __asm vec4_multiply __retVal.xy, v, u;
774 vec2 __operator / (const vec2 v, const vec2 u)
777 __asm float_rcp w.x, u.x;
778 __asm float_rcp w.y, u.y;
779 __asm vec4_multiply __retVal.xy, v, w;
783 //// Basic vec3 operators
785 vec3 __operator + (const vec3 v, const vec3 u)
787 __asm vec4_add __retVal.xyz, v, u;
790 vec3 __operator - (const vec3 v, const vec3 u)
792 __asm vec4_subtract __retVal.xyz, v, u;
795 vec3 __operator * (const vec3 v, const vec3 u)
797 __asm vec4_multiply __retVal.xyz, v, u;
800 vec3 __operator / (const vec3 v, const vec3 u)
803 __asm float_rcp w.x, u.x;
804 __asm float_rcp w.y, u.y;
805 __asm float_rcp w.z, u.z;
806 __asm vec4_multiply __retVal.xyz, v, w;
810 //// Basic vec4 operators
812 vec4 __operator + (const vec4 v, const vec4 u)
814 __asm vec4_add __retVal, v, u;
817 vec4 __operator - (const vec4 v, const vec4 u)
819 __asm vec4_subtract __retVal, v, u;
822 vec4 __operator * (const vec4 v, const vec4 u)
824 __asm vec4_multiply __retVal, v, u;
827 vec4 __operator / (const vec4 v, const vec4 u)
830 __asm float_rcp w.x, u.x;
831 __asm float_rcp w.y, u.y;
832 __asm float_rcp w.z, u.z;
833 __asm float_rcp w.w, u.w;
834 __asm vec4_multiply __retVal, v, w;
840 //// Basic vec2/float operators
842 vec2 __operator + (const float a, const vec2 u)
844 __asm vec4_add __retVal.xy, a, u.xy;
847 vec2 __operator + (const vec2 v, const float b)
849 __asm vec4_add __retVal.xy, v.xy, b;
852 vec2 __operator - (const float a, const vec2 u)
854 __asm vec4_subtract __retVal.xy, a, u.xy;
857 vec2 __operator - (const vec2 v, const float b)
859 __asm vec4_subtract __retVal.xy, v.xy, b;
862 vec2 __operator * (const float a, const vec2 u)
864 __asm vec4_multiply __retVal.xy, a, u.xy;
867 vec2 __operator * (const vec2 v, const float b)
869 __asm vec4_multiply __retVal.xy, v.xy, b;
872 vec2 __operator / (const float a, const vec2 u)
875 __asm float_rcp invU.x, u.x;
876 __asm float_rcp invU.y, u.y;
877 __asm vec4_multiply __retVal.xy, a, invU.xy;
880 vec2 __operator / (const vec2 v, const float b)
883 __asm float_rcp invB, b;
884 __asm vec4_multiply __retVal.xy, v.xy, invB;
888 //// Basic vec3/float operators
890 vec3 __operator + (const float a, const vec3 u)
892 __asm vec4_add __retVal.xyz, a, u.xyz;
895 vec3 __operator + (const vec3 v, const float b)
897 __asm vec4_add __retVal.xyz, v.xyz, b;
900 vec3 __operator - (const float a, const vec3 u)
902 __asm vec4_subtract __retVal.xyz, a, u.xyz;
905 vec3 __operator - (const vec3 v, const float b)
907 __asm vec4_subtract __retVal.xyz, v.xyz, b;
910 vec3 __operator * (const float a, const vec3 u)
912 __asm vec4_multiply __retVal.xyz, a, u.xyz;
915 vec3 __operator * (const vec3 v, const float b)
917 __asm vec4_multiply __retVal.xyz, v.xyz, b;
920 vec3 __operator / (const float a, const vec3 u)
923 __asm float_rcp invU.x, u.x;
924 __asm float_rcp invU.y, u.y;
925 __asm float_rcp invU.z, u.z;
926 __asm vec4_multiply __retVal.xyz, a, invU.xyz;
929 vec3 __operator / (const vec3 v, const float b)
932 __asm float_rcp invB, b;
933 __asm vec4_multiply __retVal.xyz, v.xyz, invB;
937 //// Basic vec4/float operators
939 vec4 __operator + (const float a, const vec4 u)
941 __asm vec4_add __retVal, a, u;
944 vec4 __operator + (const vec4 v, const float b)
946 __asm vec4_add __retVal, v, b;
949 vec4 __operator - (const float a, const vec4 u)
951 __asm vec4_subtract __retVal, a, u;
954 vec4 __operator - (const vec4 v, const float b)
956 __asm vec4_subtract __retVal, v, b;
959 vec4 __operator * (const float a, const vec4 u)
961 __asm vec4_multiply __retVal, a, u;
964 vec4 __operator * (const vec4 v, const float b)
966 __asm vec4_multiply __retVal, v, b;
969 vec4 __operator / (const float a, const vec4 u)
972 __asm float_rcp invU.x, u.x;
973 __asm float_rcp invU.y, u.y;
974 __asm float_rcp invU.z, u.z;
975 __asm float_rcp invU.w, u.w;
976 __asm vec4_multiply __retVal, a, invU;
979 vec4 __operator / (const vec4 v, const float b)
982 __asm float_rcp invB, b;
983 __asm vec4_multiply __retVal, v, invB;
988 //// Basic ivec2/int operators
990 ivec2 __operator + (const int a, const ivec2 u)
992 __retVal = ivec2(a) + u;
995 ivec2 __operator + (const ivec2 v, const int b)
997 __retVal = v + ivec2(b);
1000 ivec2 __operator - (const int a, const ivec2 u)
1002 __retVal = ivec2(a) - u;
1005 ivec2 __operator - (const ivec2 v, const int b)
1007 __retVal = v - ivec2(b);
1010 ivec2 __operator * (const int a, const ivec2 u)
1012 __retVal = ivec2(a) * u;
1015 ivec2 __operator * (const ivec2 v, const int b)
1017 __retVal = v * ivec2(b);
1020 ivec2 __operator / (const int a, const ivec2 u)
1022 __retVal = ivec2(a) / u;
1025 ivec2 __operator / (const ivec2 v, const int b)
1027 __retVal = v / ivec2(b);
1031 //// Basic ivec3/int operators
1033 ivec3 __operator + (const int a, const ivec3 u)
1035 __retVal = ivec3(a) + u;
1038 ivec3 __operator + (const ivec3 v, const int b)
1040 __retVal = v + ivec3(b);
1043 ivec3 __operator - (const int a, const ivec3 u)
1045 __retVal = ivec3(a) - u;
1048 ivec3 __operator - (const ivec3 v, const int b)
1050 __retVal = v - ivec3(b);
1053 ivec3 __operator * (const int a, const ivec3 u)
1055 __retVal = ivec3(a) * u;
1058 ivec3 __operator * (const ivec3 v, const int b)
1060 __retVal = v * ivec3(b);
1063 ivec3 __operator / (const int a, const ivec3 u)
1065 __retVal = ivec3(a) / u;
1068 ivec3 __operator / (const ivec3 v, const int b)
1070 __retVal = v / ivec3(b);
1074 //// Basic ivec4/int operators
1076 ivec4 __operator + (const int a, const ivec4 u)
1078 __retVal = ivec4(a) + u;
1081 ivec4 __operator + (const ivec4 v, const int b)
1083 __retVal = v + ivec4(b);
1086 ivec4 __operator - (const int a, const ivec4 u)
1088 __retVal = ivec4(a) - u;
1091 ivec4 __operator - (const ivec4 v, const int b)
1093 __retVal = v - ivec4(b);
1096 ivec4 __operator * (const int a, const ivec4 u)
1098 __retVal = ivec4(a) * u;
1101 ivec4 __operator * (const ivec4 v, const int b)
1103 __retVal = v * ivec4(b);
1106 ivec4 __operator / (const int a, const ivec4 u)
1108 __retVal = ivec4(a) / u;
1111 ivec4 __operator / (const ivec4 v, const int b)
1113 __retVal = v / ivec4(b);
1119 //// Unary negation operator
1121 int __operator - (const int a)
1123 __asm vec4_negate __retVal.x, a;
1126 ivec2 __operator - (const ivec2 v)
1128 __asm vec4_negate __retVal, v;
1131 ivec3 __operator - (const ivec3 v)
1133 __asm vec4_negate __retVal, v;
1136 ivec4 __operator - (const ivec4 v)
1138 __asm vec4_negate __retVal, v;
1141 float __operator - (const float a)
1143 __asm vec4_negate __retVal.x, a;
1146 vec2 __operator - (const vec2 v)
1148 __asm vec4_negate __retVal.xy, v.xy;
1151 vec3 __operator - (const vec3 v)
1153 __asm vec4_negate __retVal.xyz, v.xyz;
1156 vec4 __operator - (const vec4 v)
1158 __asm vec4_negate __retVal, v;
1161 mat2 __operator - (const mat2 m)
1163 __retVal[0] = -m[0];
1164 __retVal[1] = -m[1];
1167 mat3 __operator - (const mat3 m)
1169 __retVal[0] = -m[0];
1170 __retVal[1] = -m[1];
1171 __retVal[2] = -m[2];
1174 mat4 __operator - (const mat4 m)
1176 __retVal[0] = -m[0];
1177 __retVal[1] = -m[1];
1178 __retVal[2] = -m[2];
1179 __retVal[3] = -m[3];
1186 float dot(const float a, const float b)
1191 float dot(const vec2 a, const vec2 b)
1193 __retVal = a.x * b.x + a.y * b.y;
1196 float dot(const vec3 a, const vec3 b)
1198 __asm vec3_dot __retVal, a, b;
1201 float dot(const vec4 a, const vec4 b)
1203 __asm vec4_dot __retVal, a, b;
1208 //// int assignment operators
1210 void __operator += (inout int a, const int b)
1212 __asm vec4_add a, a, b;
1215 void __operator -= (inout int a, const int b)
1217 __asm vec4_subtract a, a, b;
1220 void __operator *= (inout int a, const int b)
1222 __asm vec4_multiply a, a, b;
1225 void __operator /= (inout int a, const int b)
1228 __asm float_rcp invB, b;
1229 __asm vec4_multiply a, a, invB;
1230 __asm vec4_to_ivec4 a, a;
1234 //// ivec2 assignment operators
1236 void __operator += (inout ivec2 v, const ivec2 u)
1238 __asm vec4_add v, v, u;
1241 void __operator -= (inout ivec2 v, const ivec2 u)
1243 __asm vec4_subtract v, v, u;
1246 void __operator *= (inout ivec2 v, const ivec2 u)
1248 __asm vec4_multiply v, v, u;
1251 void __operator /= (inout ivec2 v, const ivec2 u)
1254 __asm float_rcp inv.x, u.x;
1255 __asm float_rcp inv.y, u.y;
1256 __asm vec4_multiply z, v, inv;
1257 __asm vec4_to_ivec4 v, z;
1261 //// ivec3 assignment operators
1263 void __operator += (inout ivec3 v, const ivec3 u)
1265 __asm vec4_add v, v, u;
1268 void __operator -= (inout ivec3 v, const ivec3 u)
1270 __asm vec4_subtract v, v, u;
1273 void __operator *= (inout ivec3 v, const ivec3 u)
1275 __asm vec4_multiply v, v, u;
1278 void __operator /= (inout ivec3 v, const ivec3 u)
1281 __asm float_rcp inv.x, u.x;
1282 __asm float_rcp inv.y, u.y;
1283 __asm vec4_multiply z, v, inv;
1284 __asm vec4_to_ivec4 v, z;
1288 //// ivec4 assignment operators
1290 void __operator += (inout ivec4 v, const ivec4 u)
1292 __asm vec4_add v, v, u;
1295 void __operator -= (inout ivec4 v, const ivec4 u)
1297 __asm vec4_subtract v, v, u;
1300 void __operator *= (inout ivec4 v, const ivec4 u)
1302 __asm vec4_multiply v, v, u;
1305 void __operator /= (inout ivec4 v, const ivec4 u)
1308 __asm float_rcp inv.x, u.x;
1309 __asm float_rcp inv.y, u.y;
1310 __asm vec4_multiply z, v, inv;
1311 __asm vec4_to_ivec4 v, z;
1315 //// float assignment operators
1317 void __operator += (inout float a, const float b)
1319 __asm vec4_add a.x, a.x, b.x;
1322 void __operator -= (inout float a, const float b)
1324 __asm vec4_subtract a.x, a, b;
1327 void __operator *= (inout float a, const float b)
1329 __asm vec4_multiply a.x, a, b;
1332 void __operator /= (inout float a, const float b)
1335 __asm float_rcp w.x, b;
1336 __asm vec4_multiply a.x, a, w;
1340 //// vec2 assignment operators
1342 void __operator += (inout vec2 v, const vec2 u)
1344 __asm vec4_add v.xy, v.xy, u.xy;
1347 void __operator -= (inout vec2 v, const vec2 u)
1349 __asm vec4_subtract v.xy, v.xy, u.xy;
1352 void __operator *= (inout vec2 v, const vec2 u)
1354 __asm vec4_multiply v.xy, v.xy, u.xy;
1357 void __operator /= (inout vec2 v, const vec2 u)
1360 __asm float_rcp w.x, u.x;
1361 __asm float_rcp w.y, u.y;
1362 __asm vec4_multiply v.xy, v.xy, w.xy;
1366 //// vec3 assignment operators
1368 void __operator += (inout vec3 v, const vec3 u)
1370 __asm vec4_add v.xyz, v, u;
1373 void __operator -= (inout vec3 v, const vec3 u)
1375 __asm vec4_subtract v.xyz, v, u;
1378 void __operator *= (inout vec3 v, const vec3 u)
1380 __asm vec4_multiply v.xyz, v, u;
1383 void __operator /= (inout vec3 v, const vec3 u)
1386 __asm float_rcp w.x, u.x;
1387 __asm float_rcp w.y, u.y;
1388 __asm float_rcp w.z, u.z;
1389 __asm vec4_multiply v.xyz, v.xyz, w.xyz;
1393 //// vec4 assignment operators
1395 void __operator += (inout vec4 v, const vec4 u)
1397 __asm vec4_add v, v, u;
1400 void __operator -= (inout vec4 v, const vec4 u)
1402 __asm vec4_subtract v, v, u;
1405 void __operator *= (inout vec4 v, const vec4 u)
1407 __asm vec4_multiply v, v, u;
1410 void __operator /= (inout vec4 v, const vec4 u)
1413 __asm float_rcp w.x, u.x;
1414 __asm float_rcp w.y, u.y;
1415 __asm float_rcp w.z, u.z;
1416 __asm float_rcp w.w, u.w;
1417 __asm vec4_multiply v, v, w;
1422 //// ivec2/int assignment operators
1424 void __operator += (inout ivec2 v, const int a)
1426 __asm vec4_add v.xy, v.xy, a;
1429 void __operator -= (inout ivec2 v, const int a)
1431 __asm vec4_subtract v.xy, v.xy, a;
1434 void __operator *= (inout ivec2 v, const int a)
1436 __asm vec4_multiply v.xy, v.xy, a;
1441 void __operator /= (inout ivec2 v, const int a)
1449 //// ivec3/int assignment operators
1451 void __operator += (inout ivec3 v, const int a)
1453 __asm vec4_add v.xyz, v.xyz, a;
1456 void __operator -= (inout ivec3 v, const int a)
1458 __asm vec4_subtract v.xyz, v.xyz, a;
1461 void __operator *= (inout ivec3 v, const int a)
1463 __asm vec4_multiply v.xyz, v.xyz, a;
1466 void __operator /= (inout ivec3 v, const int a)
1475 //// ivec4/int assignment operators
1477 void __operator += (inout ivec4 v, const int a)
1479 __asm vec4_add v, v, a;
1482 void __operator -= (inout ivec4 v, const int a)
1484 __asm vec4_subtract v, v, a;
1487 void __operator *= (inout ivec4 v, const int a)
1489 __asm vec4_multiply v, v, a;
1492 void __operator /= (inout ivec4 v, const int a)
1502 //// vec2/float assignment operators
1504 void __operator += (inout vec2 v, const float a)
1506 __asm vec4_add v.xy, v, a;
1509 void __operator -= (inout vec2 v, const float a)
1511 __asm vec4_subtract v.xy, v, a;
1514 void __operator *= (inout vec2 v, const float a)
1516 __asm vec4_multiply v.xy, v, a;
1519 void __operator /= (inout vec2 v, const float a)
1522 __asm float_rcp invA, a;
1523 __asm vec4_multiply v.xy, v.xy, invA;
1527 //// vec3/float assignment operators
1529 void __operator += (inout vec3 v, const float a)
1531 __asm vec4_add v.xyz, v, a;
1534 void __operator -= (inout vec3 v, const float a)
1536 __asm vec4_subtract v.xyz, v, a;
1539 void __operator *= (inout vec3 v, const float a)
1541 __asm vec4_multiply v.xyz, v, a;
1544 void __operator /= (inout vec3 v, const float a)
1547 __asm float_rcp invA, a;
1548 __asm vec4_multiply v.xyz, v.xyz, invA;
1552 //// vec4/float assignment operators
1554 void __operator += (inout vec4 v, const float a)
1556 __asm vec4_add v, v, a;
1559 void __operator -= (inout vec4 v, const float a)
1561 __asm vec4_subtract v, v, a;
1564 void __operator *= (inout vec4 v, const float a)
1566 __asm vec4_multiply v, v, a;
1569 void __operator /= (inout vec4 v, const float a)
1572 __asm float_rcp invA, a;
1573 __asm vec4_multiply v, v, invA;
1580 //// Basic mat2 operations
1582 mat2 __operator + (const mat2 m, const mat2 n)
1584 __retVal[0] = m[0] + n[0];
1585 __retVal[1] = m[1] + n[1];
1588 mat2 __operator - (const mat2 m, const mat2 n)
1590 __retVal[0] = m[0] - n[0];
1591 __retVal[1] = m[1] - n[1];
1594 mat2 __operator * (const mat2 m, const mat2 n)
1596 __retVal[0] = m[0] * n[0].xx + m[1] * n[0].yy;
1597 __retVal[1] = m[0] * n[1].xx + m[1] * n[1].yy;
1600 mat2 __operator / (const mat2 m, const mat2 n)
1602 __retVal[0] = m[0] / n[0];
1603 __retVal[1] = m[1] / n[1];
1607 //// Basic mat3 operations
1609 mat3 __operator + (const mat3 m, const mat3 n)
1611 __retVal[0] = m[0] + n[0];
1612 __retVal[1] = m[1] + n[1];
1613 __retVal[2] = m[2] + n[2];
1616 mat3 __operator - (const mat3 m, const mat3 n)
1618 __retVal[0] = m[0] - n[0];
1619 __retVal[1] = m[1] - n[1];
1620 __retVal[2] = m[2] - n[2];
1623 mat3 __operator * (const mat3 m, const mat3 n)
1625 __retVal[0] = m[0] * n[0].xxx + m[1] * n[0].yyy + m[2] * n[0].zzz;
1626 __retVal[1] = m[0] * n[1].xxx + m[1] * n[1].yyy + m[2] * n[1].zzz;
1627 __retVal[2] = m[0] * n[2].xxx + m[1] * n[2].yyy + m[2] * n[2].zzz;
1630 mat3 __operator / (const mat3 m, const mat3 n)
1632 __retVal[0] = m[0] / n[0];
1633 __retVal[1] = m[1] / n[1];
1634 __retVal[2] = m[2] / n[2];
1638 //// Basic mat4 operations
1640 mat4 __operator + (const mat4 m, const mat4 n)
1642 __retVal[0] = m[0] + n[0];
1643 __retVal[1] = m[1] + n[1];
1644 __retVal[2] = m[2] + n[2];
1645 __retVal[3] = m[3] + n[3];
1648 mat4 __operator - (const mat4 m, const mat4 n)
1650 __retVal[0] = m[0] - n[0];
1651 __retVal[1] = m[1] - n[1];
1652 __retVal[2] = m[2] - n[2];
1653 __retVal[3] = m[3] - n[3];
1656 mat4 __operator * (const mat4 m, const mat4 n)
1658 __retVal[0] = m[0] * n[0].xxxx + m[1] * n[0].yyyy + m[2] * n[0].zzzz + m[3] * n[0].wwww;
1659 __retVal[1] = m[0] * n[1].xxxx + m[1] * n[1].yyyy + m[2] * n[1].zzzz + m[3] * n[1].wwww;
1660 __retVal[2] = m[0] * n[2].xxxx + m[1] * n[2].yyyy + m[2] * n[2].zzzz + m[3] * n[2].wwww;
1661 __retVal[3] = m[0] * n[3].xxxx + m[1] * n[3].yyyy + m[2] * n[3].zzzz + m[3] * n[3].wwww;
1664 mat4 __operator / (const mat4 m, const mat4 n)
1666 __retVal[0] = m[0] / n[0];
1667 __retVal[1] = m[1] / n[1];
1668 __retVal[2] = m[2] / n[2];
1669 __retVal[3] = m[3] / n[3];
1673 //// mat2/float operations
1675 mat2 __operator + (const float a, const mat2 n)
1677 __retVal[0] = a + n[0];
1678 __retVal[1] = a + n[1];
1681 mat2 __operator + (const mat2 m, const float b)
1683 __retVal[0] = m[0] + b;
1684 __retVal[1] = m[1] + b;
1687 mat2 __operator - (const float a, const mat2 n)
1689 __retVal[0] = a - n[0];
1690 __retVal[1] = a - n[1];
1693 mat2 __operator - (const mat2 m, const float b)
1695 __retVal[0] = m[0] - b;
1696 __retVal[1] = m[1] - b;
1699 mat2 __operator * (const float a, const mat2 n)
1701 __retVal[0] = a * n[0];
1702 __retVal[1] = a * n[1];
1705 mat2 __operator * (const mat2 m, const float b)
1707 __retVal[0] = m[0] * b;
1708 __retVal[1] = m[1] * b;
1711 mat2 __operator / (const float a, const mat2 n)
1713 __retVal[0] = a / n[0];
1714 __retVal[1] = a / n[1];
1717 mat2 __operator / (const mat2 m, const float b)
1719 __retVal[0] = m[0] / b;
1720 __retVal[1] = m[1] / b;
1724 //// mat3/float operations
1726 mat3 __operator + (const float a, const mat3 n)
1728 __retVal[0] = a + n[0];
1729 __retVal[1] = a + n[1];
1730 __retVal[2] = a + n[2];
1733 mat3 __operator + (const mat3 m, const float b)
1735 __retVal[0] = m[0] + b;
1736 __retVal[1] = m[1] + b;
1737 __retVal[2] = m[2] + b;
1740 mat3 __operator - (const float a, const mat3 n)
1742 __retVal[0] = a - n[0];
1743 __retVal[1] = a - n[1];
1744 __retVal[2] = a - n[2];
1747 mat3 __operator - (const mat3 m, const float b)
1749 __retVal[0] = m[0] - b;
1750 __retVal[1] = m[1] - b;
1751 __retVal[2] = m[2] - b;
1754 mat3 __operator * (const float a, const mat3 n)
1756 __retVal[0] = a * n[0];
1757 __retVal[1] = a * n[1];
1758 __retVal[2] = a * n[2];
1761 mat3 __operator * (const mat3 m, const float b)
1763 __retVal[0] = m[0] * b;
1764 __retVal[1] = m[1] * b;
1765 __retVal[2] = m[2] * b;
1768 mat3 __operator / (const float a, const mat3 n)
1770 __retVal[0] = a / n[0];
1771 __retVal[1] = a / n[1];
1772 __retVal[2] = a / n[2];
1775 mat3 __operator / (const mat3 m, const float b)
1777 __retVal[0] = m[0] / b;
1778 __retVal[1] = m[1] / b;
1779 __retVal[2] = m[2] / b;
1783 //// mat4/float operations
1785 mat4 __operator + (const float a, const mat4 n)
1787 __retVal[0] = a + n[0];
1788 __retVal[1] = a + n[1];
1789 __retVal[2] = a + n[2];
1790 __retVal[3] = a + n[3];
1793 mat4 __operator + (const mat4 m, const float b)
1795 __retVal[0] = m[0] + b;
1796 __retVal[1] = m[1] + b;
1797 __retVal[2] = m[2] + b;
1798 __retVal[3] = m[3] + b;
1801 mat4 __operator - (const float a, const mat4 n)
1803 __retVal[0] = a - n[0];
1804 __retVal[1] = a - n[1];
1805 __retVal[2] = a - n[2];
1806 __retVal[3] = a - n[3];
1809 mat4 __operator - (const mat4 m, const float b)
1811 __retVal[0] = m[0] - b;
1812 __retVal[1] = m[1] - b;
1813 __retVal[2] = m[2] - b;
1814 __retVal[3] = m[3] - b;
1817 mat4 __operator * (const float a, const mat4 n)
1819 __retVal[0] = a * n[0];
1820 __retVal[1] = a * n[1];
1821 __retVal[2] = a * n[2];
1822 __retVal[3] = a * n[3];
1825 mat4 __operator * (const mat4 m, const float b)
1827 __retVal[0] = m[0] * b;
1828 __retVal[1] = m[1] * b;
1829 __retVal[2] = m[2] * b;
1830 __retVal[3] = m[3] * b;
1833 mat4 __operator / (const float a, const mat4 n)
1835 __retVal[0] = a / n[0];
1836 __retVal[1] = a / n[1];
1837 __retVal[2] = a / n[2];
1838 __retVal[3] = a / n[3];
1841 mat4 __operator / (const mat4 m, const float b)
1843 __retVal[0] = m[0] / b;
1844 __retVal[1] = m[1] / b;
1845 __retVal[2] = m[2] / b;
1846 __retVal[3] = m[3] / b;
1851 //// matrix / vector products
1853 vec2 __operator * (const mat2 m, const vec2 v)
1855 __retVal = m[0] * v.xx
1859 vec2 __operator * (const vec2 v, const mat2 m)
1861 __retVal.x = dot(v, m[0]);
1862 __retVal.y = dot(v, m[1]);
1865 vec3 __operator * (const mat3 m, const vec3 v)
1867 __retVal = m[0] * v.xxx
1872 vec3 __operator * (const vec3 v, const mat3 m)
1874 __retVal.x = dot(v, m[0]);
1875 __retVal.y = dot(v, m[1]);
1876 __retVal.z = dot(v, m[2]);
1879 vec4 __operator * (const mat4 m, const vec4 v)
1881 __retVal = m[0] * v.xxxx
1887 vec4 __operator * (const vec4 v, const mat4 m)
1889 __retVal.x = dot(v, m[0]);
1890 __retVal.y = dot(v, m[1]);
1891 __retVal.z = dot(v, m[2]);
1892 __retVal.w = dot(v, m[3]);
1897 //// mat2 assignment operators
1899 void __operator += (inout mat2 m, const mat2 n)
1905 void __operator -= (inout mat2 m, const mat2 n)
1911 void __operator *= (inout mat2 m, const mat2 n)
1916 void __operator /= (inout mat2 m, const mat2 n)
1923 //// mat3 assignment operators
1925 void __operator += (inout mat3 m, const mat3 n)
1932 void __operator -= (inout mat3 m, const mat3 n)
1939 void __operator *= (inout mat3 m, const mat3 n)
1944 void __operator /= (inout mat3 m, const mat3 n)
1952 // mat4 assignment operators
1954 void __operator += (inout mat4 m, const mat4 n)
1962 void __operator -= (inout mat4 m, const mat4 n) {
1969 void __operator *= (inout mat4 m, const mat4 n)
1974 void __operator /= (inout mat4 m, const mat4 n)
1983 //// mat2/float assignment operators
1985 void __operator += (inout mat2 m, const float a) {
1990 void __operator -= (inout mat2 m, const float a) {
1995 void __operator *= (inout mat2 m, const float a) {
2000 void __operator /= (inout mat2 m, const float a) {
2006 //// mat3/float assignment operators
2008 void __operator += (inout mat3 m, const float a) {
2014 void __operator -= (inout mat3 m, const float a) {
2020 void __operator *= (inout mat3 m, const float a) {
2026 void __operator /= (inout mat3 m, const float a) {
2033 //// mat4/float assignment operators
2035 void __operator += (inout mat4 m, const float a) {
2042 void __operator -= (inout mat4 m, const float a) {
2049 void __operator *= (inout mat4 m, const float a) {
2056 void __operator /= (inout mat4 m, const float a) {
2065 //// vec/mat assignment operators
2067 void __operator *= (inout vec2 v, const mat2 m)
2072 void __operator *= (inout vec3 v, const mat3 m)
2077 void __operator *= (inout vec4 v, const mat4 m)
2084 //// pre-decrement operators
2086 int __operator --(inout int a)
2092 ivec2 __operator --(inout ivec2 v)
2098 ivec3 __operator --(inout ivec3 v)
2104 ivec4 __operator --(inout ivec4 v)
2111 float __operator --(inout float a)
2117 vec2 __operator --(inout vec2 v)
2123 vec3 __operator --(inout vec3 v)
2129 vec4 __operator --(inout vec4 v)
2136 mat2 __operator --(inout mat2 m)
2138 m[0] = m[0] - vec2(1.0);
2139 m[1] = m[1] - vec2(1.0);
2143 mat3 __operator --(inout mat3 m)
2145 m[0] = m[0] - vec3(1.0);
2146 m[1] = m[1] - vec3(1.0);
2147 m[2] = m[2] - vec3(1.0);
2151 mat4 __operator --(inout mat4 m)
2153 m[0] = m[0] - vec4(1.0);
2154 m[1] = m[1] - vec4(1.0);
2155 m[2] = m[2] - vec4(1.0);
2156 m[3] = m[3] - vec4(1.0);
2161 //// pre-increment operators
2163 int __operator ++(inout int a)
2169 ivec2 __operator ++(inout ivec2 v)
2175 ivec3 __operator ++(inout ivec3 v)
2181 ivec4 __operator ++(inout ivec4 v)
2188 float __operator ++(inout float a)
2194 vec2 __operator ++(inout vec2 v)
2200 vec3 __operator ++(inout vec3 v)
2206 vec4 __operator ++(inout vec4 v)
2213 mat2 __operator ++(inout mat2 m)
2215 m[0] = m[0] + vec2(1.0);
2216 m[1] = m[1] + vec2(1.0);
2220 mat3 __operator ++(inout mat3 m)
2222 m[0] = m[0] + vec3(1.0);
2223 m[1] = m[1] + vec3(1.0);
2224 m[2] = m[2] + vec3(1.0);
2228 mat4 __operator ++(inout mat4 m)
2230 m[0] = m[0] + vec4(1.0);
2231 m[1] = m[1] + vec4(1.0);
2232 m[2] = m[2] + vec4(1.0);
2233 m[3] = m[3] + vec4(1.0);
2241 int __postDecr(inout int a)
2247 ivec2 __postDecr(inout ivec2 v)
2253 ivec3 __postDecr(inout ivec3 v)
2259 ivec4 __postDecr(inout ivec4 v)
2266 float __postDecr(inout float a)
2272 vec2 __postDecr(inout vec2 v)
2278 vec3 __postDecr(inout vec3 v)
2284 vec4 __postDecr(inout vec4 v)
2291 mat2 __postDecr(inout mat2 m)
2294 m[0] = m[0] - vec2(1.0);
2295 m[1] = m[1] - vec2(1.0);
2298 mat3 __postDecr(inout mat3 m)
2301 m[0] = m[0] - vec3(1.0);
2302 m[1] = m[1] - vec3(1.0);
2303 m[2] = m[2] - vec3(1.0);
2306 mat4 __postDecr(inout mat4 m)
2309 m[0] = m[0] - vec4(1.0);
2310 m[1] = m[1] - vec4(1.0);
2311 m[2] = m[2] - vec4(1.0);
2312 m[3] = m[3] - vec4(1.0);
2318 float __postIncr(inout float a)
2324 vec2 __postIncr(inout vec2 v)
2330 vec3 __postIncr(inout vec3 v)
2336 vec4 __postIncr(inout vec4 v)
2343 int __postIncr(inout int a)
2349 ivec2 __postIncr(inout ivec2 v)
2355 ivec3 __postIncr(inout ivec3 v)
2361 ivec4 __postIncr(inout ivec4 v)
2368 mat2 __postIncr(inout mat2 m)
2371 m[0] = m[0] + vec2(1.0);
2372 m[1] = m[1] + vec2(1.0);
2376 mat3 __postIncr(inout mat3 m)
2379 m[0] = m[0] + vec3(1.0);
2380 m[1] = m[1] + vec3(1.0);
2381 m[2] = m[2] + vec3(1.0);
2385 mat4 __postIncr(inout mat4 m)
2388 m[0] = m[0] + vec4(1.0);
2389 m[1] = m[1] + vec4(1.0);
2390 m[2] = m[2] + vec4(1.0);
2391 m[3] = m[3] + vec4(1.0);
2397 //// inequality operators
2400 // XXX are the inequality operators for floats/ints really needed????
2401 bool __operator < (const float a, const float b)
2403 __asm vec4_sgt __retVal.x, b, a;
2407 bool __operator < (const int a, const int b) {
2408 return float (a) < float (b);
2411 bool __operator > (const float a, const float b) {
2413 __asm float_less c, b, a;
2417 bool __operator > (const int a, const int b) {
2418 return float (a) > float (b);
2421 bool __operator >= (const float a, const float b) {
2423 __asm float_less g, b, a;
2424 __asm float_equal e, a, b;
2428 bool __operator >= (const int a, const int b) {
2429 return float (a) >= float (b);
2432 bool __operator <= (const float a, const float b) {
2434 __asm float_less g, a, b;
2435 __asm float_equal e, a, b;
2439 bool __operator <= (const int a, const int b) {
2440 return float (a) <= float (b);
2446 // MESA-specific extension functions.
2449 void printMESA (const float f) {
2450 __asm float_print f;
2453 void printMESA (const int i) {
2457 void printMESA (const bool b) {
2461 void printMESA (const vec2 v) {
2466 void printMESA (const vec3 v) {
2472 void printMESA (const vec4 v) {
2479 void printMESA (const ivec2 v) {
2484 void printMESA (const ivec3 v) {
2490 void printMESA (const ivec4 v) {
2497 void printMESA (const bvec2 v) {
2502 void printMESA (const bvec3 v) {
2508 void printMESA (const bvec4 v) {
2515 void printMESA (const mat2 m) {
2520 void printMESA (const mat3 m) {
2526 void printMESA (const mat4 m) {
2533 void printMESA (const sampler1D e) {
2537 void printMESA (const sampler2D e) {
2541 void printMESA (const sampler3D e) {
2545 void printMESA (const samplerCube e) {
2549 void printMESA (const sampler1DShadow e) {
2553 void printMESA (const sampler2DShadow e) {