2 * Copyright (C) 2016 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
20 * rs_value_types.rsh: Numerical Types
24 * RenderScript supports the following scalar numerical types:
26 * 8 bits 16 bits 32 bits 64 bits
27 * Integer: char, int8_t short, int16_t int32_t long, long long, int64_t
28 * Unsigned integer: uchar, uint8_t ushort, uint16_t uint, uint32_t ulong, uint64_t
29 * Floating point: half float double
34 * RenderScript supports fixed size vectors of length 2, 3, and 4.
35 * Vectors are declared using the common type name followed by a 2, 3, or 4.
36 * E.g. float4, int3, double2, ulong4.
38 * To create vector literals, use the vector type followed by the values enclosed
39 * between curly braces, e.g. (float3){1.0f, 2.0f, 3.0f}.
41 * Entries of a vector can be accessed using different naming styles.
43 * Single entries can be accessed by following the variable name with a dot and:
44 * - The letters x, y, z, and w,
45 * - The letters r, g, b, and a,
46 * - The letter s or S, followed by a zero based index.
48 * For example, with int4 myVar; the following are equivalent:
49 * myVar.x == myVar.r == myVar.s0 == myVar.S0
50 * myVar.y == myVar.g == myVar.s1 == myVar.S1
51 * myVar.z == myVar.b == myVar.s2 == myVar.S2
52 * myVar.w == myVar.a == myVar.s3 == myVar.S3
54 * Multiple entries of a vector can be accessed at once by using an identifier that is
55 * the concatenation of multiple letters or indices. The resulting vector has a size
56 * equal to the number of entries named.
58 * With the example above, the middle two entries can be accessed using
59 * myVar.yz, myVar.gb, myVar.s12, and myVar.S12.
61 * The entries don't have to be contiguous or in increasing order. Entries can even be
62 * repeated, as long as we're not trying to assign to it. You also can't mix the naming
65 * Here are examples of what can or can't be done:
69 * v2 = v4.xx; // Valid
70 * v3 = v4.zxw; // Valid
71 * v3 = v4.bba; // Valid
72 * v3 = v4.s032; // Valid
73 * v3.s120 = v4.S233; // Valid
74 * v4.yz = v3.rg; // Valid
75 * v4.yzx = v3.rg; // Invalid: mismatched sizes
76 * v4.yzz = v3; // Invalid: z appears twice in an assignment
77 * v3 = v3.xas0; // Invalid: can't mix xyzw with rgba nor s0...
78 * v3 = v4.s034; // Invalid: the digit can only be 0, 1, 2, or 3
81 * Matrices and Quaternions:
83 * RenderScript supports fixed size square matrices of floats of size 2x2, 3x3, and 4x4.
84 * The types are named rs_matrix2x2, rs_matrix3x3, and rs_matrix4x4. See
85 * Matrix Functions for the list of operations.
87 * Quaternions are also supported via rs_quaternion. See Quaterion Functions for the list
91 #ifndef RENDERSCRIPT_RS_VALUE_TYPES_RSH
92 #define RENDERSCRIPT_RS_VALUE_TYPES_RSH
95 * half: 16 bit floating point value
97 * A 16 bit floating point value.
99 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
104 * half2: Two 16 bit floats
106 * Vector version of the half float type. Provides two half fields packed
107 * into a single 32 bit field with 32 bit alignment.
109 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
110 typedef half __attribute__((ext_vector_type(2))) half2;
114 * half3: Three 16 bit floats
116 * Vector version of the half float type. Provides three half fields packed
117 * into a single 64 bit field with 64 bit alignment.
119 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
120 typedef half __attribute__((ext_vector_type(3))) half3;
124 * half4: Four 16 bit floats
126 * Vector version of the half float type. Provides four half fields packed
127 * into a single 64 bit field with 64 bit alignment.
129 #if (defined(RS_VERSION) && (RS_VERSION >= 23))
130 typedef half __attribute__((ext_vector_type(4))) half4;
134 * int8_t: 8 bit signed integer
136 * 8 bit signed integer type.
141 * int16_t: 16 bit signed integer
143 * A 16 bit signed integer type.
145 typedef short int16_t;
148 * int32_t: 32 bit signed integer
150 * A 32 bit signed integer type.
155 * int64_t: 64 bit signed integer
157 * A 64 bit signed integer type.
159 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
160 typedef long long int64_t;
163 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
164 typedef long int64_t;
168 * uint8_t: 8 bit unsigned integer
170 * 8 bit unsigned integer type.
172 typedef unsigned char uint8_t;
175 * uint16_t: 16 bit unsigned integer
177 * A 16 bit unsigned integer type.
179 typedef unsigned short uint16_t;
182 * uint32_t: 32 bit unsigned integer
184 * A 32 bit unsigned integer type.
186 typedef unsigned int uint32_t;
189 * uint64_t: 64 bit unsigned integer
191 * A 64 bit unsigned integer type.
193 #if !defined(RS_VERSION) || (RS_VERSION <= 20)
194 typedef unsigned long long uint64_t;
197 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
198 typedef unsigned long uint64_t;
202 * uchar: 8 bit unsigned integer
204 * 8 bit unsigned integer type.
206 typedef uint8_t uchar;
209 * ushort: 16 bit unsigned integer
211 * A 16 bit unsigned integer type.
213 typedef uint16_t ushort;
216 * uint: 32 bit unsigned integer
218 * A 32 bit unsigned integer type.
220 typedef uint32_t uint;
223 * ulong: 64 bit unsigned integer
225 * A 64 bit unsigned integer type.
227 typedef uint64_t ulong;
230 * size_t: Unsigned size type
232 * Unsigned size type. The number of bits depend on the compilation flags.
235 typedef uint64_t size_t;
239 typedef uint32_t size_t;
243 * ssize_t: Signed size type
245 * Signed size type. The number of bits depend on the compilation flags.
248 typedef int64_t ssize_t;
252 typedef int32_t ssize_t;
256 * float2: Two 32 bit floats
258 * A vector of two floats. These two floats are packed into a single 64 bit field
259 * with a 64 bit alignment.
261 * A vector of two floats. These two floats are packed into a single 64 bit field
262 * with a 64 bit alignment.
264 typedef float __attribute__((ext_vector_type(2))) float2;
267 * float3: Three 32 bit floats
269 * A vector of three floats. These three floats are packed into a single 128 bit field
270 * with a 128 bit alignment.
272 typedef float __attribute__((ext_vector_type(3))) float3;
275 * float4: Four 32 bit floats
277 * A vector of four floats type. These four floats are packed into a single 128 bit field
278 * with a 128 bit alignment.
280 typedef float __attribute__((ext_vector_type(4))) float4;
283 * double2: Two 64 bit floats
285 * A vector of two doubles. These two double fields packed into a single 128 bit field
286 * with a 128 bit alignment.
288 typedef double __attribute__((ext_vector_type(2))) double2;
291 * double3: Three 64 bit floats
293 * A vector of three doubles. These three double fields packed into a single 256 bit field
294 * with a 256 bit alignment.
296 typedef double __attribute__((ext_vector_type(3))) double3;
299 * double4: Four 64 bit floats
301 * A vector of four doubles. These four double fields packed into a single 256 bit field
302 * with a 256 bit alignment.
304 typedef double __attribute__((ext_vector_type(4))) double4;
307 * uchar2: Two 8 bit unsigned integers
309 * A vector of two uchars. These two uchar fields packed into a single 16 bit field
310 * with a 16 bit alignment.
312 typedef uchar __attribute__((ext_vector_type(2))) uchar2;
315 * uchar3: Three 8 bit unsigned integers
317 * A vector of three uchars. These three uchar fields packed into a single 32 bit field
318 * with a 32 bit alignment.
320 typedef uchar __attribute__((ext_vector_type(3))) uchar3;
323 * uchar4: Four 8 bit unsigned integers
325 * A vector of four uchars. These four uchar fields packed into a single 32 bit field
326 * with a 32 bit alignment.
328 typedef uchar __attribute__((ext_vector_type(4))) uchar4;
331 * ushort2: Two 16 bit unsigned integers
333 * A vector of two ushorts. These two ushort fields packed into a single 32 bit field
334 * with a 32 bit alignment.
336 typedef ushort __attribute__((ext_vector_type(2))) ushort2;
339 * ushort3: Three 16 bit unsigned integers
341 * A vector of three ushorts. These three ushort fields packed into a single 64 bit field
342 * with a 64 bit alignment.
344 typedef ushort __attribute__((ext_vector_type(3))) ushort3;
347 * ushort4: Four 16 bit unsigned integers
349 * A vector of four ushorts. These four ushort fields packed into a single 64 bit field
350 * with a 64 bit alignment.
352 typedef ushort __attribute__((ext_vector_type(4))) ushort4;
355 * uint2: Two 32 bit unsigned integers
357 * A vector of two uints. These two uints are packed into a single 64 bit field
358 * with a 64 bit alignment.
360 typedef uint __attribute__((ext_vector_type(2))) uint2;
363 * uint3: Three 32 bit unsigned integers
365 * A vector of three uints. These three uints are packed into a single 128 bit field
366 * with a 128 bit alignment.
368 typedef uint __attribute__((ext_vector_type(3))) uint3;
371 * uint4: Four 32 bit unsigned integers
373 * A vector of four uints. These four uints are packed into a single 128 bit field
374 * with a 128 bit alignment.
376 typedef uint __attribute__((ext_vector_type(4))) uint4;
379 * ulong2: Two 64 bit unsigned integers
381 * A vector of two ulongs. These two ulongs are packed into a single 128 bit field
382 * with a 128 bit alignment.
384 typedef ulong __attribute__((ext_vector_type(2))) ulong2;
387 * ulong3: Three 64 bit unsigned integers
389 * A vector of three ulongs. These three ulong fields packed into a single 256 bit field
390 * with a 256 bit alignment.
392 typedef ulong __attribute__((ext_vector_type(3))) ulong3;
395 * ulong4: Four 64 bit unsigned integers
397 * A vector of four ulongs. These four ulong fields packed into a single 256 bit field
398 * with a 256 bit alignment.
400 typedef ulong __attribute__((ext_vector_type(4))) ulong4;
403 * char2: Two 8 bit signed integers
405 * A vector of two chars. These two chars are packed into a single 16 bit field
406 * with a 16 bit alignment.
408 typedef char __attribute__((ext_vector_type(2))) char2;
411 * char3: Three 8 bit signed integers
413 * A vector of three chars. These three chars are packed into a single 32 bit field
414 * with a 32 bit alignment.
416 typedef char __attribute__((ext_vector_type(3))) char3;
419 * char4: Four 8 bit signed integers
421 * A vector of four chars. These four chars are packed into a single 32 bit field
422 * with a 32 bit alignment.
424 typedef char __attribute__((ext_vector_type(4))) char4;
427 * short2: Two 16 bit signed integers
429 * A vector of two shorts. These two shorts are packed into a single 32 bit field
430 * with a 32 bit alignment.
432 typedef short __attribute__((ext_vector_type(2))) short2;
435 * short3: Three 16 bit signed integers
437 * A vector of three shorts. These three short fields packed into a single 64 bit field
438 * with a 64 bit alignment.
440 typedef short __attribute__((ext_vector_type(3))) short3;
443 * short4: Four 16 bit signed integers
445 * A vector of four shorts. These four short fields packed into a single 64 bit field
446 * with a 64 bit alignment.
448 typedef short __attribute__((ext_vector_type(4))) short4;
451 * int2: Two 32 bit signed integers
453 * A vector of two ints. These two ints are packed into a single 64 bit field
454 * with a 64 bit alignment.
456 typedef int __attribute__((ext_vector_type(2))) int2;
459 * int3: Three 32 bit signed integers
461 * A vector of three ints. These three ints are packed into a single 128 bit field
462 * with a 128 bit alignment.
464 typedef int __attribute__((ext_vector_type(3))) int3;
467 * int4: Four 32 bit signed integers
469 * A vector of four ints. These two fours are packed into a single 128 bit field
470 * with a 128 bit alignment.
472 typedef int __attribute__((ext_vector_type(4))) int4;
475 * long2: Two 64 bit signed integers
477 * A vector of two longs. These two longs are packed into a single 128 bit field
478 * with a 128 bit alignment.
480 typedef long __attribute__((ext_vector_type(2))) long2;
483 * long3: Three 64 bit signed integers
485 * A vector of three longs. These three longs are packed into a single 256 bit field
486 * with a 256 bit alignment.
488 typedef long __attribute__((ext_vector_type(3))) long3;
491 * long4: Four 64 bit signed integers
493 * A vector of four longs. These four longs are packed into a single 256 bit field
494 * with a 256 bit alignment.
496 typedef long __attribute__((ext_vector_type(4))) long4;
499 * rs_matrix2x2: 2x2 matrix of 32 bit floats
501 * A square 2x2 matrix of floats. The entries are stored in the array at the
502 * location [row*2 + col].
504 * See Matrix Functions.
511 * rs_matrix3x3: 3x3 matrix of 32 bit floats
513 * A square 3x3 matrix of floats. The entries are stored in the array at the
514 * location [row*3 + col].
516 * See Matrix Functions.
523 * rs_matrix4x4: 4x4 matrix of 32 bit floats
525 * A square 4x4 matrix of floats. The entries are stored in the array at the
526 * location [row*4 + col].
528 * See Matrix Functions.
535 * rs_quaternion: Quaternion
537 * A square 4x4 matrix of floats that represents a quaternion.
539 * See Quaternion Functions.
541 typedef float4 rs_quaternion;
543 #endif // RENDERSCRIPT_RS_VALUE_TYPES_RSH