blob: 5d905e3435eec05010949f7ad26f2f2dd731d6f4 [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -07001STRINGIFY(
2
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);
ethannicholasb3058bd2016-07-01 08:22:01 -070046$genType mod($genType x, float y);
47$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);
53$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);
61$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);
69$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);
ethannicholasb3058bd2016-07-01 08:22:01 -070076$genType mix($genType x, $genType y, $genType a);
77$genType mix($genType x, $genType y, float a);
ethannicholas471e8942016-10-28 09:02:46 -070078//$genDType mix($genDType x, $genDType y, $genDType a);
79//$genDType mix($genDType x, $genDType y, double a);
ethannicholasb3058bd2016-07-01 08:22:01 -070080$genType mix($genType x, $genType y, $genBType a);
ethannicholas471e8942016-10-28 09:02:46 -070081//$genDType mix($genDType x, $genDType y, $genBType a);
ethannicholasb3058bd2016-07-01 08:22:01 -070082$genIType mix($genIType x, $genIType y, $genBType a);
ethannicholas471e8942016-10-28 09:02:46 -070083//$genUType mix($genUType x, $genUType y, $genBType a);
ethannicholasb3058bd2016-07-01 08:22:01 -070084$genBType mix($genBType x, $genBType y, $genBType a);
85$genType step($genType edge, $genType x);
86$genType step(float edge, $genType x);
ethannicholas471e8942016-10-28 09:02:46 -070087//$genDType step($genDType edge, $genDType x);
88//$genDType step(double edge, $genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070089$genType smoothstep($genType edge0, $genType edge1, $genType x);
90$genType smoothstep(float edge0, float edge1, $genType x);
ethannicholas471e8942016-10-28 09:02:46 -070091//$genDType smoothstep($genDType edge0, $genDType edge1, $genDType x);
92//$genDType smoothstep(double edge0, double edge1, $genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -070093$genBType isnan($genType x);
94$genBType isnan($genDType x);
95$genBType isinf($genType x);
96$genBType isinf($genDType x);
97$genIType floatBitsToInt($genType value);
ethannicholas471e8942016-10-28 09:02:46 -070098//$genUType floatBitsToUint($genType value);
ethannicholasb3058bd2016-07-01 08:22:01 -070099$genType intBitsToFloat($genIType value);
100$genType uintBitsToFloat($genUType value);
101$genType fma($genType a, $genType b, $genType c);
ethannicholas471e8942016-10-28 09:02:46 -0700102//$genDType fma($genDType a, $genDType b, $genDType c);
ethannicholasb3058bd2016-07-01 08:22:01 -0700103$genType frexp($genType x, out $genIType exp);
ethannicholas471e8942016-10-28 09:02:46 -0700104//$genDType frexp($genDType x, out $genIType exp);
ethannicholasb3058bd2016-07-01 08:22:01 -0700105$genType ldexp($genType x, in $genIType exp);
ethannicholas471e8942016-10-28 09:02:46 -0700106//$genDType ldexp($genDType x, in $genIType exp);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400107uint packUnorm2x16(float2 v);
108uint packSnorm2x16(float2 v);
109uint packUnorm4x8(float4 v);
110uint packSnorm4x8(float4 v);
111float2 unpackUnorm2x16(uint p);
112float2 unpackSnorm2x16(uint p);
113float4 unpackUnorm4x8(uint p);
114float4 unpackSnorm4x8(uint p);
115//double packDouble2x32(uint2 v);
116uint2 unpackDouble2x32(double v);
117uint packHalf2x16(float2 v);
118float2 unpackHalf2x16(uint v);
ethannicholasb3058bd2016-07-01 08:22:01 -0700119float length($genType x);
ethannicholas471e8942016-10-28 09:02:46 -0700120//double length($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -0700121float distance($genType p0, $genType p1);
ethannicholas471e8942016-10-28 09:02:46 -0700122//double distance($genDType p0, $genDType p1);
ethannicholasb3058bd2016-07-01 08:22:01 -0700123float dot($genType x, $genType y);
ethannicholas471e8942016-10-28 09:02:46 -0700124//double dot($genDType x, $genDType y);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400125float3 cross(float3 x, float3 y);
126//double3 cross(double3 x, double3 y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700127$genType normalize($genType x);
ethannicholas471e8942016-10-28 09:02:46 -0700128//$genDType normalize($genDType x);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400129float4 ftransform();
ethannicholasb3058bd2016-07-01 08:22:01 -0700130$genType faceforward($genType N, $genType I, $genType Nref);
ethannicholas471e8942016-10-28 09:02:46 -0700131//$genDType faceforward($genDType N, $genDType I, $genDType Nref);
ethannicholasb3058bd2016-07-01 08:22:01 -0700132$genType reflect($genType I, $genType N);
ethannicholas471e8942016-10-28 09:02:46 -0700133//$genDType reflect($genDType I, $genDType N);
ethannicholasb3058bd2016-07-01 08:22:01 -0700134$genType refract($genType I, $genType N, float eta);
ethannicholas471e8942016-10-28 09:02:46 -0700135//$genDType refract($genDType I, $genDType N, float eta);
ethannicholasb3058bd2016-07-01 08:22:01 -0700136$mat matrixCompMult($mat x, $mat y);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400137float2x2 outerProduct(float2 c, float2 r);
138float3x3 outerProduct(float3 c, float3 r);
139float4x3 outerProduct(float4 c, float4 r);
140float2x3 outerProduct(float3 c, float2 r);
141float3x2 outerProduct(float2 c, float3 r);
142float2x4 outerProduct(float4 c, float2 r);
143float4x2 outerProduct(float2 c, float4 r);
144float3x4 outerProduct(float4 c, float3 r);
145float4x3 outerProduct(float3 c, float4 r);
146float2x2 transpose(float2x2 m);
147float3x3 transpose(float3x3 m);
148float4x4 transpose(float4x4 m);
149float2x3 transpose(float3x2 m);
150float3x2 transpose(float2x3 m);
151float2x4 transpose(float4x2 m);
152float4x2 transpose(float2x4 m);
153float3x4 transpose(float4x3 m);
154float4x3 transpose(float3x4 m);
155float determinant(float2x2 m);
156float determinant(float3x3 m);
157float determinant(float4x4 m);
158float2x2 inverse(float2x2 m);
159float3x3 inverse(float3x3 m);
160float4x4 inverse(float4x4 m);
ethannicholasb3058bd2016-07-01 08:22:01 -0700161$bvec lessThan($vec x, $vec y);
162$bvec lessThan($ivec x, $ivec y);
163$bvec lessThan($uvec x, $uvec y);
164$bvec lessThanEqual($vec x, $vec y);
165$bvec lessThanEqual($ivec x, $ivec y);
166$bvec lessThanEqual($uvec x, $uvec y);
167$bvec greaterThan($vec x, $vec y);
168$bvec greaterThan($ivec x, $ivec y);
169$bvec greaterThan($uvec x, $uvec y);
170$bvec greaterThanEqual($vec x, $vec y);
171$bvec greaterThanEqual($ivec x, $ivec y);
172$bvec greaterThanEqual($uvec x, $uvec y);
173$bvec equal($vec x, $vec y);
174$bvec equal($ivec x, $ivec y);
175$bvec equal($uvec x, $uvec y);
176$bvec equal($bvec x, $bvec y);
177$bvec notEqual($vec x, $vec y);
178$bvec notEqual($ivec x, $ivec y);
179$bvec notEqual($uvec x, $uvec y);
180$bvec notEqual($bvec x, $bvec y);
181bool any($bvec x);
182bool all($bvec x);
183$bvec not($bvec x);
ethannicholas471e8942016-10-28 09:02:46 -0700184
ethannicholasb3058bd2016-07-01 08:22:01 -0700185$genIType bitCount($genIType value);
186$genIType bitCount($genUType value);
187$genIType findLSB($genIType value);
188$genIType findLSB($genUType value);
189$genIType findMSB($genIType value);
190$genIType findMSB($genUType value);
ethannicholas471e8942016-10-28 09:02:46 -0700191
192/*
193//$genUType uaddCarry($genUType x, $genUType y, out $genUType carry);
194//$genUType usubBorrow($genUType x, $genUType y, out $genUType borrow);
195void umulExtended($genUType x, $genUType y, out $genUType msb, out $genUType lsb);
196void imulExtended($genIType x, $genIType y, out $genIType msb, out $genIType lsb);
197$genIType bitfieldExtract($genIType value, int offset, int bits);
198//$genUType bitfieldExtract($genUType value, int offset, int bits);
199$genIType bitfieldInsert($genIType base, $genIType insert, int offset, int bits);
200//$genUType bitfieldInsert($genUType base, $genUType insert, int offset, int bits);
201$genIType bitfieldReverse($genIType value);
202//$genUType bitfieldReverse($genUType value);
ethannicholasb3058bd2016-07-01 08:22:01 -0700203int textureSize($gsampler1D sampler, int lod);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400204int2 textureSize($gsampler2D sampler, int lod);
205int3 textureSize($gsampler3D sampler, int lod);
206int2 textureSize($gsamplerCube sampler, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700207int textureSize(sampler1DShadow sampler, int lod);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400208int2 textureSize(sampler2DShadow sampler, int lod);
209int2 textureSize(samplerCubeShadow sampler, int lod);
210int3 textureSize($gsamplerCubeArray sampler, int lod);
211int3 textureSize(samplerCubeArrayShadow sampler, int lod);
ethannicholas471e8942016-10-28 09:02:46 -0700212*/
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400213int2 textureSize($gsampler2DRect sampler);
ethannicholas471e8942016-10-28 09:02:46 -0700214/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400215int2 textureSize(sampler2DRectShadow sampler);
216int2 textureSize($gsampler1DArray sampler, int lod);
217int3 textureSize($gsampler2DArray sampler, int lod);
218int2 textureSize(sampler1DArrayShadow sampler, int lod);
219int3 textureSize(sampler2DArrayShadow sampler, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700220int textureSize($gsamplerBuffer sampler);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400221int2 textureSize($gsampler2DMS sampler);
222int3 textureSize($gsampler2DMSArray sampler);
223float2 textureQueryLod($gsampler1D sampler, float P);
224float2 textureQueryLod($gsampler2D sampler, float2 P);
225float2 textureQueryLod($gsampler3D sampler, float3 P);
226float2 textureQueryLod($gsamplerCube sampler, float3 P);
227float2 textureQueryLod($gsampler1DArray sampler, float P);
228float2 textureQueryLod($gsampler2DArray sampler, float2 P);
229float2 textureQueryLod($gsamplerCubeArray sampler, float3 P);
230float2 textureQueryLod(sampler1DShadow sampler, float P);
231float2 textureQueryLod(sampler2DShadow sampler, float2 P);
232float2 textureQueryLod(samplerCubeShadow sampler, float3 P);
233float2 textureQueryLod(sampler1DArrayShadow sampler, float P);
234float2 textureQueryLod(sampler2DArrayShadow sampler, float2 P);
235float2 textureQueryLod(samplerCubeArrayShadow sampler, float3 P);
ethannicholasb3058bd2016-07-01 08:22:01 -0700236int textureQueryLevels($gsampler1D sampler);
237int textureQueryLevels($gsampler2D sampler);
238int textureQueryLevels($gsampler3D sampler);
239int textureQueryLevels($gsamplerCube sampler);
240int textureQueryLevels($gsampler1DArray sampler);
241int textureQueryLevels($gsampler2DArray sampler);
242int textureQueryLevels($gsamplerCubeArray sampler);
243int textureQueryLevels(sampler1DShadow sampler);
244int textureQueryLevels(sampler2DShadow sampler);
245int textureQueryLevels(samplerCubeShadow sampler);
246int textureQueryLevels(sampler1DArrayShadow sampler);
247int textureQueryLevels(sampler2DArrayShadow sampler);
248int textureQueryLevels(samplerCubeArrayShadow sampler);
ethannicholas471e8942016-10-28 09:02:46 -0700249*/
250
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400251$gfloat4 texture($gsampler1D sampler, float P);
252$gfloat4 texture($gsampler1D sampler, float P, float bias);
253$gfloat4 texture($gsampler2D sampler, float2 P);
Brian Salomonbf7b6202016-11-11 16:08:03 -0500254// The above currently only expand to handle the float/fixed case. So we also declare this integer
255// version of texture().
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400256int4 texture(isampler2D sampler, float2 P);
257float4 texture(samplerExternalOES sampler, float2 P, float bias);
258float4 texture(samplerExternalOES sampler, float2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700259
260/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400261$gfloat4 texture($gsampler2D sampler, float2 P, float bias);
262$gfloat4 texture($gsampler3D sampler, float3 P);
263$gfloat4 texture($gsampler3D sampler, float3 P, float bias);
264$gfloat4 texture($gsamplerCube sampler, float3 P);
265$gfloat4 texture($gsamplerCube sampler, float3 P, float bias);
266float texture(sampler1DShadow sampler, float3 P);
267float texture(sampler1DShadow sampler, float3 P, float bias);
268float texture(sampler2DShadow sampler, float3 P);
269float texture(sampler2DShadow sampler, float3 P, float bias);
270float texture(samplerCubeShadow sampler, float4 P);
271float texture(samplerCubeShadow sampler, float4 P, float bias);
272$gfloat4 texture($gsampler1DArray sampler, float2 P);
273$gfloat4 texture($gsampler1DArray sampler, float2 P, float bias);
274$gfloat4 texture($gsampler2DArray sampler, float3 P);
275$gfloat4 texture($gsampler2DArray sampler, float3 P, float bias);
276$gfloat4 texture($gsamplerCubeArray sampler, float4 P);
277$gfloat4 texture($gsamplerCubeArray sampler, float4 P, float bias);
278float texture(sampler1DArrayShadow sampler, float3 P);
279float texture(sampler1DArrayShadow sampler, float3 P, float bias);
280float texture(sampler2DArrayShadow sampler, float4 P);
ethannicholas471e8942016-10-28 09:02:46 -0700281*/
282
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400283$gfloat4 texture($gsampler2DRect sampler, float2 P);
284$gfloat4 texture($gsampler2DRect sampler, float3 P);
ethannicholas471e8942016-10-28 09:02:46 -0700285
286/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400287float texture(sampler2DRectShadow sampler, float3 P);
288float texture($gsamplerCubeArrayShadow sampler, float4 P, float compare);
ethannicholas471e8942016-10-28 09:02:46 -0700289*/
Greg Daniel64773e62016-11-22 09:44:03 -0500290
291// Currently we do not support the generic types of loading subpassInput so we have some explicit
292// versions that we currently use
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400293float4 subpassLoad(subpassInput subpass);
294float4 subpassLoad(subpassInputMS subpass, int sample);
Greg Daniel64773e62016-11-22 09:44:03 -0500295/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400296$gfloat4subpassLoad(gsubpassInput subpass);
297$gfloat4subpassLoad(gsubpassInputMS subpass, int sample);
Greg Daniel64773e62016-11-22 09:44:03 -0500298*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700299)
300
301// split into multiple chunks, as MSVC++ complains if a single string is too long
302
303STRINGIFY(
304
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400305$gfloat4 texture($gsampler1D sampler, float2 P);
306$gfloat4 texture($gsampler1D sampler, float2 P, float bias);
307$gfloat4 texture($gsampler2D sampler, float3 P);
308$gfloat4 texture($gsampler2D sampler, float3 P, float bias);
ethannicholas471e8942016-10-28 09:02:46 -0700309/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400310$gfloat4 textureProj($gsampler3D sampler, float4 P);
311$gfloat4 textureProj($gsampler3D sampler, float4 P, float bias);
312float textureProj(sampler1DShadow sampler, float4 P);
313float textureProj(sampler1DShadow sampler, float4 P, float bias);
314float textureProj(sampler2DShadow sampler, float4 P);
315float textureProj(sampler2DShadow sampler, float4 P, float bias);
316$gfloat4 textureProj($gsampler2DRect sampler, float4 P);
317float textureProj(sampler2DRectShadow sampler, float4 P);
318$gfloat4 textureLod($gsampler1D sampler, float P, float lod);
319$gfloat4 textureLod($gsampler2D sampler, float2 P, float lod);
320$gfloat4 textureLod($gsampler3D sampler, float3 P, float lod);
321$gfloat4 textureLod($gsamplerCube sampler, float3 P, float lod);
322float textureLod(sampler1DShadow sampler, float3 P, float lod);
323float textureLod(sampler2DShadow sampler, float3 P, float lod);
324$gfloat4 textureLod($gsampler1DArray sampler, float2 P, float lod);
325$gfloat4 textureLod($gsampler2DArray sampler, float3 P, float lod);
326float textureLod(sampler1DArrayShadow sampler, float3 P, float lod);
327$gfloat4 textureLod($gsamplerCubeArray sampler, float4 P, float lod);
328$gfloat4 textureOffset($gsampler1D sampler, float P, int offset);
329$gfloat4 textureOffset($gsampler1D sampler, float P, int offset, float bias);
330$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset);
331$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset, float bias);
332$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset);
333$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset, float bias);
334$gfloat4 textureOffset($gsampler2DRect sampler, float2 P, int2 offset);
335float textureOffset(sampler2DRectShadow sampler, float3 P, int2 offset);
336float textureOffset(sampler1DShadow sampler, float3 P, int offset);
337float textureOffset(sampler1DShadow sampler, float3 P, int offset, float bias);
338float textureOffset(sampler2DShadow sampler, float3 P, int2 offset);
339float textureOffset(sampler2DShadow sampler, float3 P, int2 offset, float bias);
340$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset);
341$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset, float bias);
342$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset);
343$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset, float bias);
344float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset);
345float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset, float bias);
346float textureOffset(sampler2DArrayShadow sampler, float4 P, int2 offset);
ethannicholas471e8942016-10-28 09:02:46 -0700347*/
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400348float4 texelFetch(samplerBuffer sampler, int P);
Ethan Nicholas0187ae62017-05-03 11:03:44 -0400349
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400350$gfloat4 texelFetch($gsampler1D sampler, int P, int lod);
351$gfloat4 texelFetch($gsampler2D sampler, int2 P, int lod);
352$gfloat4 texelFetch($gsampler2DRect sampler, int2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700353/*
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400354$gfloat4 texelFetch($gsampler3D sampler, int3 P, int lod);
355$gfloat4 texelFetch($gsampler1DArray sampler, int2 P, int lod);
356$gfloat4 texelFetch($gsampler2DArray sampler, int3 P, int lod);
357$gfloat4 texelFetch($gsampler2DMS sampler, int2 P, int sample);
358$gfloat4 texelFetch($gsampler2DMSArray sampler, int3 P, int sample);
359$gfloat4 texelFetchOffset($gsampler1D sampler, int P, int lod, int offset);
360$gfloat4 texelFetchOffset($gsampler2D sampler, int2 P, int lod, int2 offset);
361$gfloat4 texelFetchOffset($gsampler3D sampler, int3 P, int lod, int3 offset);
362$gfloat4 texelFetchOffset($gsampler2DRect sampler, int2 P, int2 offset);
363$gfloat4 texelFetchOffset($gsampler1DArray sampler, int2 P, int lod, int offset);
364$gfloat4 texelFetchOffset($gsampler2DArray sampler, int3 P, int lod, int2 offset);
365$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset);
366$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset, float bias);
367$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset);
368$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset, float bias);
369$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset);
370$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset, float bias);
371$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset);
372$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset, float bias);
373$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset);
374$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset, float bias);
375$gfloat4 textureProjOffset($gsampler2DRect sampler, float3 P, int2 offset);
376$gfloat4 textureProjOffset($gsampler2DRect sampler, float4 P, int2 offset);
377float textureProjOffset(sampler2DRectShadow sampler, float4 P, int2 offset);
378float textureProjOffset(sampler1DShadow sampler, float4 P, int offset);
379float textureProjOffset(sampler1DShadow sampler, float4 P, int offset, float bias);
380float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset);
381float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset, float bias);
382$gfloat4 textureLodOffset($gsampler1D sampler, float P, float lod, int offset);
383$gfloat4 textureLodOffset($gsampler2D sampler, float2 P, float lod, int2 offset);
384$gfloat4 textureLodOffset($gsampler3D sampler, float3 P, float lod, int3 offset);
385float textureLodOffset(sampler1DShadow sampler, float3 P, float lod, int offset);
386float textureLodOffset(sampler2DShadow sampler, float3 P, float lod, int2 offset);
387$gfloat4 textureLodOffset($gsampler1DArray sampler, float2 P, float lod, int offset);
388$gfloat4 textureLodOffset($gsampler2DArray sampler, float3 P, float lod, int2 offset);
389float textureLodOffset(sampler1DArrayShadow sampler, float3 P, float lod, int offset);
390$gfloat4 textureProjLod($gsampler1D sampler, float2 P, float lod);
391$gfloat4 textureProjLod($gsampler1D sampler, float4 P, float lod);
392$gfloat4 textureProjLod($gsampler2D sampler, float3 P, float lod);
393$gfloat4 textureProjLod($gsampler2D sampler, float4 P, float lod);
394$gfloat4 textureProjLod($gsampler3D sampler, float4 P, float lod);
395float textureProjLod(sampler1DShadow sampler, float4 P, float lod);
396float textureProjLod(sampler2DShadow sampler, float4 P, float lod);
397$gfloat4 textureProjLodOffset($gsampler1D sampler, float2 P, float lod, int offset);
398$gfloat4 textureProjLodOffset($gsampler1D sampler, float4 P, float lod, int offset);
399$gfloat4 textureProjLodOffset($gsampler2D sampler, float3 P, float lod, int2 offset);
400$gfloat4 textureProjLodOffset($gsampler2D sampler, float4 P, float lod, int2 offset);
401$gfloat4 textureProjLodOffset($gsampler3D sampler, float4 P, float lod, int3 offset);
402float textureProjLodOffset(sampler1DShadow sampler, float4 P, float lod, int offset);
403float textureProjLodOffset(sampler2DShadow sampler, float4 P, float lod, int2 offset);
404$gfloat4 textureGrad($gsampler1D sampler, float P, float dPdx, float dPdy);
405$gfloat4 textureGrad($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy);
406$gfloat4 textureGrad($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy);
407$gfloat4 textureGrad($gsamplerCube sampler, float3 P, float3 dPdx, float3 dPdy);
408$gfloat4 textureGrad($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy);
409float textureGrad(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy);
410float textureGrad(sampler1DShadow sampler, float3 P, float dPdx, float dPdy);
411float textureGrad(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy);
412float textureGrad(samplerCubeShadow sampler, float4 P, float3 dPdx, float3 dPdy);
413$gfloat4 textureGrad($gsampler1DArray sampler, float2 P, float dPdx, float dPdy);
414$gfloat4 textureGrad($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy);
415float textureGrad(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy);
416float textureGrad(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy);
417$gfloat4 textureGrad($gsamplerCubeArray sampler, float4 P, float3 dPdx, float3 dPdy);
418$gfloat4 textureGradOffset($gsampler1D sampler, float P, float dPdx, float dPdy, int offset);
419$gfloat4 textureGradOffset($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
420$gfloat4 textureGradOffset($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy, int3 offset);
421$gfloat4 textureGradOffset($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
422float textureGradOffset(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
423float textureGradOffset(sampler1DShadow sampler, float3 P, float dPdx, float dPdy, int offset );
424float textureGradOffset(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
425$gfloat4 textureGradOffset($gsampler1DArray sampler, float2 P, float dPdx, float dPdy, int offset);
426$gfloat4 textureGradOffset($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
427float textureGradOffset(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy, int offset);
428float textureGradOffset(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
429$gfloat4 textureProjGrad($gsampler1D sampler, float2 P, float dPdx, float dPdy);
430$gfloat4 textureProjGrad($gsampler1D sampler, float4 P, float dPdx, float dPdy);
431$gfloat4 textureProjGrad($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy);
432$gfloat4 textureProjGrad($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy);
433$gfloat4 textureProjGrad($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy);
434$gfloat4 textureProjGrad($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy);
435$gfloat4 textureProjGrad($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy);
436float textureProjGrad(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy);
437float textureProjGrad(sampler1DShadow sampler, float4 P, float dPdx, float dPdy);
438float textureProjGrad(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy);
439$gfloat4 textureProjGradOffset($gsampler1D sampler, float2 P, float dPdx, float dPdy, int offset);
440$gfloat4 textureProjGradOffset($gsampler1D sampler, float4 P, float dPdx, float dPdy, int offset);
441$gfloat4 textureProjGradOffset($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
442$gfloat4 textureProjGradOffset($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
443$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
444$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
445float textureProjGradOffset(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
446$gfloat4 textureProjGradOffset($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy, int3 offset);
447float textureProjGradOffset(sampler1DShadow sampler, float4 P, float dPdx, float dPdy, int offset);
448float textureProjGradOffset(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
449$gfloat4 textureGather($gsampler2D sampler, float2 P);
450$gfloat4 textureGather($gsampler2D sampler, float2 P, int comp);
451$gfloat4 textureGather($gsampler2DArray sampler, float3 P);
452$gfloat4 textureGather($gsampler2DArray sampler, float3 P, int comp);
453$gfloat4 textureGather($gsamplerCube sampler, float3 P);
454$gfloat4 textureGather($gsamplerCube sampler, float3 P, int comp);
455$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P);
456$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P, int comp);
457$gfloat4 textureGather($gsampler2DRect sampler, float2 P);
458$gfloat4 textureGather($gsampler2DRect sampler, float2 P, int comp);
459float4 textureGather(sampler2DShadow sampler, float2 P, float refZ);
460float4 textureGather(sampler2DArrayShadow sampler, float3 P, float refZ);
461float4 textureGather(samplerCubeShadow sampler, float3 P, float refZ);
462float4 textureGather(samplerCubeArrayShadow sampler, float4 P, float refZ);
463float4 textureGather(sampler2DRectShadow sampler, float2 P, float refZ);
464$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset);
465$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset, int comp);
466$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset);
467$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset, int comp);
468$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset);
469$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset, int comp);
470float4 textureGatherOffset(sampler2DShadow sampler, float2 P, float refZ, int2 offset);
471float4 textureGatherOffset(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offset);
472float4 textureGatherOffset(sampler2DRectShadow sampler, float2 P, float refZ, int2 offset);
473$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4]);
474$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4], int comp);
475$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4]);
476$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4], int comp);
477$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4]);
478$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4], int comp);
479float4 textureGatherOffsets(sampler2DShadow sampler, float2 P, float refZ, int2 offsets[4]);
480float4 textureGatherOffsets(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offsets[4]);
481float4 textureGatherOffsets(sampler2DRectShadow sampler, float2 P, float refZ, int2 offsets[4]);
ethannicholasb3058bd2016-07-01 08:22:01 -0700482uint atomicCounterIncrement(atomic_uint c);
483uint atomicCounter(atomic_uint c);
484uint atomicAdd(inout uint mem, uint data);
485int atomicAdd(inout int mem, int data);
486uint atomicMin(inout uint mem, uint data);
487int atomicMin(inout int mem, int data);
488uint atomicMax(inout uint mem, uint data);
489int atomicMax(inout int mem, int data);
490uint atomicAnd(inout uint mem, uint data);
491int atomicAnd(inout int mem, int data);
492uint atomicOr(inout uint mem, uint data);
493int atomicOr(inout int mem, int data);
494uint atomicXor(inout uint mem, uint data);
495int atomicXor(inout int mem, int data);
496uint atomicExchange(inout uint mem, uint data);
497int atomicExchange(inout int mem, int data);
498uint atomicCompSwap(inout uint mem, uint compare, uint data);
499int atomicCompSwap(inout int mem, int compare, int data);
500*/
Brian Salomon2a51de82016-11-16 12:06:01 -0500501// section 8.12 Additional Image Functions will go here if and when we add
502// support for them
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400503float4 imageLoad(image2D image, int2 P);
504int4 imageLoad(iimage2D image, int2 P);
ethannicholasb3058bd2016-07-01 08:22:01 -0700505$genType dFdx($genType p);
506$genType dFdy($genType p);
ethannicholasb3058bd2016-07-01 08:22:01 -0700507float interpolateAtSample(float interpolant, int sample);
Ethan Nicholas5af9ea32017-07-28 15:19:46 -0400508float2 interpolateAtSample(float2 interpolant, int sample);
509float3 interpolateAtSample(float3 interpolant, int sample);
510float4 interpolateAtSample(float4 interpolant, int sample);
511float interpolateAtOffset(float interpolant, float2 offset);
512float2 interpolateAtOffset(float2 interpolant, float2 offset);
513float3 interpolateAtOffset(float3 interpolant, float2 offset);
514float4 interpolateAtOffset(float4 interpolant, float2 offset);
ethannicholas471e8942016-10-28 09:02:46 -0700515
516/*
517$genType fwidth($genType p);
518$genType fwidthCoarse($genType p);
519$genType fwidthFine($genType p);
ethannicholasb3058bd2016-07-01 08:22:01 -0700520void barrier();
521void memoryBarrier();
522void memoryBarrierAtomicCounter();
523void memoryBarrierBuffer();
524void memoryBarrierShared();
525void memoryBarrierImage();
526void groupMemoryBarrier();
ethannicholas471e8942016-10-28 09:02:46 -0700527*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700528
Mike Klein600c6a72016-09-27 11:21:15 -0400529)
530