blob: e9c3c5e4fcb9f2d352c14ebada285def18f035f5 [file] [log] [blame]
Jason Sams573fa622011-08-08 16:52:30 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17/** @file rs_types.rsh
Jason Samsa00e6d82011-08-08 14:31:25 -070018 *
19 * Define the standard Renderscript types
20 *
21 * Integers
22 * 8 bit: char, int8_t
23 * 16 bit: short, int16_t
24 * 32 bit: int, in32_t
25 * 64 bit: long, long long, int64_t
26 *
27 * Unsigned Integers
28 * 8 bit: uchar, uint8_t
29 * 16 bit: ushort, uint16_t
30 * 32 bit: uint, uint32_t
31 * 64 bit: ulong, uint64_t
32 *
33 * Floating point
34 * 32 bit: float
35 * 64 bit: double
36 *
37 * Vectors of length 2, 3, and 4 are supported for all the types above.
38 *
39 */
40
Shih-wei Liao708e04f2010-10-07 18:21:32 -070041#ifndef __RS_TYPES_RSH__
42#define __RS_TYPES_RSH__
Jason Sams33bcfa22010-03-16 15:35:57 -070043
Shih-wei Liao1ad96122011-01-19 02:18:45 -080044#define M_PI 3.14159265358979323846264338327950288f /* pi */
45
Shih-wei Liaocbcced22011-01-19 12:17:54 -080046#include "stdbool.h"
Jason Samsa00e6d82011-08-08 14:31:25 -070047/**
48 * 8 bit integer type
49 */
Jason Sams33bcfa22010-03-16 15:35:57 -070050typedef char int8_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070051/**
52 * 16 bit integer type
53 */
Jason Sams33bcfa22010-03-16 15:35:57 -070054typedef short int16_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070055/**
56 * 32 bit integer type
57 */
Jason Sams33bcfa22010-03-16 15:35:57 -070058typedef int int32_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070059/**
60 * 64 bit integer type
61 */
Jason Samsd79b2e92010-05-19 17:22:57 -070062typedef long long int64_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070063/**
64 * 8 bit unsigned integer type
65 */
Jason Sams33bcfa22010-03-16 15:35:57 -070066typedef unsigned char uint8_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070067/**
68 * 16 bit unsigned integer type
69 */
Jason Sams33bcfa22010-03-16 15:35:57 -070070typedef unsigned short uint16_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070071/**
72 * 32 bit unsigned integer type
73 */
Jason Sams33bcfa22010-03-16 15:35:57 -070074typedef unsigned int uint32_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070075/**
76 * 64 bit unsigned integer type
77 */
Jason Samsd79b2e92010-05-19 17:22:57 -070078typedef unsigned long long uint64_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070079/**
80 * 8 bit unsigned integer type
81 */
Jason Sams33bcfa22010-03-16 15:35:57 -070082typedef uint8_t uchar;
Jason Samsa00e6d82011-08-08 14:31:25 -070083/**
84 * 16 bit unsigned integer type
85 */
Jason Sams33bcfa22010-03-16 15:35:57 -070086typedef uint16_t ushort;
Jason Samsa00e6d82011-08-08 14:31:25 -070087/**
88 * 32 bit unsigned integer type
89 */
Jason Sams33bcfa22010-03-16 15:35:57 -070090typedef uint32_t uint;
Jason Samsa00e6d82011-08-08 14:31:25 -070091/**
Stephen Hines46e5a032011-08-26 19:03:16 -070092 * Typedef for unsigned long (use for 64-bit unsigned integers)
Jason Samsa00e6d82011-08-08 14:31:25 -070093 */
Jason Samsd79b2e92010-05-19 17:22:57 -070094typedef uint64_t ulong;
Jason Samsa00e6d82011-08-08 14:31:25 -070095/**
96 * Typedef for unsigned int
97 */
Jason Samscf57dec2011-07-25 12:58:37 -070098typedef uint32_t size_t;
Jason Samsa00e6d82011-08-08 14:31:25 -070099/**
100 * Typedef for int (use for 32-bit integers)
101 */
Jason Samscf57dec2011-07-25 12:58:37 -0700102typedef int32_t ssize_t;
103
Jason Samsa00e6d82011-08-08 14:31:25 -0700104/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700105 * \brief Opaque handle to a Renderscript element.
Jason Samsa00e6d82011-08-08 14:31:25 -0700106 *
107 * See: android.renderscript.Element
108 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700109typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element;
Jason Samsa00e6d82011-08-08 14:31:25 -0700110/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700111 * \brief Opaque handle to a Renderscript type.
Jason Samsa00e6d82011-08-08 14:31:25 -0700112 *
113 * See: android.renderscript.Type
114 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700115typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type;
Jason Samsa00e6d82011-08-08 14:31:25 -0700116/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700117 * \brief Opaque handle to a Renderscript allocation.
Jason Samsa00e6d82011-08-08 14:31:25 -0700118 *
119 * See: android.renderscript.Allocation
120 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700121typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation;
Jason Samsa00e6d82011-08-08 14:31:25 -0700122/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700123 * \brief Opaque handle to a Renderscript sampler object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700124 *
125 * See: android.renderscript.Sampler
126 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700127typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler;
Jason Samsa00e6d82011-08-08 14:31:25 -0700128/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700129 * \brief Opaque handle to a Renderscript script object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700130 *
131 * See: android.renderscript.ScriptC
132 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700133typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script;
Jason Samsa00e6d82011-08-08 14:31:25 -0700134/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700135 * \brief Opaque handle to a Renderscript mesh object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700136 *
137 * See: android.renderscript.Mesh
138 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700139typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh;
Jason Samsa00e6d82011-08-08 14:31:25 -0700140/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700141 * \brief Opaque handle to a Renderscript ProgramFragment object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700142 *
143 * See: android.renderscript.ProgramFragment
144 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700145typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment;
Jason Samsa00e6d82011-08-08 14:31:25 -0700146/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700147 * \brief Opaque handle to a Renderscript ProgramVertex object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700148 *
149 * See: android.renderscript.ProgramVertex
150 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700151typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex;
Jason Samsa00e6d82011-08-08 14:31:25 -0700152/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700153 * \brief Opaque handle to a Renderscript ProgramRaster object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700154 *
Stephen Hines46e5a032011-08-26 19:03:16 -0700155 * See: android.renderscript.ProgramRaster
Jason Samsa00e6d82011-08-08 14:31:25 -0700156 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700157typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster;
Jason Samsa00e6d82011-08-08 14:31:25 -0700158/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700159 * \brief Opaque handle to a Renderscript ProgramStore object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700160 *
161 * See: android.renderscript.ProgramStore
162 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700163typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store;
Jason Samsa00e6d82011-08-08 14:31:25 -0700164/**
Stephen Hines46e5a032011-08-26 19:03:16 -0700165 * \brief Opaque handle to a Renderscript font object.
Jason Samsa00e6d82011-08-08 14:31:25 -0700166 *
167 * See: android.renderscript.Font
168 */
Jason Sams02f62aa2010-08-16 12:41:48 -0700169typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font;
170
Jason Samsa00e6d82011-08-08 14:31:25 -0700171/**
172 * Vector version of the basic float type.
Stephen Hines46e5a032011-08-26 19:03:16 -0700173 * Provides two float fields packed into a single 64 bit field with 64 bit
Jason Samsa00e6d82011-08-08 14:31:25 -0700174 * alignment.
175 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700176typedef float float2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700177/**
178 * Vector version of the basic float type. Provides three float fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700179 * into a single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700180 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700181typedef float float3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700182/**
183 * Vector version of the basic float type.
Stephen Hines46e5a032011-08-26 19:03:16 -0700184 * Provides four float fields packed into a single 128 bit field with 128 bit
Jason Samsa00e6d82011-08-08 14:31:25 -0700185 * alignment.
186 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700187typedef float float4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700188
Jason Samsa00e6d82011-08-08 14:31:25 -0700189/**
190 * Vector version of the basic double type. Provides two double fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700191 * into a single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700192 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700193typedef double double2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700194/**
195 * Vector version of the basic double type. Provides three double fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700196 * into a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700197 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700198typedef double double3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700199/**
200 * Vector version of the basic double type. Provides four double fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700201 * into a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700202 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700203typedef double double4 __attribute__((ext_vector_type(4)));
204
Jason Samsa00e6d82011-08-08 14:31:25 -0700205/**
206 * Vector version of the basic uchar type. Provides two uchar fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700207 * into a single 16 bit field with 16 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700208 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700209typedef uchar uchar2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700210/**
211 * Vector version of the basic uchar type. Provides three uchar fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700212 * into a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700213 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700214typedef uchar uchar3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700215/**
216 * Vector version of the basic uchar type. Provides four uchar fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700217 * into a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700218 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700219typedef uchar uchar4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700220
Jason Samsa00e6d82011-08-08 14:31:25 -0700221/**
222 * Vector version of the basic ushort type. Provides two ushort fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700223 * into a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700224 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700225typedef ushort ushort2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700226/**
227 * Vector version of the basic ushort type. Provides three ushort fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700228 * into a single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700229 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700230typedef ushort ushort3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700231/**
232 * Vector version of the basic ushort type. Provides four ushort fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700233 * into a single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700234 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700235typedef ushort ushort4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700236
Jason Samsa00e6d82011-08-08 14:31:25 -0700237/**
238 * Vector version of the basic uint type. Provides two uint fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700239 * single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700240 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700241typedef uint uint2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700242/**
243 * Vector version of the basic uint type. Provides three uint fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700244 * a single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700245 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700246typedef uint uint3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700247/**
248 * Vector version of the basic uint type. Provides four uint fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700249 * a single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700250 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700251typedef uint uint4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700252
Jason Samsa00e6d82011-08-08 14:31:25 -0700253/**
254 * Vector version of the basic ulong type. Provides two ulong fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700255 * a single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700256 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700257typedef ulong ulong2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700258/**
259 * Vector version of the basic ulong type. Provides three ulong fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700260 * into a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700261 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700262typedef ulong ulong3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700263/**
264 * Vector version of the basic ulong type. Provides four ulong fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700265 * into a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700266 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700267typedef ulong ulong4 __attribute__((ext_vector_type(4)));
268
Jason Samsa00e6d82011-08-08 14:31:25 -0700269/**
270 * Vector version of the basic char type. Provides two char fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700271 * single 16 bit field with 16 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700272 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700273typedef char char2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700274/**
275 * Vector version of the basic char type. Provides three char fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700276 * a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700277 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700278typedef char char3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700279/**
280 * Vector version of the basic char type. Provides four char fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700281 * a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700282 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700283typedef char char4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700284
Jason Samsa00e6d82011-08-08 14:31:25 -0700285/**
286 * Vector version of the basic short type. Provides two short fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700287 * a single 32 bit field with 32 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700288 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700289typedef short short2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700290/**
291 * Vector version of the basic short type. Provides three short fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700292 * into a single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700293 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700294typedef short short3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700295/**
296 * Vector version of the basic short type. Provides four short fields packed
Stephen Hines46e5a032011-08-26 19:03:16 -0700297 * into a single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700298 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700299typedef short short4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700300
Jason Samsa00e6d82011-08-08 14:31:25 -0700301/**
302 * Vector version of the basic int type. Provides two int fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700303 * single 64 bit field with 64 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700304 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700305typedef int int2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700306/**
307 * Vector version of the basic int type. Provides three int fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700308 * single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700309 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700310typedef int int3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700311/**
312 * Vector version of the basic int type. Provides two four fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700313 * single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700314 */
Jason Sams33bcfa22010-03-16 15:35:57 -0700315typedef int int4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700316
Jason Samsa00e6d82011-08-08 14:31:25 -0700317/**
318 * Vector version of the basic long type. Provides two long fields packed into a
Stephen Hines46e5a032011-08-26 19:03:16 -0700319 * single 128 bit field with 128 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700320 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700321typedef long long2 __attribute__((ext_vector_type(2)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700322/**
323 * Vector version of the basic long type. Provides three long fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700324 * a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700325 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700326typedef long long3 __attribute__((ext_vector_type(3)));
Jason Samsa00e6d82011-08-08 14:31:25 -0700327/**
328 * Vector version of the basic long type. Provides four long fields packed into
Stephen Hines46e5a032011-08-26 19:03:16 -0700329 * a single 256 bit field with 256 bit alignment.
Jason Samsa00e6d82011-08-08 14:31:25 -0700330 */
Jason Sams6cc888e2011-04-22 17:05:25 -0700331typedef long long4 __attribute__((ext_vector_type(4)));
Jason Sams33bcfa22010-03-16 15:35:57 -0700332
Jason Samsa00e6d82011-08-08 14:31:25 -0700333/**
334 * \brief 4x4 float matrix
335 *
336 * Native holder for RS matrix. Elements are stored in the array at the
337 * location [row*4 + col]
338 */
Alex Sakhartchouka9191122010-08-11 10:04:21 -0700339typedef struct {
Jason Samsd79b2e92010-05-19 17:22:57 -0700340 float m[16];
341} rs_matrix4x4;
Jason Samsa00e6d82011-08-08 14:31:25 -0700342/**
343 * \brief 3x3 float matrix
344 *
345 * Native holder for RS matrix. Elements are stored in the array at the
346 * location [row*3 + col]
347 */
Alex Sakhartchouka9191122010-08-11 10:04:21 -0700348typedef struct {
Jason Samsfae3f6b2010-06-24 13:54:11 -0700349 float m[9];
350} rs_matrix3x3;
Jason Samsa00e6d82011-08-08 14:31:25 -0700351/**
352 * \brief 2x2 float matrix
353 *
354 * Native holder for RS matrix. Elements are stored in the array at the
355 * location [row*2 + col]
356 */
Alex Sakhartchouka9191122010-08-11 10:04:21 -0700357typedef struct {
Jason Samsfae3f6b2010-06-24 13:54:11 -0700358 float m[4];
359} rs_matrix2x2;
360
Jason Samsa00e6d82011-08-08 14:31:25 -0700361/**
362 * quaternion type for use with the quaternion functions
363 */
Alex Sakhartchouk0de94442010-08-11 14:41:28 -0700364typedef float4 rs_quaternion;
Jason Samsfae3f6b2010-06-24 13:54:11 -0700365
Jason Sams020bb7b2010-06-17 15:55:00 -0700366#define RS_PACKED __attribute__((packed, aligned(4)))
Jason Samscf57dec2011-07-25 12:58:37 -0700367#define NULL ((const void *)0)
368
Alex Sakhartchoukf6576d92011-09-28 15:23:18 -0700369#if (defined(RS_VERSION) && (RS_VERSION >= 14))
Jason Samsa00e6d82011-08-08 14:31:25 -0700370
371/**
372 * \brief Enum for selecting cube map faces
Jason Samsa00e6d82011-08-08 14:31:25 -0700373 */
Alex Sakhartchouk304b1f52011-06-14 11:13:19 -0700374typedef enum {
375 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
376 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
377 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2,
378 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3,
379 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
380 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
381} rs_allocation_cubemap_face;
382
Jason Samsa00e6d82011-08-08 14:31:25 -0700383/**
384 * \brief Bitfield to specify the usage types for an allocation.
385 *
386 * These values are ORed together to specify which usages or memory spaces are
387 * relevant to an allocation or an operation on an allocation.
388 */
Alex Sakhartchouk304b1f52011-06-14 11:13:19 -0700389typedef enum {
390 RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
391 RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
392 RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
393 RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
394 RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010
395} rs_allocation_usage_type;
396
Alex Sakhartchoukf6576d92011-09-28 15:23:18 -0700397#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
398
Shih-wei Liao708e04f2010-10-07 18:21:32 -0700399#endif