• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1STRINGIFY(
2
3// defines built-in functions supported by SkSL when running on a GPU
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);
25$genHType radians($genHType degrees);
26$genHType sin($genHType angle);
27$genHType cos($genHType angle);
28$genHType tan($genHType angle);
29$genHType asin($genHType x);
30$genHType acos($genHType x);
31$genHType atan($genHType y, $genHType x);
32$genHType atan($genHType y_over_x);
33$genHType sinh($genHType x);
34$genHType cosh($genHType x);
35$genHType tanh($genHType x);
36$genHType asinh($genHType x);
37$genHType acosh($genHType x);
38$genHType atanh($genHType x);
39$genHType pow($genHType x, $genHType y);
40$genHType exp($genHType x);
41$genHType log($genHType x);
42$genHType exp2($genHType x);
43$genHType log2($genHType x);
44$genHType sqrt($genHType x);
45$genType inversesqrt($genType x);
46$genType abs($genType x);
47$genHType abs($genHType x);
48$genIType abs($genIType x);
49$genType sign($genType x);
50$genHType sign($genHType x);
51$genIType sign($genIType x);
52$genType floor($genType x);
53$genHType floor($genHType x);
54$genType trunc($genType x);
55$genHType trunc($genHType x);
56$genType round($genType x);
57$genHType round($genHType x);
58$genType roundEven($genType x);
59$genHType roundEven($genHType x);
60$genType ceil($genType x);
61$genHType ceil($genHType x);
62$genType fract($genType x);
63$genHType fract($genHType x);
64$genType mod($genType x, float y);
65$genType mod($genType x, $genType y);
66$genHType mod($genHType x, half y);
67$genHType mod($genHType x, $genType y);
68$genType modf($genType x, out $genType i);
69$genHType modf($genHType x, out $genHType i);
70$genType min($genType x, $genType y);
71$genType min($genType x, float y);
72$genHType min($genHType x, $genHType y);
73$genHType min($genHType x, half y);
74$genIType min($genIType x, $genIType y);
75$genIType min($genIType x, int y);
76$genType max($genType x, $genType y);
77$genType max($genType x, float y);
78$genHType max($genHType x, $genHType y);
79$genHType max($genHType x, half y);
80$genIType max($genIType x, $genIType y);
81$genIType max($genIType x, int y);
82$genType clamp($genType x, $genType minVal, $genType maxVal);
83$genType clamp($genType x, float minVal, float maxVal);
84$genHType clamp($genHType x, $genHType minVal, $genHType maxVal);
85$genHType clamp($genHType x, half minVal, half maxVal);
86$genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
87$genIType clamp($genIType x, int minVal, int maxVal);
88$genType saturate($genType x);
89$genHType saturate($genHType x);
90$genType mix($genType x, $genType y, $genType a);
91$genType mix($genType x, $genType y, float a);
92$genHType mix($genHType x, $genHType y, $genHType a);
93$genHType mix($genHType x, $genHType y, half a);
94$genType mix($genType x, $genType y, $genBType a);
95$genIType mix($genIType x, $genIType y, $genBType a);
96$genBType mix($genBType x, $genBType y, $genBType a);
97$genType step($genType edge, $genType x);
98$genType step(float edge, $genType x);
99$genHType step($genHType edge, $genHType x);
100$genHType step(half edge, $genHType x);
101$genType smoothstep($genType edge0, $genType edge1, $genType x);
102$genType smoothstep(float edge0, float edge1, $genType x);
103$genHType smoothstep($genHType edge0, $genHType edge1, $genHType x);
104$genHType smoothstep(half edge0, half edge1, $genHType x);
105$genBType isnan($genType x);
106$genBType isnan($genDType x);
107$genBType isinf($genType x);
108$genBType isinf($genDType x);
109$genIType floatBitsToInt($genType value);
110$genType intBitsTofloat($genIType value);
111$genType uintBitsTofloat($genUType value);
112$genType fma($genType a, $genType b, $genType c);
113$genHType fma($genHType a, $genHType b, $genHType c);
114$genDType fma($genDType a, $genDType b, $genDType c);
115sk_has_side_effects $genType frexp($genType x, out $genIType exp);
116$genType ldexp($genType x, in $genIType exp);
117uint packUnorm2x16(float2 v);
118uint packSnorm2x16(float2 v);
119uint packUnorm4x8(float4 v);
120uint packSnorm4x8(float4 v);
121float2 unpackUnorm2x16(uint p);
122float2 unpackSnorm2x16(uint p);
123float4 unpackUnorm4x8(uint p);
124float4 unpackSnorm4x8(uint p);
125uint2 unpackDouble2x32(double v);
126uint packHalf2x16(float2 v);
127float2 unpackHalf2x16(uint v);
128float length($genType x);
129half length($genHType x);
130double length($genDType x);
131float distance($genType p0, $genType p1);
132half distance($genHType p0, $genHType p1);
133double distance($genDType p0, $genDType p1);
134float dot($genType x, $genType y);
135half dot($genHType x, $genHType y);
136double dot($genDType x, $genDType y);
137float3 cross(float3 x, float3 y);
138half3 cross(half3 x, half3 y);
139double3 cross(double3 x, double3 y);
140$genType normalize($genType x);
141$genHType normalize($genHType x);
142$genDType normalize($genDType x);
143float4 ftransform();
144$genType faceforward($genType N, $genType I, $genType Nref);
145$genHType faceforward($genHType N, $genHType I, $genHType Nref);
146$genDType faceforward($genDType N, $genDType I, $genDType Nref);
147$genType reflect($genType I, $genType N);
148$genHType reflect($genHType I, $genHType N);
149$genDType reflect($genDType I, $genDType N);
150$genType refract($genType I, $genType N, float eta);
151$genHType refract($genHType I, $genHType N, float eta);
152$genDType refract($genDType I, $genDType N, float eta);
153$mat matrixCompMult($mat x, $mat y);
154float2x2 outerProduct(float2 c, float2 r);
155float3x3 outerProduct(float3 c, float3 r);
156float4x3 outerProduct(float4 c, float4 r);
157float2x3 outerProduct(float3 c, float2 r);
158float3x2 outerProduct(float2 c, float3 r);
159float2x4 outerProduct(float4 c, float2 r);
160float4x2 outerProduct(float2 c, float4 r);
161float3x4 outerProduct(float4 c, float3 r);
162float4x3 outerProduct(float3 c, float4 r);
163half2x2 outerProduct(half2 c, half2 r);
164half3x3 outerProduct(half3 c, half3 r);
165half4x3 outerProduct(half4 c, half4 r);
166half2x3 outerProduct(half3 c, half2 r);
167half3x2 outerProduct(half2 c, half3 r);
168half2x4 outerProduct(half4 c, half2 r);
169half4x2 outerProduct(half2 c, half4 r);
170half3x4 outerProduct(half4 c, half3 r);
171half4x3 outerProduct(half3 c, half4 r);
172float2x2 transpose(float2x2 m);
173float3x3 transpose(float3x3 m);
174float4x4 transpose(float4x4 m);
175float2x3 transpose(float3x2 m);
176float3x2 transpose(float2x3 m);
177float2x4 transpose(float4x2 m);
178float4x2 transpose(float2x4 m);
179float3x4 transpose(float4x3 m);
180float4x3 transpose(float3x4 m);
181half2x2 transpose(half2x2 m);
182half3x3 transpose(half3x3 m);
183half4x4 transpose(half4x4 m);
184half2x3 transpose(half3x2 m);
185half3x2 transpose(half2x3 m);
186half2x4 transpose(half4x2 m);
187half4x2 transpose(half2x4 m);
188half3x4 transpose(half4x3 m);
189half4x3 transpose(half3x4 m);
190float determinant(float2x2 m);
191float determinant(float3x3 m);
192float determinant(float4x4 m);
193half determinant(half2x2 m);
194half determinant(half3x3 m);
195half determinant(half4x4 m);
196float2x2 inverse(float2x2 m);
197float3x3 inverse(float3x3 m);
198float4x4 inverse(float4x4 m);
199half2x2 inverse(half2x2 m);
200half3x3 inverse(half3x3 m);
201half4x4 inverse(half4x4 m);
202$bvec lessThan($vec x, $vec y);
203$bvec lessThan($hvec x, $hvec y);
204$bvec lessThan($dvec x, $dvec y);
205$bvec lessThan($ivec x, $ivec y);
206$bvec lessThan($svec x, $svec y);
207$bvec lessThan($usvec x, $usvec y);
208$bvec lessThan($uvec x, $uvec y);
209$bvec lessThanEqual($vec x, $vec y);
210$bvec lessThanEqual($hvec x, $hvec y);
211$bvec lessThanEqual($dvec x, $dvec y);
212$bvec lessThanEqual($ivec x, $ivec y);
213$bvec lessThanEqual($uvec x, $uvec y);
214$bvec lessThanEqual($svec x, $svec y);
215$bvec lessThanEqual($usvec x, $usvec y);
216$bvec greaterThan($vec x, $vec y);
217$bvec greaterThan($hvec x, $hvec y);
218$bvec greaterThan($dvec x, $dvec y);
219$bvec greaterThan($ivec x, $ivec y);
220$bvec greaterThan($uvec x, $uvec y);
221$bvec greaterThan($svec x, $svec y);
222$bvec greaterThan($usvec x, $usvec y);
223$bvec greaterThanEqual($vec x, $vec y);
224$bvec greaterThanEqual($hvec x, $hvec y);
225$bvec greaterThanEqual($dvec x, $dvec y);
226$bvec greaterThanEqual($ivec x, $ivec y);
227$bvec greaterThanEqual($uvec x, $uvec y);
228$bvec greaterThanEqual($svec x, $svec y);
229$bvec greaterThanEqual($usvec x, $usvec y);
230$bvec equal($vec x, $vec y);
231$bvec equal($hvec x, $hvec y);
232$bvec equal($dvec x, $dvec y);
233$bvec equal($ivec x, $ivec y);
234$bvec equal($uvec x, $uvec y);
235$bvec equal($svec x, $svec y);
236$bvec equal($usvec x, $usvec y);
237$bvec equal($bvec x, $bvec y);
238$bvec notEqual($vec x, $vec y);
239$bvec notEqual($hvec x, $hvec y);
240$bvec notEqual($dvec x, $dvec y);
241$bvec notEqual($ivec x, $ivec y);
242$bvec notEqual($uvec x, $uvec y);
243$bvec notEqual($svec x, $svec y);
244$bvec notEqual($usvec x, $usvec y);
245$bvec notEqual($bvec x, $bvec y);
246bool any($bvec x);
247bool all($bvec x);
248$bvec not($bvec x);
249
250$genIType bitCount($genIType value);
251$genIType bitCount($genUType value);
252$genIType findLSB($genIType value);
253$genIType findLSB($genUType value);
254$genIType findMSB($genIType value);
255$genIType findMSB($genUType value);
256
257sampler2D makeSampler2D(texture2D texture, sampler sampler);
258int2 textureSize($gsampler2DRect sampler);
259
260half4 sample($gsampler1D sampler, float P);
261half4 sample($gsampler1D sampler, float P, float bias);
262half4 sample($gsampler2D sampler, float2 P);
263// The above currently only expand to handle the float/fixed case. So we also declare this integer
264// version of sample().
265int4 sample(isampler2D sampler, float2 P);
266half4 sample(samplerExternalOES sampler, float2 P, float bias);
267half4 sample(samplerExternalOES sampler, float2 P);
268
269half4 sample($gsampler2DRect sampler, float2 P);
270half4 sample($gsampler2DRect sampler, float3 P);
271
272// Currently we do not support the generic types of loading subpassInput so we have some explicit
273// versions that we currently use
274float4 subpassLoad(subpassInput subpass);
275float4 subpassLoad(subpassInputMS subpass, int sample);
276
277half4 sample($gsampler1D sampler, float2 P);
278half4 sample($gsampler1D sampler, float2 P, float bias);
279half4 sample($gsampler2D sampler, float3 P);
280half4 sample($gsampler2D sampler, float3 P, float bias);
281
282float4 imageLoad(image2D image, int2 P);
283int4 imageLoad(iimage2D image, int2 P);
284$genType dFdx($genType p);
285$genType dFdy($genType p);
286$genHType dFdx($genHType p);
287$genHType dFdy($genHType p);
288$genType fwidth($genType p);
289$genHType fwidth($genHType p);
290float interpolateAtSample(float interpolant, int sample);
291float2 interpolateAtSample(float2 interpolant, int sample);
292float3 interpolateAtSample(float3 interpolant, int sample);
293float4 interpolateAtSample(float4 interpolant, int sample);
294float interpolateAtOffset(float interpolant, float2 offset);
295float2 interpolateAtOffset(float2 interpolant, float2 offset);
296float3 interpolateAtOffset(float3 interpolant, float2 offset);
297float4 interpolateAtOffset(float4 interpolant, float2 offset);
298
299)
300