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_seq __retVal, i, zero;
119 bool __constructor(const float f)
121 const float zero = 0.0;
122 __asm vec4_seq __retVal, i, 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 vec3 v)
185 //// vec3 constructors
187 vec3 __constructor(const float x, const float y, const float z)
194 vec3 __constructor(const float f)
196 __retVal.xyz = f.xxx;
199 vec3 __constructor(const int i)
201 __asm int_to_float __retVal.xyz, i.xxx;
204 vec3 __constructor(const bool b)
206 __retVal.xyz = b.xxx;
209 vec3 __constructor(const vec4 v)
211 __retVal.xyz = v.xyz;
215 //// vec4 constructors
217 vec4 __constructor(const float x, const float y, const float z, const float w)
225 vec4 __constructor(const float f)
230 vec4 __constructor(const int i)
235 vec4 __constructor(const bool b)
240 vec4 __constructor(const vec3 v3, const float f)
242 // XXX this constructor shouldn't be needed anymore
248 //// ivec2 constructors
250 ivec2 __constructor(const int i, const int j)
256 ivec2 __constructor(const int i)
261 ivec2 __constructor(const float f)
263 __asm float_to_int __retVal.xy, f.xx;
266 ivec2 __constructor(const bool b)
268 __asm float_to_int __retVal.xy, b.xx;
272 //// ivec3 constructors
274 ivec3 __constructor(const int i, const int j, const int k)
281 ivec3 __constructor(const int i)
283 __retVal.xyz = i.xxx;
286 ivec3 __constructor(const float f)
288 __retVal.xyz = f.xxx;
291 ivec3 __constructor(const bool b)
293 __retVal.xyz = b.xxx;
297 //// ivec4 constructors
299 ivec4 __constructor(const int x, const int y, const int z, const int w)
307 ivec4 __constructor(const int i)
312 ivec4 __constructor(const float f)
314 __asm float_to_int __retVal, f.xxxx;
317 ivec4 __constructor(const bool b)
323 //// bvec2 constructors
325 bvec2 __constructor(const bool b1, const bool b2)
331 bvec2 __constructor(const bool b)
336 bvec2 __constructor(const float f)
338 const vec2 zero = vec2(0.0, 0.0);
339 __asm vec4_seq __retVal.xy, f.xx, zero;
342 bvec2 __constructor(const int i)
344 const ivec2 zero = ivec2(0, 0);
345 __asm vec4_seq __retVal.xy, i.xx, zero;
349 //// bvec3 constructors
351 bvec3 __constructor(const bool b1, const bool b2, const bool b3)
358 bvec3 __constructor(const bool b)
360 __retVal.xyz = b.xxx;
363 bvec3 __constructor(const float f)
365 const vec3 zero = vec3(0.0, 0.0, 0.0);
366 __asm vec4_seq __retVal.xyz, f.xxx, zero;
369 bvec3 __constructor(const int i)
371 const ivec3 zero = ivec3(0, 0, 0);
372 __asm vec4_seq __retVal.xyz, i.xxx, zero;
376 //// bvec4 constructors
378 bvec4 __constructor(const bool b1, const bool b2, const bool b3, const bool b4)
386 bvec4 __constructor(const bool b)
388 __retVal.xyzw = b.xxxx;
391 bvec4 __constructor(const float f)
393 const vec4 zero = vec4(0.0, 0.0, 0.0, 0.0);
394 __asm vec4_seq __retVal, f.xxxx, zero;
397 bvec4 __constructor(const int i)
399 const ivec4 zero = ivec4(0, 0, 0, 0);
400 __asm vec4_seq __retVal, i.xxxx, zero;
405 //// mat2 constructors
407 mat2 __constructor(const float m00, const float m10,
408 const float m01, const float m11)
416 mat2 __constructor(const float f)
424 mat2 __constructor(const int i)
426 return mat2(float(i));
429 mat2 __constructor(const bool b)
431 return mat2(float(b));
434 mat2 __constructor(const vec2 c0, const vec2 c1)
441 //// mat3 constructors
443 mat3 __constructor(const float m00, const float m10, const float m20,
444 const float m01, const float m11, const float m21,
445 const float m02, const float m12, const float m22)
458 mat3 __constructor(const float f)
460 vec2 v = vec2(f, 0.0);
466 mat3 __constructor(const int i)
468 return mat3(float(i));
471 mat3 __constructor(const bool b)
473 return mat3(float(b));
476 mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2)
484 //// mat4 constructors
486 mat4 __constructor(const float m00, const float m10, const float m20, const float m30,
487 const float m01, const float m11, const float m21, const float m31,
488 const float m02, const float m12, const float m22, const float m32,
489 const float m03, const float m13, const float m23, const float m33)
510 mat4 __constructor(const float f)
512 vec2 v = vec2(f, 0.0);
513 __retVal[0] = v.xyyy;
514 __retVal[1] = v.yxyy;
515 __retVal[2] = v.yyxy;
516 __retVal[3] = v.yyyx;
519 mat4 __constructor(const int i)
521 return mat4(float(i));
524 mat4 __constructor(const bool b)
526 return mat4(float(b));
529 mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3)
539 //// Basic int operators
541 int __operator + (const int a, const int b)
543 // XXX If we ever have int registers, we'll do something like this:
544 // XXX For now, mostly treat ints as floats.
546 // __asm int_to_float x, a;
547 // __asm int_to_float y, b;
548 // __asm vec4_add x.x, x.x, y.x;
549 // __asm float_to_int __retVal, x;
551 __asm vec4_add x, a, b;
552 __asm float_to_int __retVal, x;
555 int __operator - (const int a, const int b)
558 __asm vec4_subtract x, a, b;
559 __asm float_to_int __retVal, x;
562 int __operator * (const int a, const int b)
565 __asm vec4_multiply x, a, b;
566 __asm float_to_int __retVal, x;
569 int __operator / (const int a, const int b)
572 __asm float_rcp bInv, b;
573 __asm vec4_multiply x, a, bInv;
574 __asm float_to_int __retVal, x;
578 //// Basic ivec2 operators
580 ivec2 __operator + (const ivec2 a, const ivec2 b)
583 __asm vec4_add x, a, b;
584 __asm float_to_int __retVal, x;
587 ivec2 __operator - (const ivec2 a, const ivec2 b)
590 __asm vec4_subtract x, a, b;
591 __asm float_to_int __retVal, x;
594 ivec2 __operator * (const ivec2 a, const ivec2 b)
597 __asm vec4_multiply x, a, b;
598 __asm float_to_int __retVal, x;
601 ivec2 __operator / (const ivec2 a, const ivec2 b)
604 __asm float_rcp bInv.x, b.x;
605 __asm float_rcp bInv.y, b.y;
606 __asm vec4_multiply x, a, bInv;
607 __asm float_to_int __retVal, x;
611 //// Basic ivec3 operators
613 ivec3 __operator + (const ivec3 a, const ivec3 b)
616 __asm vec4_add x, a, b;
617 __asm float_to_int __retVal, x;
620 ivec3 __operator - (const ivec3 a, const ivec3 b)
623 __asm vec4_subtract x, a, b;
624 __asm float_to_int __retVal, x;
627 ivec3 __operator * (const ivec3 a, const ivec3 b)
630 __asm vec4_multiply x, a, b;
631 __asm float_to_int __retVal, x;
634 ivec3 __operator / (const ivec3 a, const ivec3 b)
637 __asm float_rcp bInv.x, b.x;
638 __asm float_rcp bInv.y, b.y;
639 __asm float_rcp bInv.z, b.z;
640 __asm vec4_multiply x, a, bInv;
641 __asm float_to_int __retVal, x;
645 //// Basic ivec4 operators
647 ivec4 __operator + (const ivec4 a, const ivec4 b)
650 __asm vec4_add x, a, b;
651 __asm float_to_int __retVal, x;
654 ivec4 __operator - (const ivec4 a, const ivec4 b)
657 __asm vec4_subtract x, a, b;
658 __asm float_to_int __retVal, x;
661 ivec4 __operator * (const ivec4 a, const ivec4 b)
664 __asm vec4_multiply x, a, b;
665 __asm float_to_int __retVal, x;
668 ivec4 __operator / (const ivec4 a, const ivec4 b)
671 __asm float_rcp bInv.x, b.x;
672 __asm float_rcp bInv.y, b.y;
673 __asm float_rcp bInv.z, b.z;
674 __asm float_rcp bInv.w, b.w;
675 __asm vec4_multiply x, a, bInv;
676 __asm float_to_int __retVal, x;
680 //// Basic float operators
682 float __operator + (const float a, const float b)
684 __asm vec4_add __retVal.x, a, b;
687 float __operator - (const float a, const float b)
689 __asm vec4_subtract __retVal.x, a, b;
692 float __operator * (const float a, const float b)
694 __asm vec4_multiply __retVal.x, a, b;
697 float __operator / (const float a, const float b)
700 __asm float_rcp bInv.x, b.x;
701 __asm vec4_multiply __retVal.x, a, bInv;
705 //// Basic vec2 operators
707 vec2 __operator + (const vec2 v, const vec2 u)
709 __asm vec4_add __retVal.xy, v, u;
712 vec2 __operator - (const vec2 v, const vec2 u)
714 __asm vec4_subtract __retVal.xy, v, u;
717 vec2 __operator * (const vec2 v, const vec2 u)
719 __asm vec4_multiply __retVal.xy, v, u;
722 vec2 __operator / (const vec2 v, const vec2 u)
725 __asm float_rcp w.x, u.x;
726 __asm float_rcp w.y, u.y;
727 __asm vec4_multiply __retVal.xy, v, w;
731 //// Basic vec3 operators
733 vec3 __operator + (const vec3 v, const vec3 u)
735 __asm vec4_add __retVal.xyz, v, u;
738 vec3 __operator - (const vec3 v, const vec3 u)
740 __asm vec4_subtract __retVal.xyz, v, u;
743 vec3 __operator * (const vec3 v, const vec3 u)
745 __asm vec4_multiply __retVal.xyz, v, u;
748 vec3 __operator / (const vec3 v, const vec3 u)
751 __asm float_rcp w.x, u.x;
752 __asm float_rcp w.y, u.y;
753 __asm float_rcp w.z, u.z;
754 __asm vec4_multiply __retVal.xyz, v, w;
758 //// Basic vec4 operators
760 vec4 __operator + (const vec4 v, const vec4 u)
762 __asm vec4_add __retVal, v, u;
765 vec4 __operator - (const vec4 v, const vec4 u)
767 __asm vec4_subtract __retVal, v, u;
770 vec4 __operator * (const vec4 v, const vec4 u)
772 __asm vec4_multiply __retVal, v, u;
775 vec4 __operator / (const vec4 v, const vec4 u)
778 __asm float_rcp w.x, u.x;
779 __asm float_rcp w.y, u.y;
780 __asm float_rcp w.z, u.z;
781 __asm float_rcp w.w, u.w;
782 __asm vec4_multiply __retVal, v, w;
788 //// Basic vec2/float operators
790 vec2 __operator + (const float a, const vec2 u)
792 __asm vec4_add __retVal.xy, a.xx, u.xy;
795 vec2 __operator + (const vec2 v, const float b)
797 __asm vec4_add __retVal.xy, v.xy, b.xx;
800 vec2 __operator - (const float a, const vec2 u)
802 __asm vec4_subtract __retVal.xy, a.xx, u.xy;
805 vec2 __operator - (const vec2 v, const float b)
807 __asm vec4_subtract __retVal.xy, v.xy, b.xx;
810 vec2 __operator * (const float a, const vec2 u)
812 __asm vec4_multiply __retVal.xy, a.xx, u.xy;
815 vec2 __operator * (const vec2 v, const float b)
817 __asm vec4_multiply __retVal.xy, v.xy, b.xx;
820 vec2 __operator / (const float a, const vec2 u)
823 __asm float_rcp invU.x, u.x;
824 __asm float_rcp invU.y, u.y;
825 __asm vec4_multiply __retVal.xy, a.xx, invU.xy;
828 vec2 __operator / (const vec2 v, const float b)
831 __asm float_rcp invB, b;
832 __asm vec4_multiply __retVal.xy, v.xy, invB.xx;
836 //// Basic vec3/float operators
838 vec3 __operator + (const float a, const vec3 u)
840 __asm vec4_add __retVal.xyz, a.xxx, u.xyz;
843 vec3 __operator + (const vec3 v, const float b)
845 __asm vec4_add __retVal.xyz, v.xyz, b.xxx;
848 vec3 __operator - (const float a, const vec3 u)
850 __asm vec4_subtract __retVal.xyz, a.xxx, u.xyz;
853 vec3 __operator - (const vec3 v, const float b)
855 __asm vec4_subtract __retVal.xyz, v.xyz, b.xxx;
858 vec3 __operator * (const float a, const vec3 u)
860 __asm vec4_multiply __retVal.xyz, a.xxx, u.xyz;
863 vec3 __operator * (const vec3 v, const float b)
865 __asm vec4_multiply __retVal.xyz, v.xyz, b.xxx;
868 vec3 __operator / (const float a, const vec3 u)
871 __asm float_rcp invU.x, u.x;
872 __asm float_rcp invU.y, u.y;
873 __asm float_rcp invU.z, u.z;
874 __asm vec4_multiply __retVal.xyz, a.xxx, invU.xyz;
877 vec3 __operator / (const vec3 v, const float b)
880 __asm float_rcp invB, b;
881 __asm vec4_multiply __retVal.xyz, v.xyz, invB.xxx;
885 //// Basic vec4/float operators
887 vec4 __operator + (const float a, const vec4 u)
889 __asm vec4_add __retVal, a.xxxx, u;
892 vec4 __operator + (const vec4 v, const float b)
894 __asm vec4_add __retVal, v, b.xxxx;
897 vec4 __operator - (const float a, const vec4 u)
899 __asm vec4_subtract __retVal, a.xxxx, u;
902 vec4 __operator - (const vec4 v, const float b)
904 __asm vec4_subtract __retVal, v, b.xxxx;
907 vec4 __operator * (const float a, const vec4 u)
909 __asm vec4_multiply __retVal, a.xxxx, u;
912 vec4 __operator * (const vec4 v, const float b)
914 __asm vec4_multiply __retVal, v, b.xxxx;
917 vec4 __operator / (const float a, const vec4 u)
920 __asm float_rcp invU.x, u.x;
921 __asm float_rcp invU.y, u.y;
922 __asm float_rcp invU.z, u.z;
923 __asm float_rcp invU.w, u.w;
924 __asm vec4_multiply __retVal, a.xxxx, invU;
927 vec4 __operator / (const vec4 v, const float b)
930 __asm float_rcp invB, b;
931 __asm vec4_multiply __retVal, v, invB.xxxx;
936 //// Basic ivec2/int operators
938 ivec2 __operator + (const int a, const ivec2 u)
940 __retVal = ivec2(a) + u;
943 ivec2 __operator + (const ivec2 v, const int b)
945 __retVal = v + ivec2(b);
948 ivec2 __operator - (const int a, const ivec2 u)
950 __retVal = ivec2(a) - u;
953 ivec2 __operator - (const ivec2 v, const int b)
955 __retVal = v - ivec2(b);
958 ivec2 __operator * (const int a, const ivec2 u)
960 __retVal = ivec2(a) * u;
963 ivec2 __operator * (const ivec2 v, const int b)
965 __retVal = v * ivec2(b);
968 ivec2 __operator / (const int a, const ivec2 u)
970 __retVal = ivec2(a) / u;
973 ivec2 __operator / (const ivec2 v, const int b)
975 __retVal = v / ivec2(b);
979 //// Basic ivec3/int operators
981 ivec3 __operator + (const int a, const ivec3 u)
983 __retVal = ivec3(a) + u;
986 ivec3 __operator + (const ivec3 v, const int b)
988 __retVal = v + ivec3(b);
991 ivec3 __operator - (const int a, const ivec3 u)
993 __retVal = ivec3(a) - u;
996 ivec3 __operator - (const ivec3 v, const int b)
998 __retVal = v - ivec3(b);
1001 ivec3 __operator * (const int a, const ivec3 u)
1003 __retVal = ivec3(a) * u;
1006 ivec3 __operator * (const ivec3 v, const int b)
1008 __retVal = v * ivec3(b);
1011 ivec3 __operator / (const int a, const ivec3 u)
1013 __retVal = ivec3(a) / u;
1016 ivec3 __operator / (const ivec3 v, const int b)
1018 __retVal = v / ivec3(b);
1022 //// Basic ivec4/int operators
1024 ivec4 __operator + (const int a, const ivec4 u)
1026 __retVal = ivec4(a) + u;
1029 ivec4 __operator + (const ivec4 v, const int b)
1031 __retVal = v + ivec4(b);
1034 ivec4 __operator - (const int a, const ivec4 u)
1036 __retVal = ivec4(a) - u;
1039 ivec4 __operator - (const ivec4 v, const int b)
1041 __retVal = v - ivec4(b);
1044 ivec4 __operator * (const int a, const ivec4 u)
1046 __retVal = ivec4(a) * u;
1049 ivec4 __operator * (const ivec4 v, const int b)
1051 __retVal = v * ivec4(b);
1054 ivec4 __operator / (const int a, const ivec4 u)
1056 __retVal = ivec4(a) / u;
1059 ivec4 __operator / (const ivec4 v, const int b)
1061 __retVal = v / ivec4(b);
1067 //// Unary negation operator
1069 int __operator - (const int a)
1071 __asm vec4_negate __retVal.x, a;
1074 ivec2 __operator - (const ivec2 v)
1076 __asm vec4_negate __retVal, v;
1079 ivec3 __operator - (const ivec3 v)
1081 __asm vec4_negate __retVal, v;
1084 ivec4 __operator - (const ivec4 v)
1086 __asm vec4_negate __retVal, v;
1089 float __operator - (const float a)
1091 __asm vec4_negate __retVal.x, a;
1094 vec2 __operator - (const vec2 v)
1096 __asm vec4_negate __retVal.xy, v.xy;
1099 vec3 __operator - (const vec3 v)
1101 __asm vec4_negate __retVal.xyz, v.xyz;
1104 vec4 __operator - (const vec4 v)
1106 __asm vec4_negate __retVal, v;
1109 mat2 __operator - (const mat2 m)
1111 __retVal[0] = -m[0];
1112 __retVal[1] = -m[1];
1115 mat3 __operator - (const mat3 m)
1117 __retVal[0] = -m[0];
1118 __retVal[1] = -m[1];
1119 __retVal[2] = -m[2];
1122 mat4 __operator - (const mat4 m)
1124 __retVal[0] = -m[0];
1125 __retVal[1] = -m[1];
1126 __retVal[2] = -m[2];
1127 __retVal[3] = -m[3];
1134 float dot(const float a, const float b)
1139 float dot(const vec2 a, const vec2 b)
1141 __retVal = a.x * b.x + a.y * b.y;
1144 float dot(const vec3 a, const vec3 b)
1146 __asm vec3_dot __retVal, a, b;
1149 float dot(const vec4 a, const vec4 b)
1151 __asm vec4_dot __retVal, a, b;
1156 //// int assignment operators
1158 void __operator += (inout int a, const int b)
1160 __asm vec4_add a, a, b;
1163 void __operator -= (inout int a, const int b)
1165 __asm vec4_subtract a, a, b;
1168 void __operator *= (inout int a, const int b)
1170 __asm vec4_multiply a, a, b;
1173 void __operator /= (inout int a, const int b)
1176 __asm float_rcp invB, b;
1177 __asm vec4_multiply a, a, invB;
1181 //// ivec2 assignment operators
1183 void __operator += (inout ivec2 v, const ivec2 u)
1185 __asm vec4_add v, v, u;
1188 void __operator -= (inout ivec2 v, const ivec2 u)
1190 __asm vec4_subtract v, v, u;
1193 void __operator *= (inout ivec2 v, const ivec2 u)
1195 __asm vec4_multiply v, v, u;
1198 void __operator /= (inout ivec2 v, const ivec2 u)
1201 __asm float_rcp inv.x, u.x;
1202 __asm float_rcp inv.y, u.y;
1203 __asm vec4_multiply z, v, inv;
1204 __asm float_to_int __retVal, z;
1208 //// ivec3 assignment operators
1210 void __operator += (inout ivec3 v, const ivec3 u)
1212 __asm vec4_add v, v, u;
1215 void __operator -= (inout ivec3 v, const ivec3 u)
1217 __asm vec4_subtract v, v, u;
1220 void __operator *= (inout ivec3 v, const ivec3 u)
1222 __asm vec4_multiply v, v, u;
1225 void __operator /= (inout ivec3 v, const ivec3 u)
1228 __asm float_rcp inv.x, u.x;
1229 __asm float_rcp inv.y, u.y;
1230 __asm vec4_multiply z, v, inv;
1231 __asm float_to_int __retVal, z;
1235 //// ivec4 assignment operators
1237 void __operator += (inout ivec4 v, const ivec4 u)
1239 __asm vec4_add v, v, u;
1242 void __operator -= (inout ivec4 v, const ivec4 u)
1244 __asm vec4_subtract v, v, u;
1247 void __operator *= (inout ivec4 v, const ivec4 u)
1249 __asm vec4_multiply v, v, u;
1252 void __operator /= (inout ivec4 v, const ivec4 u)
1255 __asm float_rcp inv.x, u.x;
1256 __asm float_rcp inv.y, u.y;
1257 __asm vec4_multiply z, v, inv;
1258 __asm float_to_int __retVal, z;
1262 //// float assignment operators
1264 void __operator += (inout float a, const float b)
1266 __asm vec4_add a.x, a.x, b;
1269 void __operator -= (inout float a, const float b)
1271 __asm vec4_subtract a.x, a, b;
1274 void __operator *= (inout float a, const float b)
1276 __asm vec4_multiply a.x, a, b;
1279 void __operator /= (inout float a, const float b)
1282 __asm float_rcp w.x, b;
1283 __asm vec4_multiply a.x, a, w;
1287 //// vec2 assignment operators
1289 void __operator += (inout vec2 v, const vec2 u)
1291 __asm vec4_add v.xy, v.xy, u.xy;
1294 void __operator -= (inout vec2 v, const vec2 u)
1296 __asm vec4_subtract v.xy, v.xy, u.xy;
1299 void __operator *= (inout vec2 v, const vec2 u)
1301 __asm vec4_multiply v.xy, v.xy, u.xy;
1304 void __operator /= (inout vec2 v, const vec2 u)
1307 __asm float_rcp w.x, u.x;
1308 __asm float_rcp w.y, u.y;
1309 __asm vec4_multiply v.xy, v.xy, w.xy;
1313 //// vec3 assignment operators
1315 void __operator += (inout vec3 v, const vec3 u)
1317 __asm vec4_add v.xyz, v, u;
1320 void __operator -= (inout vec3 v, const vec3 u)
1322 __asm vec4_subtract v.xyz, v, u;
1325 void __operator *= (inout vec3 v, const vec3 u)
1327 __asm vec4_multiply v.xyz, v, u;
1330 void __operator /= (inout vec3 v, const vec3 u)
1333 __asm float_rcp w.x, u.x;
1334 __asm float_rcp w.y, u.y;
1335 __asm float_rcp w.z, u.z;
1336 __asm vec4_multiply v.xyz, v.xyz, w.xyz;
1340 //// vec4 assignment operators
1342 void __operator += (inout vec4 v, const vec4 u)
1344 __asm vec4_add v, v, u;
1347 void __operator -= (inout vec4 v, const vec4 u)
1349 __asm vec4_subtract v, v, u;
1352 void __operator *= (inout vec4 v, const vec4 u)
1354 __asm vec4_multiply v, v, u;
1357 void __operator /= (inout vec4 v, const vec4 u)
1360 __asm float_rcp w.x, u.x;
1361 __asm float_rcp w.y, u.y;
1362 __asm float_rcp w.z, u.z;
1363 __asm float_rcp w.w, u.w;
1364 __asm vec4_multiply v, v, w;
1369 //// ivec2/int assignment operators
1371 void __operator += (inout ivec2 v, const int a)
1373 __asm vec4_add v.xy, v.xy, a.xx;
1376 void __operator -= (inout ivec2 v, const int a)
1378 __asm vec4_subtract v.xy, v.xy, a.xx;
1381 void __operator *= (inout ivec2 v, const int a)
1383 __asm vec4_multiply v.xy, v.xy, a.xx;
1388 void __operator /= (inout ivec2 v, const int a)
1396 //// ivec3/int assignment operators
1398 void __operator += (inout ivec3 v, const int a)
1400 __asm vec4_add v.xyz, v.xyz, a.xxx;
1403 void __operator -= (inout ivec3 v, const int a)
1405 __asm vec4_subtract v.xyz, v.xyz, a.xxx;
1408 void __operator *= (inout ivec3 v, const int a)
1410 __asm vec4_multiply v.xyz, v.xyz, a.xxx;
1413 void __operator /= (inout ivec3 v, const int a)
1422 //// ivec4/int assignment operators
1424 void __operator += (inout ivec4 v, const int a)
1426 __asm vec4_add v, v, a.xxxx;
1429 void __operator -= (inout ivec4 v, const int a)
1431 __asm vec4_subtract v, v, a.xxxx;
1434 void __operator *= (inout ivec4 v, const int a)
1436 __asm vec4_multiply v, v, a.xxxx;
1439 void __operator /= (inout ivec4 v, const int a)
1449 //// vec2/float assignment operators
1451 void __operator += (inout vec2 v, const float a)
1453 __asm vec4_add v.xy, v, a.xx;
1456 void __operator -= (inout vec2 v, const float a)
1458 __asm vec4_subtract v.xy, v, a.xx;
1461 void __operator *= (inout vec2 v, const float a)
1463 __asm vec4_multiply v.xy, v, a.xx;
1466 void __operator /= (inout vec2 v, const float a)
1469 __asm float_rcp invA, a;
1470 __asm vec4_multiply v.xy, v.xy, a.xx;
1474 //// vec3/float assignment operators
1476 void __operator += (inout vec3 v, const float a)
1478 __asm vec4_add v.xyz, v, a.xxx;
1481 void __operator -= (inout vec3 v, const float a)
1483 __asm vec4_subtract v.xyz, v, a.xxx;
1486 void __operator *= (inout vec3 v, const float a)
1488 __asm vec4_multiply v.xyz, v, a.xxx;
1491 void __operator /= (inout vec3 v, const float a)
1494 __asm float_rcp invA, a;
1495 __asm vec4_multiply v.xyz, v.xyz, a.xxx;
1499 //// vec4/float assignment operators
1501 void __operator += (inout vec4 v, const float a)
1503 __asm vec4_add v, v, a.xxxx;
1506 void __operator -= (inout vec4 v, const float a)
1508 __asm vec4_subtract v, v, a.xxxx;
1511 void __operator *= (inout vec4 v, const float a)
1513 __asm vec4_multiply v, v, a.xxxx;
1516 void __operator /= (inout vec4 v, const float a)
1519 __asm float_rcp invA, a;
1520 __asm vec4_multiply v, v, a.xxxx;
1527 //// Basic mat2 operations
1529 mat2 __operator + (const mat2 m, const mat2 n)
1531 __retVal[0] = m[0] + n[0];
1532 __retVal[1] = m[1] + n[1];
1535 mat2 __operator - (const mat2 m, const mat2 n)
1537 __retVal[0] = m[0] - n[0];
1538 __retVal[1] = m[1] - n[1];
1541 mat2 __operator * (const mat2 m, const mat2 n)
1548 __retVal[0].x = dot(mRow0, n[0]);
1549 __retVal[1].x = dot(mRow0, n[1]);
1550 __retVal[0].y = dot(mRow1, n[0]);
1551 __retVal[1].y = dot(mRow1, n[1]);
1554 mat2 __operator / (const mat2 m, const mat2 n)
1556 __retVal[0] = m[0] / n[0];
1557 __retVal[1] = m[1] / n[1];
1561 //// Basic mat3 operations
1563 mat3 __operator + (const mat3 m, const mat3 n)
1565 __retVal[0] = m[0] + n[0];
1566 __retVal[1] = m[1] + n[1];
1567 __retVal[2] = m[2] + n[2];
1570 mat3 __operator - (const mat3 m, const mat3 n)
1572 __retVal[0] = m[0] - n[0];
1573 __retVal[1] = m[1] - n[1];
1574 __retVal[2] = m[2] - n[2];
1577 mat3 __operator * (const mat3 m, const mat3 n)
1579 // sub-blocks to reduce register usage
1585 __retVal[0].x = dot(mRow0, n[0]);
1586 __retVal[1].x = dot(mRow0, n[1]);
1587 __retVal[2].x = dot(mRow0, n[2]);
1594 __retVal[0].y = dot(mRow1, n[0]);
1595 __retVal[1].y = dot(mRow1, n[1]);
1596 __retVal[2].y = dot(mRow1, n[2]);
1603 __retVal[0].z = dot(mRow2, n[0]);
1604 __retVal[1].z = dot(mRow2, n[1]);
1605 __retVal[2].z = dot(mRow2, n[2]);
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];
1617 //// Basic mat4 operations
1619 mat4 __operator + (const mat4 m, const mat4 n)
1621 __retVal[0] = m[0] + n[0];
1622 __retVal[1] = m[1] + n[1];
1623 __retVal[2] = m[2] + n[2];
1624 __retVal[3] = m[3] + n[3];
1627 mat4 __operator - (const mat4 m, const mat4 n)
1629 __retVal[0] = m[0] - n[0];
1630 __retVal[1] = m[1] - n[1];
1631 __retVal[2] = m[2] - n[2];
1632 __retVal[3] = m[3] - n[3];
1635 mat4 __operator * (const mat4 m, const mat4 n)
1637 // sub-blocks to reduce temporary usage
1644 __retVal[0].x = dot(mRow0, n[0]);
1645 __retVal[1].x = dot(mRow0, n[1]);
1646 __retVal[2].x = dot(mRow0, n[2]);
1647 __retVal[3].x = dot(mRow0, n[3]);
1655 __retVal[0].y = dot(mRow1, n[0]);
1656 __retVal[1].y = dot(mRow1, n[1]);
1657 __retVal[2].y = dot(mRow1, n[2]);
1658 __retVal[3].y = dot(mRow1, n[3]);
1666 __retVal[0].z = dot(mRow2, n[0]);
1667 __retVal[1].z = dot(mRow2, n[1]);
1668 __retVal[2].z = dot(mRow2, n[2]);
1669 __retVal[3].z = dot(mRow2, n[3]);
1677 __retVal[0].w = dot(mRow3, n[0]);
1678 __retVal[1].w = dot(mRow3, n[1]);
1679 __retVal[2].w = dot(mRow3, n[2]);
1680 __retVal[3].w = dot(mRow3, n[3]);
1684 mat4 __operator / (const mat4 m, const mat4 n)
1686 __retVal[0] = m[0] / n[0];
1687 __retVal[1] = m[1] / n[1];
1688 __retVal[2] = m[2] / n[2];
1689 __retVal[3] = m[3] / n[3];
1693 //// mat2/float operations
1695 mat2 __operator + (const float a, const mat2 n)
1697 __retVal[0] = a + n[0];
1698 __retVal[1] = a + n[1];
1701 mat2 __operator + (const mat2 m, const float b)
1703 __retVal[0] = m[0] + b;
1704 __retVal[1] = m[1] + b;
1707 mat2 __operator - (const float a, const mat2 n)
1709 __retVal[0] = a - n[0];
1710 __retVal[1] = a - n[1];
1713 mat2 __operator - (const mat2 m, const float b)
1715 __retVal[0] = m[0] - b;
1716 __retVal[1] = m[1] - b;
1719 mat2 __operator * (const float a, const mat2 n)
1721 __retVal[0] = a * n[0];
1722 __retVal[1] = a * n[1];
1725 mat2 __operator * (const mat2 m, const float b)
1727 __retVal[0] = m[0] * b;
1728 __retVal[1] = m[1] * b;
1731 mat2 __operator / (const float a, const mat2 n)
1733 __retVal[0] = a / n[0];
1734 __retVal[1] = a / n[1];
1737 mat2 __operator / (const mat2 m, const float b)
1739 __retVal[0] = m[0] / b;
1740 __retVal[1] = m[1] / b;
1744 //// mat3/float operations
1746 mat3 __operator + (const float a, const mat3 n)
1748 __retVal[0] = a + n[0];
1749 __retVal[1] = a + n[1];
1750 __retVal[2] = a + n[2];
1753 mat3 __operator + (const mat3 m, const float b)
1755 __retVal[0] = m[0] + b;
1756 __retVal[1] = m[1] + b;
1757 __retVal[2] = m[2] + b;
1760 mat3 __operator - (const float a, const mat3 n)
1762 __retVal[0] = a - n[0];
1763 __retVal[1] = a - n[1];
1764 __retVal[2] = a - n[2];
1767 mat3 __operator - (const mat3 m, const float b)
1769 __retVal[0] = m[0] - b;
1770 __retVal[1] = m[1] - b;
1771 __retVal[2] = m[2] - b;
1774 mat3 __operator * (const float a, const mat3 n)
1776 __retVal[0] = a * n[0];
1777 __retVal[1] = a * n[1];
1778 __retVal[2] = a * n[2];
1781 mat3 __operator * (const mat3 m, const float b)
1783 __retVal[0] = m[0] * b;
1784 __retVal[1] = m[1] * b;
1785 __retVal[2] = m[2] * b;
1788 mat3 __operator / (const float a, const mat3 n)
1790 __retVal[0] = a / n[0];
1791 __retVal[1] = a / n[1];
1792 __retVal[2] = a / n[2];
1795 mat3 __operator / (const mat3 m, const float b)
1797 __retVal[0] = m[0] / b;
1798 __retVal[1] = m[1] / b;
1799 __retVal[2] = m[2] / b;
1803 //// mat4/float operations
1805 mat4 __operator + (const float a, const mat4 n)
1807 __retVal[0] = a + n[0];
1808 __retVal[1] = a + n[1];
1809 __retVal[2] = a + n[2];
1810 __retVal[3] = a + n[3];
1813 mat4 __operator + (const mat4 m, const float b)
1815 __retVal[0] = m[0] + b;
1816 __retVal[1] = m[1] + b;
1817 __retVal[2] = m[2] + b;
1818 __retVal[3] = m[3] + b;
1821 mat4 __operator - (const float a, const mat4 n)
1823 __retVal[0] = a - n[0];
1824 __retVal[1] = a - n[1];
1825 __retVal[2] = a - n[2];
1826 __retVal[3] = a - n[3];
1829 mat4 __operator - (const mat4 m, const float b)
1831 __retVal[0] = m[0] - b;
1832 __retVal[1] = m[1] - b;
1833 __retVal[2] = m[2] - b;
1834 __retVal[3] = m[3] - b;
1837 mat4 __operator * (const float a, const mat4 n)
1839 __retVal[0] = a * n[0];
1840 __retVal[1] = a * n[1];
1841 __retVal[2] = a * n[2];
1842 __retVal[3] = a * n[3];
1845 mat4 __operator * (const mat4 m, const float b)
1847 __retVal[0] = m[0] * b;
1848 __retVal[1] = m[1] * b;
1849 __retVal[2] = m[2] * b;
1850 __retVal[3] = m[3] * b;
1853 mat4 __operator / (const float a, const mat4 n)
1855 __retVal[0] = a / n[0];
1856 __retVal[1] = a / n[1];
1857 __retVal[2] = a / n[2];
1858 __retVal[3] = a / n[3];
1861 mat4 __operator / (const mat4 m, const float b)
1863 __retVal[0] = m[0] / b;
1864 __retVal[1] = m[1] / b;
1865 __retVal[2] = m[2] / b;
1866 __retVal[3] = m[3] / b;
1871 //// matrix / vector products
1873 vec2 __operator * (const mat2 m, const vec2 v)
1880 __retVal.x = dot(r0, v);
1881 __retVal.y = dot(r1, v);
1884 vec2 __operator * (const vec2 v, const mat2 m)
1886 __retVal.x = dot(v, m[0]);
1887 __retVal.y = dot(v, m[1]);
1890 vec3 __operator * (const mat3 m, const vec3 v)
1897 __asm vec3_dot __retVal.x, r0, v;
1904 __asm vec3_dot __retVal.y, r1, v;
1911 __asm vec3_dot __retVal.z, r2, v;
1915 vec3 __operator * (const vec3 v, const mat3 m)
1917 __retVal.x = dot(v, m[0]);
1918 __retVal.y = dot(v, m[1]);
1919 __retVal.z = dot(v, m[2]);
1922 vec4 __operator * (const mat4 m, const vec4 v)
1924 // extract rows, then do dot product
1931 __asm vec4_dot __retVal.x, r0, v;
1939 __asm vec4_dot __retVal.y, r1, v;
1947 __asm vec4_dot __retVal.z, r2, v;
1955 __asm vec4_dot __retVal.w, r3, v;
1959 vec4 __operator * (const vec4 v, const mat4 m)
1962 __retVal.x = dot(v, m[0]);
1963 __retVal.y = dot(v, m[1]);
1964 __retVal.z = dot(v, m[2]);
1965 __retVal.w = dot(v, m[3]);
1970 //// mat2 assignment operators
1972 void __operator += (inout mat2 m, const mat2 n)
1978 void __operator -= (inout mat2 m, const mat2 n)
1984 void __operator *= (inout mat2 m, const mat2 n)
1989 void __operator /= (inout mat2 m, const mat2 n)
1996 //// mat3 assignment operators
1998 void __operator += (inout mat3 m, const mat3 n)
2005 void __operator -= (inout mat3 m, const mat3 n)
2012 void __operator *= (inout mat3 m, const mat3 n)
2017 void __operator /= (inout mat3 m, const mat3 n)
2025 // mat4 assignment operators
2027 void __operator += (inout mat4 m, const mat4 n)
2035 void __operator -= (inout mat4 m, const mat4 n) {
2042 void __operator *= (inout mat4 m, const mat4 n)
2047 void __operator /= (inout mat4 m, const mat4 n)
2056 //// mat2/float assignment operators
2058 void __operator += (inout mat2 m, const float a) {
2063 void __operator -= (inout mat2 m, const float a) {
2068 void __operator *= (inout mat2 m, const float a) {
2073 void __operator /= (inout mat2 m, const float a) {
2079 //// mat3/float assignment operators
2081 void __operator += (inout mat3 m, const float a) {
2087 void __operator -= (inout mat3 m, const float a) {
2093 void __operator *= (inout mat3 m, const float a) {
2099 void __operator /= (inout mat3 m, const float a) {
2106 //// mat4/float assignment operators
2108 void __operator += (inout mat4 m, const float a) {
2115 void __operator -= (inout mat4 m, const float a) {
2122 void __operator *= (inout mat4 m, const float a) {
2129 void __operator /= (inout mat4 m, const float a) {
2138 //// vec/mat assignment operators
2140 void __operator *= (inout vec2 v, const mat2 m)
2145 void __operator *= (inout vec3 v, const mat3 m)
2150 void __operator *= (inout vec4 v, const mat4 m)
2157 //// pre-decrement operators
2159 int __operator --(inout int a)
2165 ivec2 __operator --(inout ivec2 v)
2171 ivec3 __operator --(inout ivec3 v)
2177 ivec4 __operator --(inout ivec4 v)
2184 float __operator --(inout float a)
2190 vec2 __operator --(inout vec2 v)
2196 vec3 __operator --(inout vec3 v)
2202 vec4 __operator --(inout vec4 v)
2209 mat2 __operator --(inout mat2 m)
2211 m[0] = m[0] - vec2(1.0);
2212 m[1] = m[1] - vec2(1.0);
2216 mat3 __operator --(inout mat3 m)
2218 m[0] = m[0] - vec3(1.0);
2219 m[1] = m[1] - vec3(1.0);
2220 m[2] = m[2] - vec3(1.0);
2224 mat4 __operator --(inout mat4 m)
2226 m[0] = m[0] - vec4(1.0);
2227 m[1] = m[1] - vec4(1.0);
2228 m[2] = m[2] - vec4(1.0);
2229 m[3] = m[3] - vec4(1.0);
2234 //// pre-increment operators
2236 int __operator ++(inout int a)
2242 ivec2 __operator ++(inout ivec2 v)
2248 ivec3 __operator ++(inout ivec3 v)
2254 ivec4 __operator ++(inout ivec4 v)
2261 float __operator ++(inout float a)
2267 vec2 __operator ++(inout vec2 v)
2273 vec3 __operator ++(inout vec3 v)
2279 vec4 __operator ++(inout vec4 v)
2286 mat2 __operator ++(inout mat2 m)
2288 m[0] = m[0] + vec2(1.0);
2289 m[1] = m[1] + vec2(1.0);
2293 mat3 __operator ++(inout mat3 m)
2295 m[0] = m[0] + vec3(1.0);
2296 m[1] = m[1] + vec3(1.0);
2297 m[2] = m[2] + vec3(1.0);
2301 mat4 __operator ++(inout mat4 m)
2303 m[0] = m[0] + vec4(1.0);
2304 m[1] = m[1] + vec4(1.0);
2305 m[2] = m[2] + vec4(1.0);
2306 m[3] = m[3] + vec4(1.0);
2314 int __postDecr(inout int a)
2320 ivec2 __postDecr(inout ivec2 v)
2326 ivec3 __postDecr(inout ivec3 v)
2332 ivec4 __postDecr(inout ivec4 v)
2339 float __postDecr(inout float a)
2345 vec2 __postDecr(inout vec2 v)
2351 vec3 __postDecr(inout vec3 v)
2357 vec4 __postDecr(inout vec4 v)
2364 mat2 __postDecr(inout mat2 m)
2367 m[0] = m[0] - vec2(1.0);
2368 m[1] = m[1] - vec2(1.0);
2371 mat3 __postDecr(inout mat3 m)
2374 m[0] = m[0] - vec3(1.0);
2375 m[1] = m[1] - vec3(1.0);
2376 m[2] = m[2] - vec3(1.0);
2379 mat4 __postDecr(inout mat4 m)
2382 m[0] = m[0] - vec4(1.0);
2383 m[1] = m[1] - vec4(1.0);
2384 m[2] = m[2] - vec4(1.0);
2385 m[3] = m[3] - vec4(1.0);
2391 float __postIncr(inout float a)
2397 vec2 __postIncr(inout vec2 v)
2403 vec3 __postIncr(inout vec3 v)
2409 vec4 __postIncr(inout vec4 v)
2416 int __postIncr(inout int a)
2422 ivec2 __postIncr(inout ivec2 v)
2428 ivec3 __postIncr(inout ivec3 v)
2434 ivec4 __postIncr(inout ivec4 v)
2441 mat2 __postIncr(inout mat2 m)
2444 m[0] = m[0] + vec2(1.0);
2445 m[1] = m[1] + vec2(1.0);
2449 mat3 __postIncr(inout mat3 m)
2452 m[0] = m[0] + vec3(1.0);
2453 m[1] = m[1] + vec3(1.0);
2454 m[2] = m[2] + vec3(1.0);
2458 mat4 __postIncr(inout mat4 m)
2461 m[0] = m[0] + vec4(1.0);
2462 m[1] = m[1] + vec4(1.0);
2463 m[2] = m[2] + vec4(1.0);
2464 m[3] = m[3] + vec4(1.0);
2470 //// inequality operators
2473 // XXX are the inequality operators for floats/ints really needed????
2474 bool __operator < (const float a, const float b)
2476 __asm vec4_sgt __retVal.x, b, a;
2480 bool __operator < (const int a, const int b) {
2481 return float (a) < float (b);
2484 bool __operator > (const float a, const float b) {
2486 __asm float_less c, b, a;
2490 bool __operator > (const int a, const int b) {
2491 return float (a) > float (b);
2494 bool __operator >= (const float a, const float b) {
2496 __asm float_less g, b, a;
2497 __asm float_equal e, a, b;
2501 bool __operator >= (const int a, const int b) {
2502 return float (a) >= float (b);
2505 bool __operator <= (const float a, const float b) {
2507 __asm float_less g, a, b;
2508 __asm float_equal e, a, b;
2512 bool __operator <= (const int a, const int b) {
2513 return float (a) <= float (b);
2519 // MESA-specific extension functions.
2522 void printMESA (const float f) {
2523 __asm float_print f;
2526 void printMESA (const int i) {
2530 void printMESA (const bool b) {
2534 void printMESA (const vec2 v) {
2539 void printMESA (const vec3 v) {
2545 void printMESA (const vec4 v) {
2552 void printMESA (const ivec2 v) {
2557 void printMESA (const ivec3 v) {
2563 void printMESA (const ivec4 v) {
2570 void printMESA (const bvec2 v) {
2575 void printMESA (const bvec3 v) {
2581 void printMESA (const bvec4 v) {
2588 void printMESA (const mat2 m) {
2593 void printMESA (const mat3 m) {
2599 void printMESA (const mat4 m) {
2606 void printMESA (const sampler1D e) {
2610 void printMESA (const sampler2D e) {
2614 void printMESA (const sampler3D e) {
2618 void printMESA (const samplerCube e) {
2622 void printMESA (const sampler1DShadow e) {
2626 void printMESA (const sampler2DShadow e) {