1# Copyright (C) 2016 The Android Open Source Project
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
7#      http://www.apache.org/licenses/LICENSE-2.0
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
15'''A list of signatures for RS builtin functions and util functions for them.
17from __future__ import absolute_import
19Function signature syntax is usually C-like, however, fixed values can also be
20specified for those functions where the input range is restricted.
21Lines in the function table beginning with - are comments.
22Also contains utility functions to build an LLDB expression from a single
23function line.
26import re
28# Remove blank and comment lines using a lambda.
29FUNC_LIST = filter(lambda line: line.strip()
30                                and not line.strip().startswith('-'), '''
31- math functions
33uchar abs(char v);
34uchar2 abs(char2 v);
35uchar3 abs(char3 v);
36uchar4 abs(char4 v);
37uint abs(int v);
38uint2 abs(int2 v);
39uint3 abs(int3 v);
40uint4 abs(int4 v);
41ushort abs(short v);
42ushort2 abs(short2 v);
43ushort3 abs(short3 v);
44ushort4 abs(short4 v);
46float acos(float v);
47float2 acos(float2 v);
48float3 acos(float3 v);
49float4 acos(float4 v);
51float acosh(float v);
52float2 acosh(float2 v);
53float3 acosh(float3 v);
54float4 acosh(float4 v);
56float acospi(float v);
57float2 acospi(float2 v);
58float3 acospi(float3 v);
59float4 acospi(float4 v);
61float asin(float v);
62float2 asin(float2 v);
63float3 asin(float3 v);
64float4 asin(float4 v);
66float asinh(float v);
67float2 asinh(float2 v);
68float3 asinh(float3 v);
69float4 asinh(float4 v);
71float asinpi(float v);
72float2 asinpi(float2 v);
73float3 asinpi(float3 v);
74float4 asinpi(float4 v);
76float atan(float v);
77float2 atan(float2 v);
78float3 atan(float3 v);
79float4 atan(float4 v);
81float atan2(float numerator, float denominator);
82float2 atan2(float2 numerator, float2 denominator);
83float3 atan2(float3 numerator, float3 denominator);
84float4 atan2(float4 numerator, float4 denominator);
86float atan2pi(float numerator, float denominator);
87float2 atan2pi(float2 numerator, float2 denominator);
88float3 atan2pi(float3 numerator, float3 denominator);
89float4 atan2pi(float4 numerator, float4 denominator);
91float atanh(float v);
92float2 atanh(float2 v);
93float3 atanh(float3 v);
94float4 atanh(float4 v);
96float atanpi(float v);
97float2 atanpi(float2 v);
98float3 atanpi(float3 v);
99float4 atanpi(float4 v);
101float cbrt(float v);
102float2 cbrt(float2 v);
103float3 cbrt(float3 v);
104float4 cbrt(float4 v);
106float ceil(float v);
107float2 ceil(float2 v);
108float3 ceil(float3 v);
109float4 ceil(float4 v);
111char clamp(char value, char min_value, char max_value);
112char2 clamp(char2 value, char min_value, char max_value);
113char2 clamp(char2 value, char2 min_value, char2 max_value);
114char3 clamp(char3 value, char min_value, char max_value);
115char3 clamp(char3 value, char3 min_value, char3 max_value);
116char4 clamp(char4 value, char min_value, char max_value);
117char4 clamp(char4 value, char4 min_value, char4 max_value);
118float clamp(float value, float min_value, float max_value);
119float2 clamp(float2 value, float min_value, float max_value);
120float2 clamp(float2 value, float2 min_value, float2 max_value);
121float3 clamp(float3 value, float min_value, float max_value);
122float3 clamp(float3 value, float3 min_value, float3 max_value);
123float4 clamp(float4 value, float min_value, float max_value);
124float4 clamp(float4 value, float4 min_value, float4 max_value);
125int clamp(int value, int min_value, int max_value);
126int2 clamp(int2 value, int min_value, int max_value);
127int2 clamp(int2 value, int2 min_value, int2 max_value);
128int3 clamp(int3 value, int min_value, int max_value);
129int3 clamp(int3 value, int3 min_value, int3 max_value);
130int4 clamp(int4 value, int min_value, int max_value);
131int4 clamp(int4 value, int4 min_value, int4 max_value);
132long clamp(long value, long min_value, long max_value);
133long2 clamp(long2 value, long min_value, long max_value);
134long2 clamp(long2 value, long2 min_value, long2 max_value);
135long3 clamp(long3 value, long min_value, long max_value);
136long3 clamp(long3 value, long3 min_value, long3 max_value);
137long4 clamp(long4 value, long min_value, long max_value);
138long4 clamp(long4 value, long4 min_value, long4 max_value);
139short clamp(short value, short min_value, short max_value);
140short2 clamp(short2 value, short min_value, short max_value);
141short2 clamp(short2 value, short2 min_value, short2 max_value);
142short3 clamp(short3 value, short min_value, short max_value);
143short3 clamp(short3 value, short3 min_value, short3 max_value);
144short4 clamp(short4 value, short min_value, short max_value);
145short4 clamp(short4 value, short4 min_value, short4 max_value);
146uchar clamp(uchar value, uchar min_value, uchar max_value);
147uchar2 clamp(uchar2 value, uchar min_value, uchar max_value);
148uchar2 clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
149uchar3 clamp(uchar3 value, uchar min_value, uchar max_value);
150uchar3 clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
151uchar4 clamp(uchar4 value, uchar min_value, uchar max_value);
152uchar4 clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
153uint clamp(uint value, uint min_value, uint max_value);
154uint2 clamp(uint2 value, uint min_value, uint max_value);
155uint2 clamp(uint2 value, uint2 min_value, uint2 max_value);
156uint3 clamp(uint3 value, uint min_value, uint max_value);
157uint3 clamp(uint3 value, uint3 min_value, uint3 max_value);
158uint4 clamp(uint4 value, uint min_value, uint max_value);
159uint4 clamp(uint4 value, uint4 min_value, uint4 max_value);
160ulong clamp(ulong value, ulong min_value, ulong max_value);
161ulong2 clamp(ulong2 value, ulong min_value, ulong max_value);
162ulong2 clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
163ulong3 clamp(ulong3 value, ulong min_value, ulong max_value);
164ulong3 clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
165ulong4 clamp(ulong4 value, ulong min_value, ulong max_value);
166ulong4 clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
167ushort clamp(ushort value, ushort min_value, ushort max_value);
168ushort2 clamp(ushort2 value, ushort min_value, ushort max_value);
169ushort2 clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
170ushort3 clamp(ushort3 value, ushort min_value, ushort max_value);
171ushort3 clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
172ushort4 clamp(ushort4 value, ushort min_value, ushort max_value);
173ushort4 clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
175char clz(char value);
176char2 clz(char2 value);
177char3 clz(char3 value);
178char4 clz(char4 value);
179int clz(int value);
180int2 clz(int2 value);
181int3 clz(int3 value);
182int4 clz(int4 value);
183short clz(short value);
184short2 clz(short2 value);
185short3 clz(short3 value);
186short4 clz(short4 value);
187uchar clz(uchar value);
188uchar2 clz(uchar2 value);
189uchar3 clz(uchar3 value);
190uchar4 clz(uchar4 value);
191uint clz(uint value);
192uint2 clz(uint2 value);
193uint3 clz(uint3 value);
194uint4 clz(uint4 value);
195ushort clz(ushort value);
196ushort2 clz(ushort2 value);
197ushort3 clz(ushort3 value);
198ushort4 clz(ushort4 value);
200float copysign(float magnitude_value, float sign_value);
201float2 copysign(float2 magnitude_value, float2 sign_value);
202float3 copysign(float3 magnitude_value, float3 sign_value);
203float4 copysign(float4 magnitude_value, float4 sign_value);
205float cos(float v);
206float2 cos(float2 v);
207float3 cos(float3 v);
208float4 cos(float4 v);
210float cosh(float v);
211float2 cosh(float2 v);
212float3 cosh(float3 v);
213float4 cosh(float4 v);
215float cospi(float v);
216float2 cospi(float2 v);
217float3 cospi(float3 v);
218float4 cospi(float4 v);
220float erf(float v);
221float2 erf(float2 v);
222float3 erf(float3 v);
223float4 erf(float4 v);
225float erfc(float v);
226float2 erfc(float2 v);
227float3 erfc(float3 v);
228float4 erfc(float4 v);
230float exp(float v);
231float2 exp(float2 v);
232float3 exp(float3 v);
233float4 exp(float4 v);
235float exp10(float v);
236float2 exp10(float2 v);
237float3 exp10(float3 v);
238float4 exp10(float4 v);
240float exp2(float v);
241float2 exp2(float2 v);
242float3 exp2(float3 v);
243float4 exp2(float4 v);
245float expm1(float v);
246float2 expm1(float2 v);
247float3 expm1(float3 v);
248float4 expm1(float4 v);
250float fabs(float v);
251float2 fabs(float2 v);
252float3 fabs(float3 v);
253float4 fabs(float4 v);
255float fdim(float a, float b);
256float2 fdim(float2 a, float2 b);
257float3 fdim(float3 a, float3 b);
258float4 fdim(float4 a, float4 b);
260float floor(float v);
261float2 floor(float2 v);
262float3 floor(float3 v);
263float4 floor(float4 v);
265float fma(float multiplicand1, float multiplicand2, float offset);
266float2 fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
267float3 fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
268float4 fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
270float fmax(float a, float b);
271float2 fmax(float2 a, float b);
272float2 fmax(float2 a, float2 b);
273float3 fmax(float3 a, float b);
274float3 fmax(float3 a, float3 b);
275float4 fmax(float4 a, float b);
276float4 fmax(float4 a, float4 b);
278float fmin(float a, float b);
279float2 fmin(float2 a, float b);
280float2 fmin(float2 a, float2 b);
281float3 fmin(float3 a, float b);
282float3 fmin(float3 a, float3 b);
283float4 fmin(float4 a, float b);
284float4 fmin(float4 a, float4 b);
286float fmod(float numerator, float denominator);
287float2 fmod(float2 numerator, float2 denominator);
288float3 fmod(float3 numerator, float3 denominator);
289float4 fmod(float4 numerator, float4 denominator);
291float fract(float v, float* floor);
292float2 fract(float2 v, float2* floor);
293float3 fract(float3 v, float3* floor);
294float4 fract(float4 v, float4* floor);
296float frexp(float v, int* exponent);
297float2 frexp(float2 v, int2* exponent);
298float3 frexp(float3 v, int3* exponent);
299float4 frexp(float4 v, int4* exponent);
301float half_recip(float v);
302float2 half_recip(float2 v);
303float3 half_recip(float3 v);
304float4 half_recip(float4 v);
306float half_rsqrt(float v);
307float2 half_rsqrt(float2 v);
308float3 half_rsqrt(float3 v);
309float4 half_rsqrt(float4 v);
311float half_sqrt(float v);
312float2 half_sqrt(float2 v);
313float3 half_sqrt(float3 v);
314float4 half_sqrt(float4 v);
316float hypot(float a, float b);
317float2 hypot(float2 a, float2 b);
318float3 hypot(float3 a, float3 b);
319float4 hypot(float4 a, float4 b);
321int ilogb(float v);
322int2 ilogb(float2 v);
323int3 ilogb(float3 v);
324int4 ilogb(float4 v);
326float ldexp(float mantissa, int exponent);
327float2 ldexp(float2 mantissa, int exponent);
328float2 ldexp(float2 mantissa, int2 exponent);
329float3 ldexp(float3 mantissa, int exponent);
330float3 ldexp(float3 mantissa, int3 exponent);
331float4 ldexp(float4 mantissa, int exponent);
332float4 ldexp(float4 mantissa, int4 exponent);
334float lgamma(float v);
335float lgamma(float v, int* sign_of_gamma);
336float2 lgamma(float2 v);
337float2 lgamma(float2 v, int2* sign_of_gamma);
338float3 lgamma(float3 v);
339float3 lgamma(float3 v, int3* sign_of_gamma);
340float4 lgamma(float4 v);
341float4 lgamma(float4 v, int4* sign_of_gamma);
343float log(float v);
344float2 log(float2 v);
345float3 log(float3 v);
346float4 log(float4 v);
348float log10(float v);
349float2 log10(float2 v);
350float3 log10(float3 v);
351float4 log10(float4 v);
353float log1p(float v);
354float2 log1p(float2 v);
355float3 log1p(float3 v);
356float4 log1p(float4 v);
358float log2(float v);
359float2 log2(float2 v);
360float3 log2(float3 v);
361float4 log2(float4 v);
363float logb(float v);
364float2 logb(float2 v);
365float3 logb(float3 v);
366float4 logb(float4 v);
368float mad(float multiplicand1, float multiplicand2, float offset);
369float2 mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
370float3 mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
371float4 mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
373char max(char a, char b);
374char2 max(char2 a, char2 b);
375char3 max(char3 a, char3 b);
376char4 max(char4 a, char4 b);
377float max(float a, float b);
378float2 max(float2 a, float2 b);
379float3 max(float3 a, float3 b);
380float4 max(float4 a, float4 b);
381int max(int a, int b);
382int2 max(int2 a, int2 b);
383int3 max(int3 a, int3 b);
384int4 max(int4 a, int4 b);
385long max(long a, long b);
386long2 max(long2 a, long2 b);
387long3 max(long3 a, long3 b);
388long4 max(long4 a, long4 b);
389short max(short a, short b);
390short2 max(short2 a, short2 b);
391short3 max(short3 a, short3 b);
392short4 max(short4 a, short4 b);
393uchar max(uchar a, uchar b);
394uchar2 max(uchar2 a, uchar2 b);
395uchar3 max(uchar3 a, uchar3 b);
396uchar4 max(uchar4 a, uchar4 b);
397uint max(uint a, uint b);
398uint2 max(uint2 a, uint2 b);
399uint3 max(uint3 a, uint3 b);
400uint4 max(uint4 a, uint4 b);
401ulong max(ulong a, ulong b);
402ulong2 max(ulong2 a, ulong2 b);
403ulong3 max(ulong3 a, ulong3 b);
404ulong4 max(ulong4 a, ulong4 b);
405ushort max(ushort a, ushort b);
406ushort2 max(ushort2 a, ushort2 b);
407ushort3 max(ushort3 a, ushort3 b);
408ushort4 max(ushort4 a, ushort4 b);
410char min(char a, char b);
411char2 min(char2 a, char2 b);
412char3 min(char3 a, char3 b);
413char4 min(char4 a, char4 b);
414float min(float a, float b);
415float2 min(float2 a, float2 b);
416float3 min(float3 a, float3 b);
417float4 min(float4 a, float4 b);
418int min(int a, int b);
419int2 min(int2 a, int2 b);
420int3 min(int3 a, int3 b);
421int4 min(int4 a, int4 b);
422long min(long a, long b);
423long2 min(long2 a, long2 b);
424long3 min(long3 a, long3 b);
425long4 min(long4 a, long4 b);
426short min(short a, short b);
427short2 min(short2 a, short2 b);
428short3 min(short3 a, short3 b);
429short4 min(short4 a, short4 b);
430uchar min(uchar a, uchar b);
431uchar2 min(uchar2 a, uchar2 b);
432uchar3 min(uchar3 a, uchar3 b);
433uchar4 min(uchar4 a, uchar4 b);
434uint min(uint a, uint b);
435uint2 min(uint2 a, uint2 b);
436uint3 min(uint3 a, uint3 b);
437uint4 min(uint4 a, uint4 b);
438ulong min(ulong a, ulong b);
439ulong2 min(ulong2 a, ulong2 b);
440ulong3 min(ulong3 a, ulong3 b);
441ulong4 min(ulong4 a, ulong4 b);
442ushort min(ushort a, ushort b);
443ushort2 min(ushort2 a, ushort2 b);
444ushort3 min(ushort3 a, ushort3 b);
445ushort4 min(ushort4 a, ushort4 b);
447float mix(float start, float stop, float fraction);
448float2 mix(float2 start, float2 stop, float fraction);
449float2 mix(float2 start, float2 stop, float2 fraction);
450float3 mix(float3 start, float3 stop, float fraction);
451float3 mix(float3 start, float3 stop, float3 fraction);
452float4 mix(float4 start, float4 stop, float fraction);
453float4 mix(float4 start, float4 stop, float4 fraction);
455float modf(float v, float* integral_part);
456float2 modf(float2 v, float2* integral_part);
457float3 modf(float3 v, float3* integral_part);
458float4 modf(float4 v, float4* integral_part);
460float nan(uint v);
462float native_acos(float v);
463float2 native_acos(float2 v);
464float3 native_acos(float3 v);
465float4 native_acos(float4 v);
467float native_acosh(float v);
468float2 native_acosh(float2 v);
469float3 native_acosh(float3 v);
470float4 native_acosh(float4 v);
472float native_acospi(float v);
473float2 native_acospi(float2 v);
474float3 native_acospi(float3 v);
475float4 native_acospi(float4 v);
477float native_asin(float v);
478float2 native_asin(float2 v);
479float3 native_asin(float3 v);
480float4 native_asin(float4 v);
482float native_asinh(float v);
483float2 native_asinh(float2 v);
484float3 native_asinh(float3 v);
485float4 native_asinh(float4 v);
487float native_asinpi(float v);
488float2 native_asinpi(float2 v);
489float3 native_asinpi(float3 v);
490float4 native_asinpi(float4 v);
492float native_atan(float v);
493float2 native_atan(float2 v);
494float3 native_atan(float3 v);
495float4 native_atan(float4 v);
497float native_atan2(float numerator, float denominator);
498float2 native_atan2(float2 numerator, float2 denominator);
499float3 native_atan2(float3 numerator, float3 denominator);
500float4 native_atan2(float4 numerator, float4 denominator);
502float native_atan2pi(float numerator, float denominator);
503float2 native_atan2pi(float2 numerator, float2 denominator);
504float3 native_atan2pi(float3 numerator, float3 denominator);
505float4 native_atan2pi(float4 numerator, float4 denominator);
507float native_atanh(float v);
508float2 native_atanh(float2 v);
509float3 native_atanh(float3 v);
510float4 native_atanh(float4 v);
512float native_atanpi(float v);
513float2 native_atanpi(float2 v);
514float3 native_atanpi(float3 v);
515float4 native_atanpi(float4 v);
517float native_cbrt(float v);
518float2 native_cbrt(float2 v);
519float3 native_cbrt(float3 v);
520float4 native_cbrt(float4 v);
522float native_cos(float v);
523float2 native_cos(float2 v);
524float3 native_cos(float3 v);
525float4 native_cos(float4 v);
527float native_cosh(float v);
528float2 native_cosh(float2 v);
529float3 native_cosh(float3 v);
530float4 native_cosh(float4 v);
532float native_cospi(float v);
533float2 native_cospi(float2 v);
534float3 native_cospi(float3 v);
535float4 native_cospi(float4 v);
537float native_divide(float left_vector, float right_vector);
538float2 native_divide(float2 left_vector, float2 right_vector);
539float3 native_divide(float3 left_vector, float3 right_vector);
540float4 native_divide(float4 left_vector, float4 right_vector);
542float native_exp(float v);
543float2 native_exp(float2 v);
544float3 native_exp(float3 v);
545float4 native_exp(float4 v);
547float native_exp10(float v);
548float2 native_exp10(float2 v);
549float3 native_exp10(float3 v);
550float4 native_exp10(float4 v);
552float native_exp2(float v);
553float2 native_exp2(float2 v);
554float3 native_exp2(float3 v);
555float4 native_exp2(float4 v);
557float native_expm1(float v);
558float2 native_expm1(float2 v);
559float3 native_expm1(float3 v);
560float4 native_expm1(float4 v);
562float native_hypot(float a, float b);
563float2 native_hypot(float2 a, float2 b);
564float3 native_hypot(float3 a, float3 b);
565float4 native_hypot(float4 a, float4 b);
567float native_log(float v);
568float2 native_log(float2 v);
569float3 native_log(float3 v);
570float4 native_log(float4 v);
572float native_log10(float v);
573float2 native_log10(float2 v);
574float3 native_log10(float3 v);
575float4 native_log10(float4 v);
577float native_log1p(float v);
578float2 native_log1p(float2 v);
579float3 native_log1p(float3 v);
580float4 native_log1p(float4 v);
582float native_log2(float v);
583float2 native_log2(float2 v);
584float3 native_log2(float3 v);
585float4 native_log2(float4 v);
587float native_powr(float base, float exponent);
588float2 native_powr(float2 base, float2 exponent);
589float3 native_powr(float3 base, float3 exponent);
590float4 native_powr(float4 base, float4 exponent);
592float native_recip(float v);
593float2 native_recip(float2 v);
594float3 native_recip(float3 v);
595float4 native_recip(float4 v);
597float native_rootn(float v, int n);
598float2 native_rootn(float2 v, int2 n);
599float3 native_rootn(float3 v, int3 n);
600float4 native_rootn(float4 v, int4 n);
602float native_rsqrt(float v);
603float2 native_rsqrt(float2 v);
604float3 native_rsqrt(float3 v);
605float4 native_rsqrt(float4 v);
607float native_sin(float v);
608float2 native_sin(float2 v);
609float3 native_sin(float3 v);
610float4 native_sin(float4 v);
612float native_sincos(float v, float* cos);
613float2 native_sincos(float2 v, float2* cos);
614float3 native_sincos(float3 v, float3* cos);
615float4 native_sincos(float4 v, float4* cos);
617float native_sinh(float v);
618float2 native_sinh(float2 v);
619float3 native_sinh(float3 v);
620float4 native_sinh(float4 v);
622float native_sinpi(float v);
623float2 native_sinpi(float2 v);
624float3 native_sinpi(float3 v);
625float4 native_sinpi(float4 v);
627float native_sqrt(float v);
628float2 native_sqrt(float2 v);
629float3 native_sqrt(float3 v);
630float4 native_sqrt(float4 v);
632float native_tan(float v);
633float2 native_tan(float2 v);
634float3 native_tan(float3 v);
635float4 native_tan(float4 v);
637float native_tanh(float v);
638float2 native_tanh(float2 v);
639float3 native_tanh(float3 v);
640float4 native_tanh(float4 v);
642float native_tanpi(float v);
643float2 native_tanpi(float2 v);
644float3 native_tanpi(float3 v);
645float4 native_tanpi(float4 v);
647float nextafter(float v, float target);
648float2 nextafter(float2 v, float2 target);
649float3 nextafter(float3 v, float3 target);
650float4 nextafter(float4 v, float4 target);
652float pow(float base, float exponent);
653float2 pow(float2 base, float2 exponent);
654float3 pow(float3 base, float3 exponent);
655float4 pow(float4 base, float4 exponent);
657float pown(float base, int exponent);
658float2 pown(float2 base, int2 exponent);
659float3 pown(float3 base, int3 exponent);
660float4 pown(float4 base, int4 exponent);
662float powr(float base, float exponent);
663float2 powr(float2 base, float2 exponent);
664float3 powr(float3 base, float3 exponent);
665float4 powr(float4 base, float4 exponent);
667float radians(float v);
668float2 radians(float2 v);
669float3 radians(float3 v);
670float4 radians(float4 v);
672float remainder(float numerator, float denominator);
673float2 remainder(float2 numerator, float2 denominator);
674float3 remainder(float3 numerator, float3 denominator);
675float4 remainder(float4 numerator, float4 denominator);
677float remquo(float numerator, float denominator, int* quotient);
678float2 remquo(float2 numerator, float2 denominator, int2* quotient);
679float3 remquo(float3 numerator, float3 denominator, int3* quotient);
680float4 remquo(float4 numerator, float4 denominator, int4* quotient);
682float rint(float v);
683float2 rint(float2 v);
684float3 rint(float3 v);
685float4 rint(float4 v);
687float rootn(float v, int n);
688float2 rootn(float2 v, int2 n);
689float3 rootn(float3 v, int3 n);
690float4 rootn(float4 v, int4 n);
692float round(float v);
693float2 round(float2 v);
694float3 round(float3 v);
695float4 round(float4 v);
697char rsClamp(char amount, char low, char high);
698int rsClamp(int amount, int low, int high);
699short rsClamp(short amount, short low, short high);
700uchar rsClamp(uchar amount, uchar low, uchar high);
701uint rsClamp(uint amount, uint low, uint high);
702ushort rsClamp(ushort amount, ushort low, ushort high);
704float rsFrac(float v);
706float rsRand(float max_value);
707float rsRand(float min_value, float max_value);
708int rsRand(int max_value);
709int rsRand(int min_value, int max_value);
711float rsqrt(float v);
712float2 rsqrt(float2 v);
713float3 rsqrt(float3 v);
714float4 rsqrt(float4 v);
716float sign(float v);
717float2 sign(float2 v);
718float3 sign(float3 v);
719float4 sign(float4 v);
721float sin(float v);
722float2 sin(float2 v);
723float3 sin(float3 v);
724float4 sin(float4 v);
726float sincos(float v, float* cos);
727float2 sincos(float2 v, float2* cos);
728float3 sincos(float3 v, float3* cos);
729float4 sincos(float4 v, float4* cos);
731float sinh(float v);
732float2 sinh(float2 v);
733float3 sinh(float3 v);
734float4 sinh(float4 v);
736float sinpi(float v);
737float2 sinpi(float2 v);
738float3 sinpi(float3 v);
739float4 sinpi(float4 v);
741float sqrt(float v);
742float2 sqrt(float2 v);
743float3 sqrt(float3 v);
744float4 sqrt(float4 v);
746float step(float edge, float v);
747float2 step(float edge, float2 v);
748float2 step(float2 edge, float v);
749float2 step(float2 edge, float2 v);
750float3 step(float edge, float3 v);
751float3 step(float3 edge, float v);
752float3 step(float3 edge, float3 v);
753float4 step(float edge, float4 v);
754float4 step(float4 edge, float v);
755float4 step(float4 edge, float4 v);
757float tan(float v);
758float2 tan(float2 v);
759float3 tan(float3 v);
760float4 tan(float4 v);
762float tanh(float v);
763float2 tanh(float2 v);
764float3 tanh(float3 v);
765float4 tanh(float4 v);
767float tanpi(float v);
768float2 tanpi(float2 v);
769float3 tanpi(float3 v);
770float4 tanpi(float4 v);
772float tgamma(float v);
773float2 tgamma(float2 v);
774float3 tgamma(float3 v);
775float4 tgamma(float4 v);
777float trunc(float v);
778float2 trunc(float2 v);
779float3 trunc(float3 v);
780float4 trunc(float4 v);
782uchar4 rsPackColorTo8888(float r, float g, float b);
783uchar4 rsPackColorTo8888(float r, float g, float b, float a);
784uchar4 rsPackColorTo8888(float3 color);
785uchar4 rsPackColorTo8888(float4 color);
786float4 rsUnpackColor8888(uchar4 c);
788float4 rsYuvToRGBA_float4(uchar y, uchar u, uchar v);
789uchar4 rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v);
791- vector functions
793float3 cross(float3 left_vector, float3 right_vector);
794float4 cross(float4 left_vector, float4 right_vector);
796float distance(float  left_vector, float  right_vector);
797float distance(float2 left_vector, float2 right_vector);
798float distance(float3 left_vector, float3 right_vector);
799float distance(float4 left_vector, float4 right_vector);
801float dot(float  left_vector, float  right_vector);
802float dot(float2 left_vector, float2 right_vector);
803float dot(float3 left_vector, float3 right_vector);
804float dot(float4 left_vector, float4 right_vector);
806float fast_distance(float  left_vector, float  right_vector);
807float fast_distance(float2 left_vector, float2 right_vector);
808float fast_distance(float3 left_vector, float3 right_vector);
809float fast_distance(float4 left_vector, float4 right_vector);
811float fast_length(float  v);
812float fast_length(float2 v);
813float fast_length(float3 v);
814float fast_length(float4 v);
816float  fast_normalize(float  v);
817float2 fast_normalize(float2 v);
818float3 fast_normalize(float3 v);
819float4 fast_normalize(float4 v);
821float length(float  v);
822float length(float2 v);
823float length(float3 v);
824float length(float4 v);
826float native_distance(float  left_vector, float  right_vector);
827float native_distance(float2 left_vector, float2 right_vector);
828float native_distance(float3 left_vector, float3 right_vector);
829float native_distance(float4 left_vector, float4 right_vector);
831float native_length(float  v);
832float native_length(float2 v);
833float native_length(float3 v);
834float native_length(float4 v);
836float  native_normalize(float  v);
837float2 native_normalize(float2 v);
838float3 native_normalize(float3 v);
839float4 native_normalize(float4 v);
841float  normalize(float  v);
842float2 normalize(float2 v);
843float3 normalize(float3 v);
844float4 normalize(float4 v);
846- conversion functions
848char2 convert_char2(char2 v);
849char2 convert_char2(double2 v);
850char2 convert_char2(float2 v);
851char2 convert_char2(int2 v);
852char2 convert_char2(long2 v);
853char2 convert_char2(short2 v);
854char2 convert_char2(uchar2 v);
855char2 convert_char2(uint2 v);
856char2 convert_char2(ulong2 v);
857char2 convert_char2(ushort2 v);
859char3 convert_char3(char3 v);
860char3 convert_char3(double3 v);
861char3 convert_char3(float3 v);
862char3 convert_char3(int3 v);
863char3 convert_char3(long3 v);
864char3 convert_char3(short3 v);
865char3 convert_char3(uchar3 v);
866char3 convert_char3(uint3 v);
867char3 convert_char3(ulong3 v);
868char3 convert_char3(ushort3 v);
870char4 convert_char4(char4 v);
871char4 convert_char4(double4 v);
872char4 convert_char4(float4 v);
873char4 convert_char4(int4 v);
874char4 convert_char4(long4 v);
875char4 convert_char4(short4 v);
876char4 convert_char4(uchar4 v);
877char4 convert_char4(uint4 v);
878char4 convert_char4(ulong4 v);
879char4 convert_char4(ushort4 v);
881double2 convert_double2(char2 v);
882double2 convert_double2(double2 v);
883double2 convert_double2(float2 v);
884double2 convert_double2(int2 v);
885double2 convert_double2(long2 v);
886double2 convert_double2(short2 v);
887double2 convert_double2(uchar2 v);
888double2 convert_double2(uint2 v);
889double2 convert_double2(ulong2 v);
890double2 convert_double2(ushort2 v);
892double3 convert_double3(char3 v);
893double3 convert_double3(double3 v);
894double3 convert_double3(float3 v);
895double3 convert_double3(int3 v);
896double3 convert_double3(long3 v);
897double3 convert_double3(short3 v);
898double3 convert_double3(uchar3 v);
899double3 convert_double3(uint3 v);
900double3 convert_double3(ulong3 v);
901double3 convert_double3(ushort3 v);
903double4 convert_double4(char4 v);
904double4 convert_double4(double4 v);
905double4 convert_double4(float4 v);
906double4 convert_double4(int4 v);
907double4 convert_double4(long4 v);
908double4 convert_double4(short4 v);
909double4 convert_double4(uchar4 v);
910double4 convert_double4(uint4 v);
911double4 convert_double4(ulong4 v);
912double4 convert_double4(ushort4 v);
914float2 convert_float2(char2 v);
915float2 convert_float2(double2 v);
916float2 convert_float2(float2 v);
917float2 convert_float2(int2 v);
918float2 convert_float2(long2 v);
919float2 convert_float2(short2 v);
920float2 convert_float2(uchar2 v);
921float2 convert_float2(uint2 v);
922float2 convert_float2(ulong2 v);
923float2 convert_float2(ushort2 v);
925float3 convert_float3(char3 v);
926float3 convert_float3(double3 v);
927float3 convert_float3(float3 v);
928float3 convert_float3(int3 v);
929float3 convert_float3(long3 v);
930float3 convert_float3(short3 v);
931float3 convert_float3(uchar3 v);
932float3 convert_float3(uint3 v);
933float3 convert_float3(ulong3 v);
934float3 convert_float3(ushort3 v);
936float4 convert_float4(char4 v);
937float4 convert_float4(double4 v);
938float4 convert_float4(float4 v);
939float4 convert_float4(int4 v);
940float4 convert_float4(long4 v);
941float4 convert_float4(short4 v);
942float4 convert_float4(uchar4 v);
943float4 convert_float4(uint4 v);
944float4 convert_float4(ulong4 v);
945float4 convert_float4(ushort4 v);
947int2 convert_int2(char2 v);
948int2 convert_int2(double2 v);
949int2 convert_int2(float2 v);
950int2 convert_int2(int2 v);
951int2 convert_int2(long2 v);
952int2 convert_int2(short2 v);
953int2 convert_int2(uchar2 v);
954int2 convert_int2(uint2 v);
955int2 convert_int2(ulong2 v);
956int2 convert_int2(ushort2 v);
958int3 convert_int3(char3 v);
959int3 convert_int3(double3 v);
960int3 convert_int3(float3 v);
961int3 convert_int3(int3 v);
962int3 convert_int3(long3 v);
963int3 convert_int3(short3 v);
964int3 convert_int3(uchar3 v);
965int3 convert_int3(uint3 v);
966int3 convert_int3(ulong3 v);
967int3 convert_int3(ushort3 v);
969int4 convert_int4(char4 v);
970int4 convert_int4(double4 v);
971int4 convert_int4(float4 v);
972int4 convert_int4(int4 v);
973int4 convert_int4(long4 v);
974int4 convert_int4(short4 v);
975int4 convert_int4(uchar4 v);
976int4 convert_int4(uint4 v);
977int4 convert_int4(ulong4 v);
978int4 convert_int4(ushort4 v);
980long2 convert_long2(char2 v);
981long2 convert_long2(double2 v);
982long2 convert_long2(float2 v);
983long2 convert_long2(int2 v);
984long2 convert_long2(long2 v);
985long2 convert_long2(short2 v);
986long2 convert_long2(uchar2 v);
987long2 convert_long2(uint2 v);
988long2 convert_long2(ulong2 v);
989long2 convert_long2(ushort2 v);
991long3 convert_long3(char3 v);
992long3 convert_long3(double3 v);
993long3 convert_long3(float3 v);
994long3 convert_long3(int3 v);
995long3 convert_long3(long3 v);
996long3 convert_long3(short3 v);
997long3 convert_long3(uchar3 v);
998long3 convert_long3(uint3 v);
999long3 convert_long3(ulong3 v);
1000long3 convert_long3(ushort3 v);
1002long4 convert_long4(char4 v);
1003long4 convert_long4(double4 v);
1004long4 convert_long4(float4 v);
1005long4 convert_long4(int4 v);
1006long4 convert_long4(long4 v);
1007long4 convert_long4(short4 v);
1008long4 convert_long4(uchar4 v);
1009long4 convert_long4(uint4 v);
1010long4 convert_long4(ulong4 v);
1011long4 convert_long4(ushort4 v);
1013short2 convert_short2(char2 v);
1014short2 convert_short2(double2 v);
1015short2 convert_short2(float2 v);
1016short2 convert_short2(int2 v);
1017short2 convert_short2(long2 v);
1018short2 convert_short2(short2 v);
1019short2 convert_short2(uchar2 v);
1020short2 convert_short2(uint2 v);
1021short2 convert_short2(ulong2 v);
1022short2 convert_short2(ushort2 v);
1024short3 convert_short3(char3 v);
1025short3 convert_short3(double3 v);
1026short3 convert_short3(float3 v);
1027short3 convert_short3(int3 v);
1028short3 convert_short3(long3 v);
1029short3 convert_short3(short3 v);
1030short3 convert_short3(uchar3 v);
1031short3 convert_short3(uint3 v);
1032short3 convert_short3(ulong3 v);
1033short3 convert_short3(ushort3 v);
1035short4 convert_short4(char4 v);
1036short4 convert_short4(double4 v);
1037short4 convert_short4(float4 v);
1038short4 convert_short4(int4 v);
1039short4 convert_short4(long4 v);
1040short4 convert_short4(short4 v);
1041short4 convert_short4(uchar4 v);
1042short4 convert_short4(uint4 v);
1043short4 convert_short4(ulong4 v);
1044short4 convert_short4(ushort4 v);
1046uchar2 convert_uchar2(char2 v);
1047uchar2 convert_uchar2(double2 v);
1048uchar2 convert_uchar2(float2 v);
1049uchar2 convert_uchar2(int2 v);
1050uchar2 convert_uchar2(long2 v);
1051uchar2 convert_uchar2(short2 v);
1052uchar2 convert_uchar2(uchar2 v);
1053uchar2 convert_uchar2(uint2 v);
1054uchar2 convert_uchar2(ulong2 v);
1055uchar2 convert_uchar2(ushort2 v);
1057uchar3 convert_uchar3(char3 v);
1058uchar3 convert_uchar3(double3 v);
1059uchar3 convert_uchar3(float3 v);
1060uchar3 convert_uchar3(int3 v);
1061uchar3 convert_uchar3(long3 v);
1062uchar3 convert_uchar3(short3 v);
1063uchar3 convert_uchar3(uchar3 v);
1064uchar3 convert_uchar3(uint3 v);
1065uchar3 convert_uchar3(ulong3 v);
1066uchar3 convert_uchar3(ushort3 v);
1068uchar4 convert_uchar4(char4 v);
1069uchar4 convert_uchar4(double4 v);
1070uchar4 convert_uchar4(float4 v);
1071uchar4 convert_uchar4(int4 v);
1072uchar4 convert_uchar4(long4 v);
1073uchar4 convert_uchar4(short4 v);
1074uchar4 convert_uchar4(uchar4 v);
1075uchar4 convert_uchar4(uint4 v);
1076uchar4 convert_uchar4(ulong4 v);
1077uchar4 convert_uchar4(ushort4 v);
1079uint2 convert_uint2(char2 v);
1080uint2 convert_uint2(double2 v);
1081uint2 convert_uint2(float2 v);
1082uint2 convert_uint2(int2 v);
1083uint2 convert_uint2(long2 v);
1084uint2 convert_uint2(short2 v);
1085uint2 convert_uint2(uchar2 v);
1086uint2 convert_uint2(uint2 v);
1087uint2 convert_uint2(ulong2 v);
1088uint2 convert_uint2(ushort2 v);
1090uint3 convert_uint3(char3 v);
1091uint3 convert_uint3(double3 v);
1092uint3 convert_uint3(float3 v);
1093uint3 convert_uint3(int3 v);
1094uint3 convert_uint3(long3 v);
1095uint3 convert_uint3(short3 v);
1096uint3 convert_uint3(uchar3 v);
1097uint3 convert_uint3(uint3 v);
1098uint3 convert_uint3(ulong3 v);
1099uint3 convert_uint3(ushort3 v);
1101uint4 convert_uint4(char4 v);
1102uint4 convert_uint4(double4 v);
1103uint4 convert_uint4(float4 v);
1104uint4 convert_uint4(int4 v);
1105uint4 convert_uint4(long4 v);
1106uint4 convert_uint4(short4 v);
1107uint4 convert_uint4(uchar4 v);
1108uint4 convert_uint4(uint4 v);
1109uint4 convert_uint4(ulong4 v);
1110uint4 convert_uint4(ushort4 v);
1112ulong2 convert_ulong2(char2 v);
1113ulong2 convert_ulong2(double2 v);
1114ulong2 convert_ulong2(float2 v);
1115ulong2 convert_ulong2(int2 v);
1116ulong2 convert_ulong2(long2 v);
1117ulong2 convert_ulong2(short2 v);
1118ulong2 convert_ulong2(uchar2 v);
1119ulong2 convert_ulong2(uint2 v);
1120ulong2 convert_ulong2(ulong2 v);
1121ulong2 convert_ulong2(ushort2 v);
1123ulong3 convert_ulong3(char3 v);
1124ulong3 convert_ulong3(double3 v);
1125ulong3 convert_ulong3(float3 v);
1126ulong3 convert_ulong3(int3 v);
1127ulong3 convert_ulong3(long3 v);
1128ulong3 convert_ulong3(short3 v);
1129ulong3 convert_ulong3(uchar3 v);
1130ulong3 convert_ulong3(uint3 v);
1131ulong3 convert_ulong3(ulong3 v);
1132ulong3 convert_ulong3(ushort3 v);
1134ulong4 convert_ulong4(char4 v);
1135ulong4 convert_ulong4(double4 v);
1136ulong4 convert_ulong4(float4 v);
1137ulong4 convert_ulong4(int4 v);
1138ulong4 convert_ulong4(long4 v);
1139ulong4 convert_ulong4(short4 v);
1140ulong4 convert_ulong4(uchar4 v);
1141ulong4 convert_ulong4(uint4 v);
1142ulong4 convert_ulong4(ulong4 v);
1143ulong4 convert_ulong4(ushort4 v);
1145ushort2 convert_ushort2(char2 v);
1146ushort2 convert_ushort2(double2 v);
1147ushort2 convert_ushort2(float2 v);
1148ushort2 convert_ushort2(int2 v);
1149ushort2 convert_ushort2(long2 v);
1150ushort2 convert_ushort2(short2 v);
1151ushort2 convert_ushort2(uchar2 v);
1152ushort2 convert_ushort2(uint2 v);
1153ushort2 convert_ushort2(ulong2 v);
1154ushort2 convert_ushort2(ushort2 v);
1156ushort3 convert_ushort3(char3 v);
1157ushort3 convert_ushort3(double3 v);
1158ushort3 convert_ushort3(float3 v);
1159ushort3 convert_ushort3(int3 v);
1160ushort3 convert_ushort3(long3 v);
1161ushort3 convert_ushort3(short3 v);
1162ushort3 convert_ushort3(uchar3 v);
1163ushort3 convert_ushort3(uint3 v);
1164ushort3 convert_ushort3(ulong3 v);
1165ushort3 convert_ushort3(ushort3 v);
1167ushort4 convert_ushort4(char4 v);
1168ushort4 convert_ushort4(double4 v);
1169ushort4 convert_ushort4(float4 v);
1170ushort4 convert_ushort4(int4 v);
1171ushort4 convert_ushort4(long4 v);
1172ushort4 convert_ushort4(short4 v);
1173ushort4 convert_ushort4(uchar4 v);
1174ushort4 convert_ushort4(uint4 v);
1175ushort4 convert_ushort4(ulong4 v);
1176ushort4 convert_ushort4(ushort4 v);
1178uchar4 rsPackColorTo8888(float r, float g, float b);
1179uchar4 rsPackColorTo8888(float r, float g, float b, float a);
1180uchar4 rsPackColorTo8888(float3 color);
1181uchar4 rsPackColorTo8888(float4 color);
1183float4 rsUnpackColor8888(uchar4 c);
1185float4 rsYuvToRGBA_float4(uchar y, uchar u, uchar v);
1187uchar4 rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v);
1189- matrix functions, some of these are not supported yet
1191-bool rsMatrixInverse(rs_matrix4x4* m);
1193-bool rsMatrixInverseTranspose(rs_matrix4x4* m);
1195-void rsMatrixLoad(rs_matrix2x2* destination, float* array);
1196-void rsMatrixLoad(rs_matrix2x2* destination, rs_matrix2x2* source);
1197-void rsMatrixLoad(rs_matrix3x3* destination, float* array);
1198-void rsMatrixLoad(rs_matrix3x3* destination, rs_matrix3x3* source);
1199-void rsMatrixLoad(rs_matrix4x4* destination, float* array);
1200-void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix2x2* source);
1201-void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix3x3* source);
1202-void rsMatrixLoad(rs_matrix4x4* destination, rs_matrix4x4* source);
1204-void rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top, float near, float far);
1206-void rsMatrixLoadIdentity(rs_matrix2x2* m);
1207-void rsMatrixLoadIdentity(rs_matrix3x3* m);
1208-void rsMatrixLoadIdentity(rs_matrix4x4* m);
1210-void rsMatrixLoadMultiply(rs_matrix2x2* m, rs_matrix2x2* lhs, rs_matrix2x2* rhs);
1211-void rsMatrixLoadMultiply(rs_matrix3x3* m, rs_matrix3x3* lhs, rs_matrix3x3* rhs);
1212-void rsMatrixLoadMultiply(rs_matrix4x4* m, rs_matrix4x4* lhs, rs_matrix4x4* rhs);
1214-void rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near, float far);
1216-void rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
1218-void rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
1220-void rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
1222-void rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
1224float2 rsMatrixMultiply(rs_matrix2x2* m, float2 in);
1225float3 rsMatrixMultiply(rs_matrix3x3* m, float2 in);
1226float3 rsMatrixMultiply(rs_matrix3x3* m, float3 in);
1227float4 rsMatrixMultiply(rs_matrix4x4* m, float2 in);
1228float4 rsMatrixMultiply(rs_matrix4x4* m, float3 in);
1229float4 rsMatrixMultiply(rs_matrix4x4* m, float4 in);
1230void rsMatrixMultiply(rs_matrix2x2* m, rs_matrix2x2* rhs);
1231void rsMatrixMultiply(rs_matrix3x3* m, rs_matrix3x3* rhs);
1232void rsMatrixMultiply(rs_matrix4x4* m, rs_matrix4x4* rhs);
1234-void rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
1236-void rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
1238void rsMatrixSet(rs_matrix2x2* m, 0, 1, float v);
1239void rsMatrixSet(rs_matrix3x3* m, 2, 0, float v);
1240void rsMatrixSet(rs_matrix4x4* m, 1, 3, float v);
1242-void rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
1244-void rsMatrixTranspose(rs_matrix2x2* m);
1245-void rsMatrixTranspose(rs_matrix3x3* m);
1246-void rsMatrixTranspose(rs_matrix4x4* m);
1248- quaternion functions
1250void rsQuaternionAdd(rs_quaternion* q, rs_quaternion* rhs);
1252void rsQuaternionConjugate(rs_quaternion* q);
1254float rsQuaternionDot(rs_quaternion* q0, rs_quaternion* q1);
1256void rsQuaternionGetMatrixUnit(rs_matrix4x4* m, rs_quaternion* q);
1258void rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z);
1260void rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z);
1262void rsQuaternionMultiply(rs_quaternion* q, rs_quaternion* rhs);
1263void rsQuaternionMultiply(rs_quaternion* q, float scalar);
1265void rsQuaternionNormalize(rs_quaternion* q);
1267void rsQuaternionSet(rs_quaternion* q, rs_quaternion* rhs);
1268void rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z);
1270void rsQuaternionSlerp(rs_quaternion* q, rs_quaternion* q0, rs_quaternion* q1, float t);
1272- allocation data access functions, this is a subset, since we don't have all types of allocations
1274-void rsAllocationCopy1DRange(allocation_1D_global, uint dstOff, uint dstMip, uint count, allocation_1D_global2, uint srcOff, uint srcMip);
1276-void rsAllocationCopy2DRange(allocation_2D_global, uint dstXoff, uint dstYoff, uint dstMip, rs_allocation_cubemap_face dstFace, uint width, uint height, allocation_2D_global2, uint srcXoff, uint srcYoff, uint srcMip, rs_allocation_cubemap_face srcFace);
1278int2 rsAllocationVLoadX_int2(allocation_1D_global, 0);
1279int2 rsAllocationVLoadX_int2(allocation_2D_global, 24, 25);
1280int2 rsAllocationVLoadX_int2(allocation_3D_global, 0, 1, 0);
1281int3 rsAllocationVLoadX_int3(allocation_1D_global, 1);
1282int3 rsAllocationVLoadX_int3(allocation_2D_global, 27, 28);
1283int3 rsAllocationVLoadX_int3(allocation_3D_global, 1, 0, 1);
1284int4 rsAllocationVLoadX_int4(allocation_1D_global, 0);
1285int4 rsAllocationVLoadX_int4(allocation_2D_global, 29, 30);
1286int4 rsAllocationVLoadX_int4(allocation_3D_global, 0, 1, 0);
1288void rsAllocationVStoreX_int2(allocation_1D_global, int2 val, 2);
1289void rsAllocationVStoreX_int2(allocation_2D_global, int2 val, 6, 7);
1290void rsAllocationVStoreX_int2(allocation_3D_global, int2 val, 0, 1, 0);
1291void rsAllocationVStoreX_int3(allocation_1D_global, int3 val, 1);
1292void rsAllocationVStoreX_int3(allocation_2D_global, int3 val, 12, 13);
1293void rsAllocationVStoreX_int3(allocation_3D_global, int3 val, 1, 0, 1);
1294void rsAllocationVStoreX_int4(allocation_1D_global, int4 val, 0);
1295void rsAllocationVStoreX_int4(allocation_2D_global, int4 val, 18, 19);
1296void rsAllocationVStoreX_int4(allocation_3D_global, int4 val, 0, 1, 0);
1298void* rsGetElementAt(allocation_1D_global, 0);
1299void* rsGetElementAt(allocation_2D_global, 20, 21);
1300void* rsGetElementAt(allocation_3D_global, 1, 0, 1);
1301int rsGetElementAt_int(allocation_1D_global, 1);
1302int rsGetElementAt_int(allocation_2D_global, 22, 23);
1303int rsGetElementAt_int(allocation_3D_global, 0, 1, 0);
1305uchar rsGetElementAtYuv_uchar_U(allocation_YUV_2D_global, 0, 1);
1307uchar rsGetElementAtYuv_uchar_V(allocation_YUV_2D_global, 2, 3);
1309uchar rsGetElementAtYuv_uchar_Y(allocation_YUV_2D_global, 0, 1);
1311float4 rsSample(allocation_1D_global, rs_sampler s, float location);
1312float4 rsSample(allocation_1D_global, rs_sampler s, float location, float lod);
1313float4 rsSample(allocation_1D_global, rs_sampler s, float2 location);
1314float4 rsSample(allocation_1D_global, rs_sampler s, float2 location, float lod);
1316void rsSetElementAt(allocation_1D_global, int* ptr, 2);
1317void rsSetElementAt(allocation_2D_global, int* ptr, 24, 25);
1318void rsSetElementAt_int(allocation_1D_global, int val, 0);
1319void rsSetElementAt_int(allocation_2D_global, int val, 26, 27);
1320void rsSetElementAt_int(allocation_3D_global, int val, 1, 0, 1);
1324TYPE_MAP = {
1325    'void' : '',
1326    'char' : r'\((signed )?char\)',
1327    'uchar' : r'\(uchar\)',
1328    'short' : r'\(short\)',
1329    'ushort' : r'\(ushort\)',
1330    'int' : r'\(int\)',
1331    'uint' : r'\(uint\)',
1332    'long' : r'\((long )?long\)',
1333    'ulong' : r'\(ulong\)',
1334    'float' : r'\(float\)',
1335    'float2' : r'\(float2\)',
1336    'float3' : r'\(float3\)',
1337    'float4' : r'\(float4\)'
1338    }
1341def _build_arg(token):
1342    '''Given a C argument construct an lldb expression for the argument.
1344    Given a token, which represents a single argument of a C function
1345    declaration, construct an lldb expression for the argument.
1347    Args:
1348        token: A string representing a single argument to a function. This
1349               can be either [type][name] (e.g. int arg) or [value] (e.g. 5).
1351    Returns:
1352        The string that is the lldb expression for that argument, e.g.
1353        int_global or 5.
1354    '''
1355    if len(token.split()) == 1:
1356        # This is a fixed constant. Just take that as output.
1357        return token
1359    result = token.split()[0]
1361    # Remove the rs_ prefix, because our globals' names don't have them
1362    if result[:3] == 'rs_':
1363        result = result[3:]
1365    # If the function expects a pointer, take the address of the global
1366    if result[-1] == '*':
1367        result = '&' + result
1368        result = result[:-1]
1370    result += '_global'
1371    return result
1374def build_expr(line):
1375    '''Build an lldb expression given a function prototype.
1377    Given a function declaration, this function will construct an lldb
1378    expression to call it.
1380    Args:
1381        line: A string representing a function declaration.
1383    Returns:
1384        The string that is the lldb expression.
1385    '''
1386    tokens = re.findall(r"[^(),;]+", line)
1387    assert len(tokens) > 0
1388    ret_name = tokens[0].split()
1389    ret = ret_name[0]
1390    name = ret_name[1]
1391    expr = 'expr {0}('.format(name)
1393    first = True
1394    for tok in tokens[1:]:
1395        if not first:
1396            expr += ', '
1397        expr += _build_arg(tok)
1398        first = False
1400    expr += ')'
1401    return ret, expr