Jason Sams | 573fa62 | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 1 | /* |
| 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 Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 18 | * |
| 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 Liao | 708e04f | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 41 | #ifndef __RS_TYPES_RSH__ |
| 42 | #define __RS_TYPES_RSH__ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 43 | |
Shih-wei Liao | 1ad9612 | 2011-01-19 02:18:45 -0800 | [diff] [blame] | 44 | #define M_PI 3.14159265358979323846264338327950288f /* pi */ |
| 45 | |
Shih-wei Liao | cbcced2 | 2011-01-19 12:17:54 -0800 | [diff] [blame] | 46 | #include "stdbool.h" |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 47 | /** |
| 48 | * 8 bit integer type |
| 49 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 50 | typedef char int8_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 51 | /** |
| 52 | * 16 bit integer type |
| 53 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 54 | typedef short int16_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 55 | /** |
| 56 | * 32 bit integer type |
| 57 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 58 | typedef int int32_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 59 | /** |
| 60 | * 64 bit integer type |
| 61 | */ |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 62 | typedef long long int64_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 63 | /** |
| 64 | * 8 bit unsigned integer type |
| 65 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 66 | typedef unsigned char uint8_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 67 | /** |
| 68 | * 16 bit unsigned integer type |
| 69 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 70 | typedef unsigned short uint16_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 71 | /** |
| 72 | * 32 bit unsigned integer type |
| 73 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 74 | typedef unsigned int uint32_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 75 | /** |
| 76 | * 64 bit unsigned integer type |
| 77 | */ |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 78 | typedef unsigned long long uint64_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 79 | /** |
| 80 | * 8 bit unsigned integer type |
| 81 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 82 | typedef uint8_t uchar; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 83 | /** |
| 84 | * 16 bit unsigned integer type |
| 85 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 86 | typedef uint16_t ushort; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 87 | /** |
| 88 | * 32 bit unsigned integer type |
| 89 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 90 | typedef uint32_t uint; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 91 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 92 | * Typedef for unsigned long (use for 64-bit unsigned integers) |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 93 | */ |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 94 | typedef uint64_t ulong; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 95 | /** |
| 96 | * Typedef for unsigned int |
| 97 | */ |
Jason Sams | cf57dec | 2011-07-25 12:58:37 -0700 | [diff] [blame] | 98 | typedef uint32_t size_t; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 99 | /** |
| 100 | * Typedef for int (use for 32-bit integers) |
| 101 | */ |
Jason Sams | cf57dec | 2011-07-25 12:58:37 -0700 | [diff] [blame] | 102 | typedef int32_t ssize_t; |
| 103 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 104 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 105 | * \brief Opaque handle to a Renderscript element. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 106 | * |
| 107 | * See: android.renderscript.Element |
| 108 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 109 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 110 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 111 | * \brief Opaque handle to a Renderscript type. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 112 | * |
| 113 | * See: android.renderscript.Type |
| 114 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 115 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 116 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 117 | * \brief Opaque handle to a Renderscript allocation. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 118 | * |
| 119 | * See: android.renderscript.Allocation |
| 120 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 121 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 122 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 123 | * \brief Opaque handle to a Renderscript sampler object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 124 | * |
| 125 | * See: android.renderscript.Sampler |
| 126 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 127 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_sampler; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 128 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 129 | * \brief Opaque handle to a Renderscript script object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 130 | * |
| 131 | * See: android.renderscript.ScriptC |
| 132 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 133 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_script; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 134 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 135 | * \brief Opaque handle to a Renderscript mesh object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 136 | * |
| 137 | * See: android.renderscript.Mesh |
| 138 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 139 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 140 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 141 | * \brief Opaque handle to a Renderscript ProgramFragment object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 142 | * |
| 143 | * See: android.renderscript.ProgramFragment |
| 144 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 145 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 146 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 147 | * \brief Opaque handle to a Renderscript ProgramVertex object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 148 | * |
| 149 | * See: android.renderscript.ProgramVertex |
| 150 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 151 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 152 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 153 | * \brief Opaque handle to a Renderscript ProgramRaster object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 154 | * |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 155 | * See: android.renderscript.ProgramRaster |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 156 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 157 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 158 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 159 | * \brief Opaque handle to a Renderscript ProgramStore object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 160 | * |
| 161 | * See: android.renderscript.ProgramStore |
| 162 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 163 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 164 | /** |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 165 | * \brief Opaque handle to a Renderscript font object. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 166 | * |
| 167 | * See: android.renderscript.Font |
| 168 | */ |
Jason Sams | 02f62aa | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 169 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font; |
| 170 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 171 | /** |
| 172 | * Vector version of the basic float type. |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 173 | * Provides two float fields packed into a single 64 bit field with 64 bit |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 174 | * alignment. |
| 175 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 176 | typedef float float2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 177 | /** |
| 178 | * Vector version of the basic float type. Provides three float fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 179 | * into a single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 180 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 181 | typedef float float3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 182 | /** |
| 183 | * Vector version of the basic float type. |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 184 | * Provides four float fields packed into a single 128 bit field with 128 bit |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 185 | * alignment. |
| 186 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 187 | typedef float float4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 188 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 189 | /** |
| 190 | * Vector version of the basic double type. Provides two double fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 191 | * into a single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 192 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 193 | typedef double double2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 194 | /** |
| 195 | * Vector version of the basic double type. Provides three double fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 196 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 197 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 198 | typedef double double3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 199 | /** |
| 200 | * Vector version of the basic double type. Provides four double fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 201 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 202 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 203 | typedef double double4 __attribute__((ext_vector_type(4))); |
| 204 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 205 | /** |
| 206 | * Vector version of the basic uchar type. Provides two uchar fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 207 | * into a single 16 bit field with 16 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 208 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 209 | typedef uchar uchar2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 210 | /** |
| 211 | * Vector version of the basic uchar type. Provides three uchar fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 212 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 213 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 214 | typedef uchar uchar3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 215 | /** |
| 216 | * Vector version of the basic uchar type. Provides four uchar fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 217 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 218 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 219 | typedef uchar uchar4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 220 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 221 | /** |
| 222 | * Vector version of the basic ushort type. Provides two ushort fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 223 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 224 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 225 | typedef ushort ushort2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 226 | /** |
| 227 | * Vector version of the basic ushort type. Provides three ushort fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 228 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 229 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 230 | typedef ushort ushort3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 231 | /** |
| 232 | * Vector version of the basic ushort type. Provides four ushort fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 233 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 234 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 235 | typedef ushort ushort4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 236 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 237 | /** |
| 238 | * Vector version of the basic uint type. Provides two uint fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 239 | * single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 240 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 241 | typedef uint uint2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 242 | /** |
| 243 | * Vector version of the basic uint type. Provides three uint fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 244 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 245 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 246 | typedef uint uint3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 247 | /** |
| 248 | * Vector version of the basic uint type. Provides four uint fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 249 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 250 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 251 | typedef uint uint4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 252 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 253 | /** |
| 254 | * Vector version of the basic ulong type. Provides two ulong fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 255 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 256 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 257 | typedef ulong ulong2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 258 | /** |
| 259 | * Vector version of the basic ulong type. Provides three ulong fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 260 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 261 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 262 | typedef ulong ulong3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 263 | /** |
| 264 | * Vector version of the basic ulong type. Provides four ulong fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 265 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 266 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 267 | typedef ulong ulong4 __attribute__((ext_vector_type(4))); |
| 268 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 269 | /** |
| 270 | * Vector version of the basic char type. Provides two char fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 271 | * single 16 bit field with 16 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 272 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 273 | typedef char char2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 274 | /** |
| 275 | * Vector version of the basic char type. Provides three char fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 276 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 277 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 278 | typedef char char3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 279 | /** |
| 280 | * Vector version of the basic char type. Provides four char fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 281 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 282 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 283 | typedef char char4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 284 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 285 | /** |
| 286 | * Vector version of the basic short type. Provides two short fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 287 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 288 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 289 | typedef short short2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 290 | /** |
| 291 | * Vector version of the basic short type. Provides three short fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 292 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 293 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 294 | typedef short short3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 295 | /** |
| 296 | * Vector version of the basic short type. Provides four short fields packed |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 297 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 298 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 299 | typedef short short4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 300 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 301 | /** |
| 302 | * Vector version of the basic int type. Provides two int fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 303 | * single 64 bit field with 64 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 304 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 305 | typedef int int2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 306 | /** |
| 307 | * Vector version of the basic int type. Provides three int fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 308 | * single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 309 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 310 | typedef int int3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 311 | /** |
| 312 | * Vector version of the basic int type. Provides two four fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 313 | * single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 314 | */ |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 315 | typedef int int4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 316 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 317 | /** |
| 318 | * Vector version of the basic long type. Provides two long fields packed into a |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 319 | * single 128 bit field with 128 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 320 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 321 | typedef long long2 __attribute__((ext_vector_type(2))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 322 | /** |
| 323 | * Vector version of the basic long type. Provides three long fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 324 | * a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 325 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 326 | typedef long long3 __attribute__((ext_vector_type(3))); |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 327 | /** |
| 328 | * Vector version of the basic long type. Provides four long fields packed into |
Stephen Hines | 46e5a03 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 329 | * a single 256 bit field with 256 bit alignment. |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 330 | */ |
Jason Sams | 6cc888e | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 331 | typedef long long4 __attribute__((ext_vector_type(4))); |
Jason Sams | 33bcfa2 | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 332 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 333 | /** |
| 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 Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 339 | typedef struct { |
Jason Sams | d79b2e9 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 340 | float m[16]; |
| 341 | } rs_matrix4x4; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 342 | /** |
| 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 Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 348 | typedef struct { |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 349 | float m[9]; |
| 350 | } rs_matrix3x3; |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 351 | /** |
| 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 Sakhartchouk | a919112 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 357 | typedef struct { |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 358 | float m[4]; |
| 359 | } rs_matrix2x2; |
| 360 | |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 361 | /** |
| 362 | * quaternion type for use with the quaternion functions |
| 363 | */ |
Alex Sakhartchouk | 0de9444 | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 364 | typedef float4 rs_quaternion; |
Jason Sams | fae3f6b | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 365 | |
Jason Sams | 020bb7b | 2010-06-17 15:55:00 -0700 | [diff] [blame] | 366 | #define RS_PACKED __attribute__((packed, aligned(4))) |
Jason Sams | cf57dec | 2011-07-25 12:58:37 -0700 | [diff] [blame] | 367 | #define NULL ((const void *)0) |
| 368 | |
Alex Sakhartchouk | f6576d9 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 369 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 370 | |
| 371 | /** |
| 372 | * \brief Enum for selecting cube map faces |
Jason Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 373 | */ |
Alex Sakhartchouk | 304b1f5 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 374 | typedef 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 Sams | a00e6d8 | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 383 | /** |
| 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 Sakhartchouk | 304b1f5 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 389 | typedef 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 Sakhartchouk | f6576d9 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 397 | #endif //defined(RS_VERSION) && (RS_VERSION >= 14) |
| 398 | |
Shih-wei Liao | 708e04f | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 399 | #endif |