blob: f57e62aa18a55630f3321c0a913caf6d7dd4d031 [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);
ethannicholasb3058bd2016-07-01 08:22:01 -0700107uint packUnorm2x16(vec2 v);
108uint packSnorm2x16(vec2 v);
109uint packUnorm4x8(vec4 v);
110uint packSnorm4x8(vec4 v);
111vec2 unpackUnorm2x16(uint p);
112vec2 unpackSnorm2x16(uint p);
113vec4 unpackUnorm4x8(uint p);
114vec4 unpackSnorm4x8(uint p);
ethannicholas471e8942016-10-28 09:02:46 -0700115//double packDouble2x32(uvec2 v);
ethannicholasb3058bd2016-07-01 08:22:01 -0700116uvec2 unpackDouble2x32(double v);
117uint packHalf2x16(vec2 v);
118vec2 unpackHalf2x16(uint v);
119float 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);
ethannicholasb3058bd2016-07-01 08:22:01 -0700125vec3 cross(vec3 x, vec3 y);
ethannicholas471e8942016-10-28 09:02:46 -0700126//dvec3 cross(dvec3 x, dvec3 y);
ethannicholasb3058bd2016-07-01 08:22:01 -0700127$genType normalize($genType x);
ethannicholas471e8942016-10-28 09:02:46 -0700128//$genDType normalize($genDType x);
ethannicholasb3058bd2016-07-01 08:22:01 -0700129vec4 ftransform();
130$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);
137mat2 outerProduct(vec2 c, vec2 r);
138mat3 outerProduct(vec3 c, vec3 r);
139mat4 outerProduct(vec4 c, vec4 r);
140mat2x3 outerProduct(vec3 c, vec2 r);
141mat3x2 outerProduct(vec2 c, vec3 r);
142mat2x4 outerProduct(vec4 c, vec2 r);
143mat4x2 outerProduct(vec2 c, vec4 r);
144mat3x4 outerProduct(vec4 c, vec3 r);
145mat4x3 outerProduct(vec3 c, vec4 r);
146mat2 transpose(mat2 m);
147mat3 transpose(mat3 m);
148mat4 transpose(mat4 m);
149mat2x3 transpose(mat3x2 m);
150mat3x2 transpose(mat2x3 m);
151mat2x4 transpose(mat4x2 m);
152mat4x2 transpose(mat2x4 m);
153mat3x4 transpose(mat4x3 m);
154mat4x3 transpose(mat3x4 m);
155float determinant(mat2 m);
156float determinant(mat3 m);
157float determinant(mat4 m);
158mat2 inverse(mat2 m);
159mat3 inverse(mat3 m);
160mat4 inverse(mat4 m);
161$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);
204ivec2 textureSize($gsampler2D sampler, int lod);
205ivec3 textureSize($gsampler3D sampler, int lod);
206ivec2 textureSize($gsamplerCube sampler, int lod);
207int textureSize(sampler1DShadow sampler, int lod);
208ivec2 textureSize(sampler2DShadow sampler, int lod);
209ivec2 textureSize(samplerCubeShadow sampler, int lod);
210ivec3 textureSize($gsamplerCubeArray sampler, int lod);
211ivec3 textureSize(samplerCubeArrayShadow sampler, int lod);
ethannicholas471e8942016-10-28 09:02:46 -0700212*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700213ivec2 textureSize($gsampler2DRect sampler);
ethannicholas471e8942016-10-28 09:02:46 -0700214/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700215ivec2 textureSize(sampler2DRectShadow sampler);
216ivec2 textureSize($gsampler1DArray sampler, int lod);
217ivec3 textureSize($gsampler2DArray sampler, int lod);
218ivec2 textureSize(sampler1DArrayShadow sampler, int lod);
219ivec3 textureSize(sampler2DArrayShadow sampler, int lod);
220int textureSize($gsamplerBuffer sampler);
221ivec2 textureSize($gsampler2DMS sampler);
222ivec3 textureSize($gsampler2DMSArray sampler);
223vec2 textureQueryLod($gsampler1D sampler, float P);
224vec2 textureQueryLod($gsampler2D sampler, vec2 P);
225vec2 textureQueryLod($gsampler3D sampler, vec3 P);
226vec2 textureQueryLod($gsamplerCube sampler, vec3 P);
227vec2 textureQueryLod($gsampler1DArray sampler, float P);
228vec2 textureQueryLod($gsampler2DArray sampler, vec2 P);
229vec2 textureQueryLod($gsamplerCubeArray sampler, vec3 P);
230vec2 textureQueryLod(sampler1DShadow sampler, float P);
231vec2 textureQueryLod(sampler2DShadow sampler, vec2 P);
232vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P);
233vec2 textureQueryLod(sampler1DArrayShadow sampler, float P);
234vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P);
235vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P);
236int 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
ethannicholasb3058bd2016-07-01 08:22:01 -0700251$gvec4 texture($gsampler1D sampler, float P);
252$gvec4 texture($gsampler1D sampler, float P, float bias);
253$gvec4 texture($gsampler2D sampler, vec2 P);
ethannicholas5961bc92016-10-12 06:39:56 -0700254vec4 texture(samplerExternalOES sampler, vec2 P, float bias);
255vec4 texture(samplerExternalOES sampler, vec2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700256
257/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700258$gvec4 texture($gsampler2D sampler, vec2 P, float bias);
259$gvec4 texture($gsampler3D sampler, vec3 P);
260$gvec4 texture($gsampler3D sampler, vec3 P, float bias);
261$gvec4 texture($gsamplerCube sampler, vec3 P);
262$gvec4 texture($gsamplerCube sampler, vec3 P, float bias);
263float texture(sampler1DShadow sampler, vec3 P);
264float texture(sampler1DShadow sampler, vec3 P, float bias);
265float texture(sampler2DShadow sampler, vec3 P);
266float texture(sampler2DShadow sampler, vec3 P, float bias);
267float texture(samplerCubeShadow sampler, vec4 P);
268float texture(samplerCubeShadow sampler, vec4 P, float bias);
269$gvec4 texture($gsampler1DArray sampler, vec2 P);
270$gvec4 texture($gsampler1DArray sampler, vec2 P, float bias);
271$gvec4 texture($gsampler2DArray sampler, vec3 P);
272$gvec4 texture($gsampler2DArray sampler, vec3 P, float bias);
273$gvec4 texture($gsamplerCubeArray sampler, vec4 P);
274$gvec4 texture($gsamplerCubeArray sampler, vec4 P, float bias);
275float texture(sampler1DArrayShadow sampler, vec3 P);
276float texture(sampler1DArrayShadow sampler, vec3 P, float bias);
277float texture(sampler2DArrayShadow sampler, vec4 P);
ethannicholas471e8942016-10-28 09:02:46 -0700278*/
279
ethannicholasb3058bd2016-07-01 08:22:01 -0700280$gvec4 texture($gsampler2DRect sampler, vec2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700281
282/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700283float texture(sampler2DRectShadow sampler, vec3 P);
284float texture($gsamplerCubeArrayShadow sampler, vec4 P, float compare);
ethannicholas471e8942016-10-28 09:02:46 -0700285*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700286)
287
288// split into multiple chunks, as MSVC++ complains if a single string is too long
289
290STRINGIFY(
291
292$gvec4 textureProj($gsampler1D sampler, vec2 P);
293$gvec4 textureProj($gsampler1D sampler, vec2 P, float bias);
294$gvec4 textureProj($gsampler1D sampler, vec4 P);
295$gvec4 textureProj($gsampler1D sampler, vec4 P, float bias);
296$gvec4 textureProj($gsampler2D sampler, vec3 P);
297$gvec4 textureProj($gsampler2D sampler, vec3 P, float bias);
298$gvec4 textureProj($gsampler2D sampler, vec4 P);
299$gvec4 textureProj($gsampler2D sampler, vec4 P, float bias);
ethannicholas471e8942016-10-28 09:02:46 -0700300/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700301$gvec4 textureProj($gsampler3D sampler, vec4 P);
302$gvec4 textureProj($gsampler3D sampler, vec4 P, float bias);
303float textureProj(sampler1DShadow sampler, vec4 P);
304float textureProj(sampler1DShadow sampler, vec4 P, float bias);
305float textureProj(sampler2DShadow sampler, vec4 P);
306float textureProj(sampler2DShadow sampler, vec4 P, float bias);
307$gvec4 textureProj($gsampler2DRect sampler, vec3 P);
308$gvec4 textureProj($gsampler2DRect sampler, vec4 P);
309float textureProj(sampler2DRectShadow sampler, vec4 P);
310$gvec4 textureLod($gsampler1D sampler, float P, float lod);
311$gvec4 textureLod($gsampler2D sampler, vec2 P, float lod);
312$gvec4 textureLod($gsampler3D sampler, vec3 P, float lod);
313$gvec4 textureLod($gsamplerCube sampler, vec3 P, float lod);
314float textureLod(sampler1DShadow sampler, vec3 P, float lod);
315float textureLod(sampler2DShadow sampler, vec3 P, float lod);
316$gvec4 textureLod($gsampler1DArray sampler, vec2 P, float lod);
317$gvec4 textureLod($gsampler2DArray sampler, vec3 P, float lod);
318float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod);
319$gvec4 textureLod($gsamplerCubeArray sampler, vec4 P, float lod);
320$gvec4 textureOffset($gsampler1D sampler, float P, int offset);
321$gvec4 textureOffset($gsampler1D sampler, float P, int offset, float bias);
322$gvec4 textureOffset($gsampler2D sampler, vec2 P, ivec2 offset);
323$gvec4 textureOffset($gsampler2D sampler, vec2 P, ivec2 offset, float bias);
324$gvec4 textureOffset($gsampler3D sampler, vec3 P, ivec3 offset);
325$gvec4 textureOffset($gsampler3D sampler, vec3 P, ivec3 offset, float bias);
326$gvec4 textureOffset($gsampler2DRect sampler, vec2 P, ivec2 offset);
327float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset);
328float textureOffset(sampler1DShadow sampler, vec3 P, int offset);
329float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias);
330float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset);
331float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias);
332$gvec4 textureOffset($gsampler1DArray sampler, vec2 P, int offset);
333$gvec4 textureOffset($gsampler1DArray sampler, vec2 P, int offset, float bias);
334$gvec4 textureOffset($gsampler2DArray sampler, vec3 P, ivec2 offset);
335$gvec4 textureOffset($gsampler2DArray sampler, vec3 P, ivec2 offset, float bias);
336float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset);
337float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset, float bias);
338float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset);
ethannicholas471e8942016-10-28 09:02:46 -0700339*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700340$gvec4 texelFetch($gsampler1D sampler, int P, int lod);
341$gvec4 texelFetch($gsampler2D sampler, ivec2 P, int lod);
ethannicholas471e8942016-10-28 09:02:46 -0700342$gvec4 texelFetch($gsamplerBuffer sampler, int P);
ethannicholasb3058bd2016-07-01 08:22:01 -0700343$gvec4 texelFetch($gsampler2DRect sampler, ivec2 P);
ethannicholas471e8942016-10-28 09:02:46 -0700344/*
345$gvec4 texelFetch($gsampler3D sampler, ivec3 P, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700346$gvec4 texelFetch($gsampler1DArray sampler, ivec2 P, int lod);
347$gvec4 texelFetch($gsampler2DArray sampler, ivec3 P, int lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700348$gvec4 texelFetch($gsampler2DMS sampler, ivec2 P, int sample);
349$gvec4 texelFetch($gsampler2DMSArray sampler, ivec3 P, int sample);
350$gvec4 texelFetchOffset($gsampler1D sampler, int P, int lod, int offset);
351$gvec4 texelFetchOffset($gsampler2D sampler, ivec2 P, int lod, ivec2 offset);
352$gvec4 texelFetchOffset($gsampler3D sampler, ivec3 P, int lod, ivec3 offset);
353$gvec4 texelFetchOffset($gsampler2DRect sampler, ivec2 P, ivec2 offset);
354$gvec4 texelFetchOffset($gsampler1DArray sampler, ivec2 P, int lod, int offset);
355$gvec4 texelFetchOffset($gsampler2DArray sampler, ivec3 P, int lod, ivec2 offset);
356$gvec4 textureProjOffset($gsampler1D sampler, vec2 P, int offset);
357$gvec4 textureProjOffset($gsampler1D sampler, vec2 P, int offset, float bias);
358$gvec4 textureProjOffset($gsampler1D sampler, vec4 P, int offset);
359$gvec4 textureProjOffset($gsampler1D sampler, vec4 P, int offset, float bias);
360$gvec4 textureProjOffset($gsampler2D sampler, vec3 P, ivec2 offset);
361$gvec4 textureProjOffset($gsampler2D sampler, vec3 P, ivec2 offset, float bias);
362$gvec4 textureProjOffset($gsampler2D sampler, vec4 P, ivec2 offset);
363$gvec4 textureProjOffset($gsampler2D sampler, vec4 P, ivec2 offset, float bias);
364$gvec4 textureProjOffset($gsampler3D sampler, vec4 P, ivec3 offset);
365$gvec4 textureProjOffset($gsampler3D sampler, vec4 P, ivec3 offset, float bias);
366$gvec4 textureProjOffset($gsampler2DRect sampler, vec3 P, ivec2 offset);
367$gvec4 textureProjOffset($gsampler2DRect sampler, vec4 P, ivec2 offset);
368float textureProjOffset(sampler2DRectShadow sampler, vec4 P, ivec2 offset);
369float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset);
370float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset, float bias);
371float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset);
372float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias);
373$gvec4 textureLodOffset($gsampler1D sampler, float P, float lod, int offset);
374$gvec4 textureLodOffset($gsampler2D sampler, vec2 P, float lod, ivec2 offset);
375$gvec4 textureLodOffset($gsampler3D sampler, vec3 P, float lod, ivec3 offset);
376float textureLodOffset(sampler1DShadow sampler, vec3 P, float lod, int offset);
377float textureLodOffset(sampler2DShadow sampler, vec3 P, float lod, ivec2 offset);
378$gvec4 textureLodOffset($gsampler1DArray sampler, vec2 P, float lod, int offset);
379$gvec4 textureLodOffset($gsampler2DArray sampler, vec3 P, float lod, ivec2 offset);
380float textureLodOffset(sampler1DArrayShadow sampler, vec3 P, float lod, int offset);
381$gvec4 textureProjLod($gsampler1D sampler, vec2 P, float lod);
382$gvec4 textureProjLod($gsampler1D sampler, vec4 P, float lod);
383$gvec4 textureProjLod($gsampler2D sampler, vec3 P, float lod);
384$gvec4 textureProjLod($gsampler2D sampler, vec4 P, float lod);
385$gvec4 textureProjLod($gsampler3D sampler, vec4 P, float lod);
386float textureProjLod(sampler1DShadow sampler, vec4 P, float lod);
387float textureProjLod(sampler2DShadow sampler, vec4 P, float lod);
388$gvec4 textureProjLodOffset($gsampler1D sampler, vec2 P, float lod, int offset);
389$gvec4 textureProjLodOffset($gsampler1D sampler, vec4 P, float lod, int offset);
390$gvec4 textureProjLodOffset($gsampler2D sampler, vec3 P, float lod, ivec2 offset);
391$gvec4 textureProjLodOffset($gsampler2D sampler, vec4 P, float lod, ivec2 offset);
392$gvec4 textureProjLodOffset($gsampler3D sampler, vec4 P, float lod, ivec3 offset);
393float textureProjLodOffset(sampler1DShadow sampler, vec4 P, float lod, int offset);
394float textureProjLodOffset(sampler2DShadow sampler, vec4 P, float lod, ivec2 offset);
395$gvec4 textureGrad($gsampler1D sampler, float P, float dPdx, float dPdy);
396$gvec4 textureGrad($gsampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy);
397$gvec4 textureGrad($gsampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy);
398$gvec4 textureGrad($gsamplerCube sampler, vec3 P, vec3 dPdx, vec3 dPdy);
399$gvec4 textureGrad($gsampler2DRect sampler, vec2 P, vec2 dPdx, vec2 dPdy);
400float textureGrad(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
401float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy);
402float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy);
403float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy);
404$gvec4 textureGrad($gsampler1DArray sampler, vec2 P, float dPdx, float dPdy);
405$gvec4 textureGrad($gsampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy);
406float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy);
407float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
408$gvec4 textureGrad($gsamplerCubeArray sampler, vec4 P, vec3 dPdx, vec3 dPdy);
409$gvec4 textureGradOffset($gsampler1D sampler, float P, float dPdx, float dPdy, int offset);
410$gvec4 textureGradOffset($gsampler2D sampler, vec2 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
411$gvec4 textureGradOffset($gsampler3D sampler, vec3 P, vec3 dPdx, vec3 dPdy, ivec3 offset);
412$gvec4 textureGradOffset($gsampler2DRect sampler, vec2 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
413float textureGradOffset(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
414float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy, int offset );
415float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
416$gvec4 textureGradOffset($gsampler1DArray sampler, vec2 P, float dPdx, float dPdy, int offset);
417$gvec4 textureGradOffset($gsampler2DArray sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
418float textureGradOffset(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy, int offset);
419float textureGradOffset(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
420$gvec4 textureProjGrad($gsampler1D sampler, vec2 P, float dPdx, float dPdy);
421$gvec4 textureProjGrad($gsampler1D sampler, vec4 P, float dPdx, float dPdy);
422$gvec4 textureProjGrad($gsampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy);
423$gvec4 textureProjGrad($gsampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy);
424$gvec4 textureProjGrad($gsampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy);
425$gvec4 textureProjGrad($gsampler2DRect sampler, vec3 P, vec2 dPdx, vec2 dPdy);
426$gvec4 textureProjGrad($gsampler2DRect sampler, vec4 P, vec2 dPdx, vec2 dPdy);
427float textureProjGrad(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
428float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy);
429float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy);
430$gvec4 textureProjGradOffset($gsampler1D sampler, vec2 P, float dPdx, float dPdy, int offset);
431$gvec4 textureProjGradOffset($gsampler1D sampler, vec4 P, float dPdx, float dPdy, int offset);
432$gvec4 textureProjGradOffset($gsampler2D sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
433$gvec4 textureProjGradOffset($gsampler2D sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
434$gvec4 textureProjGradOffset($gsampler2DRect sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
435$gvec4 textureProjGradOffset($gsampler2DRect sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
436float textureProjGradOffset(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
437$gvec4 textureProjGradOffset($gsampler3D sampler, vec4 P, vec3 dPdx, vec3 dPdy, ivec3 offset);
438float textureProjGradOffset(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy, int offset);
439float textureProjGradOffset(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset);
440$gvec4 textureGather($gsampler2D sampler, vec2 P);
441$gvec4 textureGather($gsampler2D sampler, vec2 P, int comp);
442$gvec4 textureGather($gsampler2DArray sampler, vec3 P);
443$gvec4 textureGather($gsampler2DArray sampler, vec3 P, int comp);
444$gvec4 textureGather($gsamplerCube sampler, vec3 P);
445$gvec4 textureGather($gsamplerCube sampler, vec3 P, int comp);
446$gvec4 textureGather($gsamplerCubeArray sampler, vec4 P);
447$gvec4 textureGather($gsamplerCubeArray sampler, vec4 P, int comp);
448$gvec4 textureGather($gsampler2DRect sampler, vec2 P);
449$gvec4 textureGather($gsampler2DRect sampler, vec2 P, int comp);
450vec4 textureGather(sampler2DShadow sampler, vec2 P, float refZ);
451vec4 textureGather(sampler2DArrayShadow sampler, vec3 P, float refZ);
452vec4 textureGather(samplerCubeShadow sampler, vec3 P, float refZ);
453vec4 textureGather(samplerCubeArrayShadow sampler, vec4 P, float refZ);
454vec4 textureGather(sampler2DRectShadow sampler, vec2 P, float refZ);
455$gvec4 textureGatherOffset($gsampler2D sampler, vec2 P, ivec2 offset);
456$gvec4 textureGatherOffset($gsampler2D sampler, vec2 P, ivec2 offset, int comp);
457$gvec4 textureGatherOffset($gsampler2DArray sampler, vec3 P, ivec2 offset);
458$gvec4 textureGatherOffset($gsampler2DArray sampler, vec3 P, ivec2 offset, int comp);
459$gvec4 textureGatherOffset($gsampler2DRect sampler, vec2 P, ivec2 offset);
460$gvec4 textureGatherOffset($gsampler2DRect sampler, vec2 P, ivec2 offset, int comp);
461vec4 textureGatherOffset(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offset);
462vec4 textureGatherOffset(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offset);
463vec4 textureGatherOffset(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offset);
ethannicholasb3058bd2016-07-01 08:22:01 -0700464$gvec4 textureGatherOffsets($gsampler2D sampler, vec2 P, ivec2 offsets[4]);
465$gvec4 textureGatherOffsets($gsampler2D sampler, vec2 P, ivec2 offsets[4], int comp);
466$gvec4 textureGatherOffsets($gsampler2DArray sampler, vec3 P, ivec2 offsets[4]);
467$gvec4 textureGatherOffsets($gsampler2DArray sampler, vec3 P, ivec2 offsets[4], int comp);
468$gvec4 textureGatherOffsets($gsampler2DRect sampler, vec2 P, ivec2 offsets[4]);
469$gvec4 textureGatherOffsets($gsampler2DRect sampler, vec2 P, ivec2 offsets[4], int comp);
470vec4 textureGatherOffsets(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offsets[4]);
471vec4 textureGatherOffsets(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offsets[4]);
472vec4 textureGatherOffsets(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offsets[4]);
473*/
474vec4 texture1D(sampler1D sampler, float coord);
475vec4 texture1D(sampler1D sampler, float coord, float bias);
ethannicholas471e8942016-10-28 09:02:46 -0700476/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700477vec4 texture1DProj(sampler1D sampler, vec2 coord);
478vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias);
479vec4 texture1DProj(sampler1D sampler, vec4 coord);
480vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias);
481vec4 texture1DLod(sampler1D sampler, float coord, float lod);
482vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod);
483vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod);
ethannicholas471e8942016-10-28 09:02:46 -0700484*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700485vec4 texture2D(sampler2D sampler, vec2 coord);
ethannicholas5961bc92016-10-12 06:39:56 -0700486vec4 texture2D(samplerExternalOES sampler, vec2 coord);
ethannicholasb3058bd2016-07-01 08:22:01 -0700487vec4 texture2D(sampler2D sampler, vec2 coord, float bias);
488vec4 texture2DProj(sampler2D sampler, vec3 coord);
ethannicholas471e8942016-10-28 09:02:46 -0700489/*
ethannicholasb3058bd2016-07-01 08:22:01 -0700490vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias);
491vec4 texture2DProj(sampler2D sampler, vec4 coord);
492vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias);
493vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod);
494vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
495vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
496vec4 texture3D(sampler3D sampler, vec3 coord);
497vec4 texture3D(sampler3D sampler, vec3 coord, float bias);
498vec4 texture3DProj(sampler3D sampler, vec4 coord);
499vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias);
500vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod);
501vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod);
502vec4 textureCube(samplerCube sampler, vec3 coord);
503vec4 textureCube(samplerCube sampler, vec3 coord, float bias);
504vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod);
505vec4 shadow1D(sampler1DShadow sampler, vec3 coord);
506vec4 shadow1D(sampler1DShadow sampler, vec3 coord, float bias);
507vec4 shadow2D(sampler2DShadow sampler, vec3 coord);
508vec4 shadow2D(sampler2DShadow sampler, vec3 coord, float bias);
509vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord);
510vec4 shadow1DProj(sampler1DShadow sampler, vec4 coord, float bias);
511vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord);
512vec4 shadow2DProj(sampler2DShadow sampler, vec4 coord, float bias);
513vec4 shadow1DLod(sampler1DShadow sampler, vec3 coord, float lod);
514vec4 shadow2DLod(sampler2DShadow sampler, vec3 coord, float lod);
515vec4 shadow1DProjLod(sampler1DShadow sampler, vec4 coord, float lod);
516vec4 shadow2DProjLod(sampler2DShadow sampler, vec4 coord, float lod);
ethannicholasb3058bd2016-07-01 08:22:01 -0700517uint atomicCounterIncrement(atomic_uint c);
518uint atomicCounter(atomic_uint c);
519uint atomicAdd(inout uint mem, uint data);
520int atomicAdd(inout int mem, int data);
521uint atomicMin(inout uint mem, uint data);
522int atomicMin(inout int mem, int data);
523uint atomicMax(inout uint mem, uint data);
524int atomicMax(inout int mem, int data);
525uint atomicAnd(inout uint mem, uint data);
526int atomicAnd(inout int mem, int data);
527uint atomicOr(inout uint mem, uint data);
528int atomicOr(inout int mem, int data);
529uint atomicXor(inout uint mem, uint data);
530int atomicXor(inout int mem, int data);
531uint atomicExchange(inout uint mem, uint data);
532int atomicExchange(inout int mem, int data);
533uint atomicCompSwap(inout uint mem, uint compare, uint data);
534int atomicCompSwap(inout int mem, int compare, int data);
535*/
536// section 8.12 Image Functions will go here if and when we add support for them
537
538$genType dFdx($genType p);
539$genType dFdy($genType p);
ethannicholasb3058bd2016-07-01 08:22:01 -0700540float interpolateAtSample(float interpolant, int sample);
541vec2 interpolateAtSample(vec2 interpolant, int sample);
542vec3 interpolateAtSample(vec3 interpolant, int sample);
543vec4 interpolateAtSample(vec4 interpolant, int sample);
544float interpolateAtOffset(float interpolant, vec2 offset);
545vec2 interpolateAtOffset(vec2 interpolant, vec2 offset);
546vec3 interpolateAtOffset(vec3 interpolant, vec2 offset);
547vec4 interpolateAtOffset(vec4 interpolant, vec2 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 EmitStreamVertex(int stream);
554void EndStreamPrimitive(int stream);
555void EmitVertex();
556void EndPrimitive();
557void barrier();
558void memoryBarrier();
559void memoryBarrierAtomicCounter();
560void memoryBarrierBuffer();
561void memoryBarrierShared();
562void memoryBarrierImage();
563void groupMemoryBarrier();
ethannicholas471e8942016-10-28 09:02:46 -0700564*/
ethannicholasb3058bd2016-07-01 08:22:01 -0700565
Mike Klein600c6a72016-09-27 11:21:15 -0400566)
567