blob: 7e036167ad5f740986fcc3da97964c91b997e764 [file] [log] [blame]
Ethan Nicholas79707652017-11-16 11:20:11 -05001STRINGIFY(
ethannicholasb3058bd2016-07-01 08:22:01 -07002
3// defines built-in functions supported by SkiaSL
4
5$genType radians($genType degrees);
6$genType sin($genType angle);
7$genType cos($genType angle);
8$genType tan($genType angle);
9$genType asin($genType x);
10$genType acos($genType x);
11$genType atan($genType y, $genType x);
12$genType atan($genType y_over_x);
13$genType sinh($genType x);
14$genType cosh($genType x);
15$genType tanh($genType x);
16$genType asinh($genType x);
17$genType acosh($genType x);
18$genType atanh($genType x);
19$genType pow($genType x, $genType y);
20$genType exp($genType x);
21$genType log($genType x);
22$genType exp2($genType x);
23$genType log2($genType x);
24$genType sqrt($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070025//$genDType sqrt($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070026$genType inversesqrt($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070027//$genDType inversesqrt($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070028$genType abs($genType x);
29$genIType abs($genIType x);
ethannicholas471e8942016-10-28 09:02:46 -070030//$genDType abs($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070031$genType sign($genType x);
32$genIType sign($genIType x);
ethannicholas471e8942016-10-28 09:02:46 -070033//$genDType sign($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070034$genType floor($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070035//$genDType floor($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070036$genType trunc($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070037//$genDType trunc($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070038$genType round($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070039//$genDType round($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070040$genType roundEven($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070041//$genDType roundEven($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070042$genType ceil($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070043//$genDType ceil($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070044$genType fract($genType x);
ethannicholas471e8942016-10-28 09:02:46 -070045//$genDType fract($genDType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040046$genType mod($genType x, float y);
ethannicholasb3058bd2016-07-01 08:22:01 -070047$genType mod($genType x, $genType y);
ethannicholas471e8942016-10-28 09:02:46 -070048//$genDType mod($genDType x, double y);
49//$genDType mod($genDType x, $genDType y);
ethannicholasb3058bd2016-07-01 08:22:01 -070050$genType modf($genType x, out $genType i);
ethannicholas471e8942016-10-28 09:02:46 -070051//$genDType modf($genDType x, out $genDType i);
ethannicholasb3058bd2016-07-01 08:22:01 -070052$genType min($genType x, $genType y);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040053$genType min($genType x, float y);
ethannicholas471e8942016-10-28 09:02:46 -070054//$genDType min($genDType x, $genDType y);
55//$genDType min($genDType x, double y);
ethannicholasb3058bd2016-07-01 08:22:01 -070056$genIType min($genIType x, $genIType y);
57$genIType min($genIType x, int y);
ethannicholas471e8942016-10-28 09:02:46 -070058//$genUType min($genUType x, $genUType y);
59//$genUType min($genUType x, uint y);
ethannicholasb3058bd2016-07-01 08:22:01 -070060$genType max($genType x, $genType y);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040061$genType max($genType x, float y);
ethannicholas471e8942016-10-28 09:02:46 -070062//$genDType max($genDType x, $genDType y);
63//$genDType max($genDType x, double y);
ethannicholasb3058bd2016-07-01 08:22:01 -070064$genIType max($genIType x, $genIType y);
65$genIType max($genIType x, int y);
ethannicholas471e8942016-10-28 09:02:46 -070066//$genUType max($genUType x, $genUType y);
67//$genUType max($genUType x, uint y);
ethannicholasb3058bd2016-07-01 08:22:01 -070068$genType clamp($genType x, $genType minVal, $genType maxVal);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040069$genType clamp($genType x, float minVal, float maxVal);
ethannicholas471e8942016-10-28 09:02:46 -070070//$genDType clamp($genDType x, $genDType minVal, $genDType maxVal);
71//$genDType clamp($genDType x, double minVal, double maxVal);
ethannicholasb3058bd2016-07-01 08:22:01 -070072$genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
73$genIType clamp($genIType x, int minVal, int maxVal);
ethannicholas471e8942016-10-28 09:02:46 -070074//$genUType clamp($genUType x, $genUType minVal, $genUType maxVal);
75//$genUType clamp($genUType x, uint minVal, uint maxVal);
Ethan Nicholas12fb9cf2018-08-03 16:16:57 -040076$genType saturate($genType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070077$genType mix($genType x, $genType y, $genType a);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040078$genType mix($genType x, $genType y, float a);
ethannicholas471e8942016-10-28 09:02:46 -070079//$genDType mix($genDType x, $genDType y, $genDType a);
80//$genDType mix($genDType x, $genDType y, double a);
ethannicholasb3058bd2016-07-01 08:22:01 -070081$genType mix($genType x, $genType y, $genBType a);
ethannicholas471e8942016-10-28 09:02:46 -070082//$genDType mix($genDType x, $genDType y, $genBType a);
ethannicholasb3058bd2016-07-01 08:22:01 -070083$genIType mix($genIType x, $genIType y, $genBType a);
ethannicholas471e8942016-10-28 09:02:46 -070084//$genUType mix($genUType x, $genUType y, $genBType a);
ethannicholasb3058bd2016-07-01 08:22:01 -070085$genBType mix($genBType x, $genBType y, $genBType a);
86$genType step($genType edge, $genType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040087$genType step(float edge, $genType x);
ethannicholas471e8942016-10-28 09:02:46 -070088//$genDType step($genDType edge, $genDType x);
89//$genDType step(double edge, $genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070090$genType smoothstep($genType edge0, $genType edge1, $genType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040091$genType smoothstep(float edge0, float edge1, $genType x);
ethannicholas471e8942016-10-28 09:02:46 -070092//$genDType smoothstep($genDType edge0, $genDType edge1, $genDType x);
93//$genDType smoothstep(double edge0, double edge1, $genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070094$genBType isnan($genType x);
95$genBType isnan($genDType x);
96$genBType isinf($genType x);
97$genBType isinf($genDType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -040098$genIType floatBitsToInt($genType value);
99//$genUType floatBitsToUint($genType value);
100$genType intBitsTofloat($genIType value);
101$genType uintBitsTofloat($genUType value);
ethannicholasb3058bd2016-07-01 08:22:01 -0700102$genType fma($genType a, $genType b, $genType c);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400103$genHType fma($genHType a, $genHType b, $genHType c);
104$genDType fma($genDType a, $genDType b, $genDType c);
ethannicholas471e8942016-10-28 09:02:46 -0700105//$genDType fma($genDType a, $genDType b, $genDType c);
Ethan Nicholasc6a19f12018-03-29 16:46:56 -0400106sk_has_side_effects $genType frexp($genType x, out $genIType exp);
ethannicholas471e8942016-10-28 09:02:46 -0700107//$genDType frexp($genDType x, out $genIType exp);
ethannicholasb3058bd2016-07-01 08:22:01 -0700108$genType ldexp($genType x, in $genIType exp);
ethannicholas471e8942016-10-28 09:02:46 -0700109//$genDType ldexp($genDType x, in $genIType exp);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400110uint packUnorm2x16(float2 v);
111uint packSnorm2x16(float2 v);
112uint packUnorm4x8(float4 v);
113uint packSnorm4x8(float4 v);
114float2 unpackUnorm2x16(uint p);
115float2 unpackSnorm2x16(uint p);
116float4 unpackUnorm4x8(uint p);
117float4 unpackSnorm4x8(uint p);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400118//double packDouble2x32(uint2 v);
119uint2 unpackDouble2x32(double v);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400120uint packHalf2x16(float2 v);
121float2 unpackHalf2x16(uint v);
122float length($genType x);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400123half length($genHType x);
124double length($genDType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400125float distance($genType p0, $genType p1);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400126half distance($genHType p0, $genHType p1);
127double distance($genDType p0, $genDType p1);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400128float dot($genType x, $genType y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400129half dot($genHType x, $genHType y);
130double dot($genDType x, $genDType y);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400131float3 cross(float3 x, float3 y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400132half3 cross(half3 x, half3 y);
133double3 cross(double3 x, double3 y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700134$genType normalize($genType x);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400135$genHType normalize($genHType x);
136$genDType normalize($genDType x);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400137float4 ftransform();
ethannicholasb3058bd2016-07-01 08:22:01 -0700138$genType faceforward($genType N, $genType I, $genType Nref);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400139$genHType faceforward($genHType N, $genHType I, $genHType Nref);
140$genDType faceforward($genDType N, $genDType I, $genDType Nref);
ethannicholasb3058bd2016-07-01 08:22:01 -0700141$genType reflect($genType I, $genType N);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400142$genHType reflect($genHType I, $genHType N);
143$genDType reflect($genDType I, $genDType N);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400144$genType refract($genType I, $genType N, float eta);
145$genHType refract($genHType I, $genHType N, float eta);
146$genDType refract($genDType I, $genDType N, float eta);
ethannicholasb3058bd2016-07-01 08:22:01 -0700147$mat matrixCompMult($mat x, $mat y);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400148float2x2 outerProduct(float2 c, float2 r);
149float3x3 outerProduct(float3 c, float3 r);
150float4x3 outerProduct(float4 c, float4 r);
151float2x3 outerProduct(float3 c, float2 r);
152float3x2 outerProduct(float2 c, float3 r);
153float2x4 outerProduct(float4 c, float2 r);
154float4x2 outerProduct(float2 c, float4 r);
155float3x4 outerProduct(float4 c, float3 r);
156float4x3 outerProduct(float3 c, float4 r);
157float2x2 transpose(float2x2 m);
158float3x3 transpose(float3x3 m);
159float4x4 transpose(float4x4 m);
160float2x3 transpose(float3x2 m);
161float3x2 transpose(float2x3 m);
162float2x4 transpose(float4x2 m);
163float4x2 transpose(float2x4 m);
164float3x4 transpose(float4x3 m);
165float4x3 transpose(float3x4 m);
166float determinant(float2x2 m);
167float determinant(float3x3 m);
168float determinant(float4x4 m);
169float2x2 inverse(float2x2 m);
170float3x3 inverse(float3x3 m);
171float4x4 inverse(float4x4 m);
ethannicholasb3058bd2016-07-01 08:22:01 -0700172$bvec lessThan($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400173$bvec lessThan($hvec x, $hvec y);
174$bvec lessThan($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700175$bvec lessThan($ivec x, $ivec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400176$bvec lessThan($svec x, $svec y);
177$bvec lessThan($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700178$bvec lessThan($uvec x, $uvec y);
179$bvec lessThanEqual($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400180$bvec lessThanEqual($hvec x, $hvec y);
181$bvec lessThanEqual($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700182$bvec lessThanEqual($ivec x, $ivec y);
183$bvec lessThanEqual($uvec x, $uvec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400184$bvec lessThanEqual($svec x, $svec y);
185$bvec lessThanEqual($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700186$bvec greaterThan($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400187$bvec greaterThan($hvec x, $hvec y);
188$bvec greaterThan($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700189$bvec greaterThan($ivec x, $ivec y);
190$bvec greaterThan($uvec x, $uvec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400191$bvec greaterThan($svec x, $svec y);
192$bvec greaterThan($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700193$bvec greaterThanEqual($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400194$bvec greaterThanEqual($hvec x, $hvec y);
195$bvec greaterThanEqual($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700196$bvec greaterThanEqual($ivec x, $ivec y);
197$bvec greaterThanEqual($uvec x, $uvec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400198$bvec greaterThanEqual($svec x, $svec y);
199$bvec greaterThanEqual($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700200$bvec equal($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400201$bvec equal($hvec x, $hvec y);
202$bvec equal($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700203$bvec equal($ivec x, $ivec y);
204$bvec equal($uvec x, $uvec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400205$bvec equal($svec x, $svec y);
206$bvec equal($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700207$bvec equal($bvec x, $bvec y);
208$bvec notEqual($vec x, $vec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400209$bvec notEqual($hvec x, $hvec y);
210$bvec notEqual($dvec x, $dvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700211$bvec notEqual($ivec x, $ivec y);
212$bvec notEqual($uvec x, $uvec y);
Ethan Nicholasdcba08e2017-08-02 10:52:54 -0400213$bvec notEqual($svec x, $svec y);
214$bvec notEqual($usvec x, $usvec y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700215$bvec notEqual($bvec x, $bvec y);
216bool any($bvec x);
217bool all($bvec x);
218$bvec not($bvec x);
ethannicholas471e8942016-10-28 09:02:46 -0700219
ethannicholasb3058bd2016-07-01 08:22:01 -0700220$genIType bitCount($genIType value);
221$genIType bitCount($genUType value);
222$genIType findLSB($genIType value);
223$genIType findLSB($genUType value);
224$genIType findMSB($genIType value);
225$genIType findMSB($genUType value);
ethannicholas471e8942016-10-28 09:02:46 -0700226
227/*
228//$genUType uaddCarry($genUType x, $genUType y, out $genUType carry);
229//$genUType usubBorrow($genUType x, $genUType y, out $genUType borrow);
230void umulExtended($genUType x, $genUType y, out $genUType msb, out $genUType lsb);
231void imulExtended($genIType x, $genIType y, out $genIType msb, out $genIType lsb);
232$genIType bitfieldExtract($genIType value, int offset, int bits);
233//$genUType bitfieldExtract($genUType value, int offset, int bits);
234$genIType bitfieldInsert($genIType base, $genIType insert, int offset, int bits);
235//$genUType bitfieldInsert($genUType base, $genUType insert, int offset, int bits);
236$genIType bitfieldReverse($genIType value);
237//$genUType bitfieldReverse($genUType value);
ethannicholasb3058bd2016-07-01 08:22:01 -0700238int textureSize($gsampler1D sampler, int lod);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400239int2 textureSize($gsampler2D sampler, int lod);
240int3 textureSize($gsampler3D sampler, int lod);
241int2 textureSize($gsamplerCube sampler, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700242int textureSize(sampler1DShadow sampler, int lod);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400243int2 textureSize(sampler2DShadow sampler, int lod);
244int2 textureSize(samplerCubeShadow sampler, int lod);
245int3 textureSize($gsamplerCubeArray sampler, int lod);
246int3 textureSize(samplerCubeArrayShadow sampler, int lod);
ethannicholas471e8942016-10-28 09:02:46 -0700247*/
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400248int2 textureSize($gsampler2DRect sampler);
ethannicholas471e8942016-10-28 09:02:46 -0700249/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400250int2 textureSize(sampler2DRectShadow sampler);
251int2 textureSize($gsampler1DArray sampler, int lod);
252int3 textureSize($gsampler2DArray sampler, int lod);
253int2 textureSize(sampler1DArrayShadow sampler, int lod);
254int3 textureSize(sampler2DArrayShadow sampler, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700255int textureSize($gsamplerBuffer sampler);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400256int2 textureSize($gsampler2DMS sampler);
257int3 textureSize($gsampler2DMSArray sampler);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400258float2 textureQueryLod($gsampler1D sampler, float P);
259float2 textureQueryLod($gsampler2D sampler, float2 P);
260float2 textureQueryLod($gsampler3D sampler, float3 P);
261float2 textureQueryLod($gsamplerCube sampler, float3 P);
262float2 textureQueryLod($gsampler1DArray sampler, float P);
263float2 textureQueryLod($gsampler2DArray sampler, float2 P);
264float2 textureQueryLod($gsamplerCubeArray sampler, float3 P);
265float2 textureQueryLod(sampler1DShadow sampler, float P);
266float2 textureQueryLod(sampler2DShadow sampler, float2 P);
267float2 textureQueryLod(samplerCubeShadow sampler, float3 P);
268float2 textureQueryLod(sampler1DArrayShadow sampler, float P);
269float2 textureQueryLod(sampler2DArrayShadow sampler, float2 P);
270float2 textureQueryLod(samplerCubeArrayShadow sampler, float3 P);
ethannicholasb3058bd2016-07-01 08:22:01 -0700271int textureQueryLevels($gsampler1D sampler);
272int textureQueryLevels($gsampler2D sampler);
273int textureQueryLevels($gsampler3D sampler);
274int textureQueryLevels($gsamplerCube sampler);
275int textureQueryLevels($gsampler1DArray sampler);
276int textureQueryLevels($gsampler2DArray sampler);
277int textureQueryLevels($gsamplerCubeArray sampler);
278int textureQueryLevels(sampler1DShadow sampler);
279int textureQueryLevels(sampler2DShadow sampler);
280int textureQueryLevels(samplerCubeShadow sampler);
281int textureQueryLevels(sampler1DArrayShadow sampler);
282int textureQueryLevels(sampler2DArrayShadow sampler);
283int textureQueryLevels(samplerCubeArrayShadow sampler);
ethannicholas471e8942016-10-28 09:02:46 -0700284*/
285
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400286half4 texture($gsampler1D sampler, float P);
287half4 texture($gsampler1D sampler, float P, float bias);
288half4 texture($gsampler2D sampler, float2 P);
Brian Salomonbf7b6202016-11-11 16:08:03 -0500289// The above currently only expand to handle the float/fixed case. So we also declare this integer
290// version of texture().
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400291int4 texture(isampler2D sampler, float2 P);
292half4 texture(samplerExternalOES sampler, float2 P, float bias);
293half4 texture(samplerExternalOES sampler, float2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700294
295/*
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400296$gfloat4 texture($gsampler2D sampler, float2 P, float bias);
297$gfloat4 texture($gsampler3D sampler, float3 P);
298$gfloat4 texture($gsampler3D sampler, float3 P, float bias);
299$gfloat4 texture($gsamplerCube sampler, float3 P);
300$gfloat4 texture($gsamplerCube sampler, float3 P, float bias);
301float texture(sampler1DShadow sampler, float3 P);
302float texture(sampler1DShadow sampler, float3 P, float bias);
303float texture(sampler2DShadow sampler, float3 P);
304float texture(sampler2DShadow sampler, float3 P, float bias);
305float texture(samplerCubeShadow sampler, float4 P);
306float texture(samplerCubeShadow sampler, float4 P, float bias);
307$gfloat4 texture($gsampler1DArray sampler, float2 P);
308$gfloat4 texture($gsampler1DArray sampler, float2 P, float bias);
309$gfloat4 texture($gsampler2DArray sampler, float3 P);
310$gfloat4 texture($gsampler2DArray sampler, float3 P, float bias);
311$gfloat4 texture($gsamplerCubeArray sampler, float4 P);
312$gfloat4 texture($gsamplerCubeArray sampler, float4 P, float bias);
313float texture(sampler1DArrayShadow sampler, float3 P);
314float texture(sampler1DArrayShadow sampler, float3 P, float bias);
315float texture(sampler2DArrayShadow sampler, float4 P);
ethannicholas471e8942016-10-28 09:02:46 -0700316*/
317
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400318half4 texture($gsampler2DRect sampler, float2 P);
319half4 texture($gsampler2DRect sampler, float3 P);
ethannicholas471e8942016-10-28 09:02:46 -0700320
321/*
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400322float texture(sampler2DRectShadow sampler, float3 P);
323float texture($gsamplerCubeArrayShadow sampler, float4 P, float compare);
ethannicholas471e8942016-10-28 09:02:46 -0700324*/
Greg Daniel64773e62016-11-22 09:44:03 -0500325
326// Currently we do not support the generic types of loading subpassInput so we have some explicit
327// versions that we currently use
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400328float4 subpassLoad(subpassInput subpass);
329float4 subpassLoad(subpassInputMS subpass, int sample);
Greg Daniel64773e62016-11-22 09:44:03 -0500330/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400331$gfloat4subpassLoad(gsubpassInput subpass);
332$gfloat4subpassLoad(gsubpassInputMS subpass, int sample);
Greg Daniel64773e62016-11-22 09:44:03 -0500333*/
Ethan Nicholas79707652017-11-16 11:20:11 -0500334)
ethannicholasb3058bd2016-07-01 08:22:01 -0700335
336// split into multiple chunks, as MSVC++ complains if a single string is too long
337
Ethan Nicholas79707652017-11-16 11:20:11 -0500338STRINGIFY(
ethannicholasb3058bd2016-07-01 08:22:01 -0700339
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400340half4 texture($gsampler1D sampler, float2 P);
341half4 texture($gsampler1D sampler, float2 P, float bias);
342half4 texture($gsampler2D sampler, float3 P);
343half4 texture($gsampler2D sampler, float3 P, float bias);
ethannicholas471e8942016-10-28 09:02:46 -0700344/*
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400345$gfloat4 textureProj($gsampler3D sampler, float4 P);
346$gfloat4 textureProj($gsampler3D sampler, float4 P, float bias);
347float textureProj(sampler1DShadow sampler, float4 P);
348float textureProj(sampler1DShadow sampler, float4 P, float bias);
349float textureProj(sampler2DShadow sampler, float4 P);
350float textureProj(sampler2DShadow sampler, float4 P, float bias);
351$gfloat4 textureProj($gsampler2DRect sampler, float4 P);
352float textureProj(sampler2DRectShadow sampler, float4 P);
353$gfloat4 textureLod($gsampler1D sampler, float P, float lod);
354$gfloat4 textureLod($gsampler2D sampler, float2 P, float lod);
355$gfloat4 textureLod($gsampler3D sampler, float3 P, float lod);
356$gfloat4 textureLod($gsamplerCube sampler, float3 P, float lod);
357float textureLod(sampler1DShadow sampler, float3 P, float lod);
358float textureLod(sampler2DShadow sampler, float3 P, float lod);
359$gfloat4 textureLod($gsampler1DArray sampler, float2 P, float lod);
360$gfloat4 textureLod($gsampler2DArray sampler, float3 P, float lod);
361float textureLod(sampler1DArrayShadow sampler, float3 P, float lod);
362$gfloat4 textureLod($gsamplerCubeArray sampler, float4 P, float lod);
363$gfloat4 textureOffset($gsampler1D sampler, float P, int offset);
364$gfloat4 textureOffset($gsampler1D sampler, float P, int offset, float bias);
365$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset);
366$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset, float bias);
367$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset);
368$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset, float bias);
369$gfloat4 textureOffset($gsampler2DRect sampler, float2 P, int2 offset);
370float textureOffset(sampler2DRectShadow sampler, float3 P, int2 offset);
371float textureOffset(sampler1DShadow sampler, float3 P, int offset);
372float textureOffset(sampler1DShadow sampler, float3 P, int offset, float bias);
373float textureOffset(sampler2DShadow sampler, float3 P, int2 offset);
374float textureOffset(sampler2DShadow sampler, float3 P, int2 offset, float bias);
375$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset);
376$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset, float bias);
377$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset);
378$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset, float bias);
379float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset);
380float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset, float bias);
381float textureOffset(sampler2DArrayShadow sampler, float4 P, int2 offset);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400382float4 texelFetch(samplerBuffer sampler, int P);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400383$gfloat4 texelFetch($gsampler1D sampler, int P, int lod);
384$gfloat4 texelFetch($gsampler2D sampler, int2 P, int lod);
385$gfloat4 texelFetch($gsampler2DRect sampler, int2 P);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400386$gfloat4 texelFetch($gsampler3D sampler, int3 P, int lod);
387$gfloat4 texelFetch($gsampler1DArray sampler, int2 P, int lod);
388$gfloat4 texelFetch($gsampler2DArray sampler, int3 P, int lod);
389$gfloat4 texelFetch($gsampler2DMS sampler, int2 P, int sample);
390$gfloat4 texelFetch($gsampler2DMSArray sampler, int3 P, int sample);
391$gfloat4 texelFetchOffset($gsampler1D sampler, int P, int lod, int offset);
392$gfloat4 texelFetchOffset($gsampler2D sampler, int2 P, int lod, int2 offset);
393$gfloat4 texelFetchOffset($gsampler3D sampler, int3 P, int lod, int3 offset);
394$gfloat4 texelFetchOffset($gsampler2DRect sampler, int2 P, int2 offset);
395$gfloat4 texelFetchOffset($gsampler1DArray sampler, int2 P, int lod, int offset);
396$gfloat4 texelFetchOffset($gsampler2DArray sampler, int3 P, int lod, int2 offset);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400397$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset);
398$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset, float bias);
399$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset);
400$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset, float bias);
401$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset);
402$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset, float bias);
403$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset);
404$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset, float bias);
405$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset);
406$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset, float bias);
407$gfloat4 textureProjOffset($gsampler2DRect sampler, float3 P, int2 offset);
408$gfloat4 textureProjOffset($gsampler2DRect sampler, float4 P, int2 offset);
409float textureProjOffset(sampler2DRectShadow sampler, float4 P, int2 offset);
410float textureProjOffset(sampler1DShadow sampler, float4 P, int offset);
411float textureProjOffset(sampler1DShadow sampler, float4 P, int offset, float bias);
412float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset);
413float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset, float bias);
414$gfloat4 textureLodOffset($gsampler1D sampler, float P, float lod, int offset);
415$gfloat4 textureLodOffset($gsampler2D sampler, float2 P, float lod, int2 offset);
416$gfloat4 textureLodOffset($gsampler3D sampler, float3 P, float lod, int3 offset);
417float textureLodOffset(sampler1DShadow sampler, float3 P, float lod, int offset);
418float textureLodOffset(sampler2DShadow sampler, float3 P, float lod, int2 offset);
419$gfloat4 textureLodOffset($gsampler1DArray sampler, float2 P, float lod, int offset);
420$gfloat4 textureLodOffset($gsampler2DArray sampler, float3 P, float lod, int2 offset);
421float textureLodOffset(sampler1DArrayShadow sampler, float3 P, float lod, int offset);
422$gfloat4 textureProjLod($gsampler1D sampler, float2 P, float lod);
423$gfloat4 textureProjLod($gsampler1D sampler, float4 P, float lod);
424$gfloat4 textureProjLod($gsampler2D sampler, float3 P, float lod);
425$gfloat4 textureProjLod($gsampler2D sampler, float4 P, float lod);
426$gfloat4 textureProjLod($gsampler3D sampler, float4 P, float lod);
427float textureProjLod(sampler1DShadow sampler, float4 P, float lod);
428float textureProjLod(sampler2DShadow sampler, float4 P, float lod);
429$gfloat4 textureProjLodOffset($gsampler1D sampler, float2 P, float lod, int offset);
430$gfloat4 textureProjLodOffset($gsampler1D sampler, float4 P, float lod, int offset);
431$gfloat4 textureProjLodOffset($gsampler2D sampler, float3 P, float lod, int2 offset);
432$gfloat4 textureProjLodOffset($gsampler2D sampler, float4 P, float lod, int2 offset);
433$gfloat4 textureProjLodOffset($gsampler3D sampler, float4 P, float lod, int3 offset);
434float textureProjLodOffset(sampler1DShadow sampler, float4 P, float lod, int offset);
435float textureProjLodOffset(sampler2DShadow sampler, float4 P, float lod, int2 offset);
436$gfloat4 textureGrad($gsampler1D sampler, float P, float dPdx, float dPdy);
437$gfloat4 textureGrad($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy);
438$gfloat4 textureGrad($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy);
439$gfloat4 textureGrad($gsamplerCube sampler, float3 P, float3 dPdx, float3 dPdy);
440$gfloat4 textureGrad($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy);
441float textureGrad(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy);
442float textureGrad(sampler1DShadow sampler, float3 P, float dPdx, float dPdy);
443float textureGrad(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy);
444float textureGrad(samplerCubeShadow sampler, float4 P, float3 dPdx, float3 dPdy);
445$gfloat4 textureGrad($gsampler1DArray sampler, float2 P, float dPdx, float dPdy);
446$gfloat4 textureGrad($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy);
447float textureGrad(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy);
448float textureGrad(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy);
449$gfloat4 textureGrad($gsamplerCubeArray sampler, float4 P, float3 dPdx, float3 dPdy);
450$gfloat4 textureGradOffset($gsampler1D sampler, float P, float dPdx, float dPdy, int offset);
451$gfloat4 textureGradOffset($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
452$gfloat4 textureGradOffset($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy, int3 offset);
453$gfloat4 textureGradOffset($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
454float textureGradOffset(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
455float textureGradOffset(sampler1DShadow sampler, float3 P, float dPdx, float dPdy, int offset );
456float textureGradOffset(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
457$gfloat4 textureGradOffset($gsampler1DArray sampler, float2 P, float dPdx, float dPdy, int offset);
458$gfloat4 textureGradOffset($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
459float textureGradOffset(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy, int offset);
460float textureGradOffset(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
461$gfloat4 textureProjGrad($gsampler1D sampler, float2 P, float dPdx, float dPdy);
462$gfloat4 textureProjGrad($gsampler1D sampler, float4 P, float dPdx, float dPdy);
463$gfloat4 textureProjGrad($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy);
464$gfloat4 textureProjGrad($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy);
465$gfloat4 textureProjGrad($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy);
466$gfloat4 textureProjGrad($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy);
467$gfloat4 textureProjGrad($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy);
468float textureProjGrad(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy);
469float textureProjGrad(sampler1DShadow sampler, float4 P, float dPdx, float dPdy);
470float textureProjGrad(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy);
471$gfloat4 textureProjGradOffset($gsampler1D sampler, float2 P, float dPdx, float dPdy, int offset);
472$gfloat4 textureProjGradOffset($gsampler1D sampler, float4 P, float dPdx, float dPdy, int offset);
473$gfloat4 textureProjGradOffset($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
474$gfloat4 textureProjGradOffset($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
475$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
476$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
477float textureProjGradOffset(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
478$gfloat4 textureProjGradOffset($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy, int3 offset);
479float textureProjGradOffset(sampler1DShadow sampler, float4 P, float dPdx, float dPdy, int offset);
480float textureProjGradOffset(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
481$gfloat4 textureGather($gsampler2D sampler, float2 P);
482$gfloat4 textureGather($gsampler2D sampler, float2 P, int comp);
483$gfloat4 textureGather($gsampler2DArray sampler, float3 P);
484$gfloat4 textureGather($gsampler2DArray sampler, float3 P, int comp);
485$gfloat4 textureGather($gsamplerCube sampler, float3 P);
486$gfloat4 textureGather($gsamplerCube sampler, float3 P, int comp);
487$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P);
488$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P, int comp);
489$gfloat4 textureGather($gsampler2DRect sampler, float2 P);
490$gfloat4 textureGather($gsampler2DRect sampler, float2 P, int comp);
491float4 textureGather(sampler2DShadow sampler, float2 P, float refZ);
492float4 textureGather(sampler2DArrayShadow sampler, float3 P, float refZ);
493float4 textureGather(samplerCubeShadow sampler, float3 P, float refZ);
494float4 textureGather(samplerCubeArrayShadow sampler, float4 P, float refZ);
495float4 textureGather(sampler2DRectShadow sampler, float2 P, float refZ);
496$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset);
497$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset, int comp);
498$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset);
499$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset, int comp);
500$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset);
501$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset, int comp);
502float4 textureGatherOffset(sampler2DShadow sampler, float2 P, float refZ, int2 offset);
503float4 textureGatherOffset(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offset);
504float4 textureGatherOffset(sampler2DRectShadow sampler, float2 P, float refZ, int2 offset);
505$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4]);
506$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4], int comp);
507$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4]);
508$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4], int comp);
509$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4]);
510$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4], int comp);
511float4 textureGatherOffsets(sampler2DShadow sampler, float2 P, float refZ, int2 offsets[4]);
512float4 textureGatherOffsets(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offsets[4]);
513float4 textureGatherOffsets(sampler2DRectShadow sampler, float2 P, float refZ, int2 offsets[4]);
ethannicholasb3058bd2016-07-01 08:22:01 -0700514uint atomicCounterIncrement(atomic_uint c);
515uint atomicCounter(atomic_uint c);
516uint atomicAdd(inout uint mem, uint data);
517int atomicAdd(inout int mem, int data);
518uint atomicMin(inout uint mem, uint data);
519int atomicMin(inout int mem, int data);
520uint atomicMax(inout uint mem, uint data);
521int atomicMax(inout int mem, int data);
522uint atomicAnd(inout uint mem, uint data);
523int atomicAnd(inout int mem, int data);
524uint atomicOr(inout uint mem, uint data);
525int atomicOr(inout int mem, int data);
526uint atomicXor(inout uint mem, uint data);
527int atomicXor(inout int mem, int data);
528uint atomicExchange(inout uint mem, uint data);
529int atomicExchange(inout int mem, int data);
530uint atomicCompSwap(inout uint mem, uint compare, uint data);
531int atomicCompSwap(inout int mem, int compare, int data);
532*/
Brian Salomon2a51de82016-11-16 12:06:01 -0500533// section 8.12 Additional Image Functions will go here if and when we add
534// support for them
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400535float4 imageLoad(image2D image, int2 P);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400536int4 imageLoad(iimage2D image, int2 P);
ethannicholasb3058bd2016-07-01 08:22:01 -0700537$genType dFdx($genType p);
538$genType dFdy($genType p);
Chris Dalton09212192018-11-13 15:07:24 -0500539$genType fwidth($genType p);
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400540float interpolateAtSample(float interpolant, int sample);
541float2 interpolateAtSample(float2 interpolant, int sample);
542float3 interpolateAtSample(float3 interpolant, int sample);
543float4 interpolateAtSample(float4 interpolant, int sample);
544float interpolateAtOffset(float interpolant, float2 offset);
545float2 interpolateAtOffset(float2 interpolant, float2 offset);
546float3 interpolateAtOffset(float3 interpolant, float2 offset);
547float4 interpolateAtOffset(float4 interpolant, float2 offset);
ethannicholas471e8942016-10-28 09:02:46 -0700548
549/*
550$genType fwidth($genType p);
551$genType fwidthCoarse($genType p);
552$genType fwidthFine($genType p);
ethannicholasb3058bd2016-07-01 08:22:01 -0700553void barrier();
554void memoryBarrier();
555void memoryBarrierAtomicCounter();
556void memoryBarrierBuffer();
557void memoryBarrierShared();
558void memoryBarrierImage();
559void groupMemoryBarrier();
ethannicholas471e8942016-10-28 09:02:46 -0700560*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700561
Ethan Nicholas79707652017-11-16 11:20:11 -0500562)