Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 1 | /* |
Jason Sams | bc0ca6b | 2013-02-15 18:13:43 -0800 | [diff] [blame] | 2 | * Copyright (C) 2013 The Android Open Source Project |
Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame] | 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 | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 18 | * |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 19 | * Define the standard RenderScript types |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 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 | 9bb32e1 | 2010-10-07 18:21:32 -0700 | [diff] [blame] | 41 | #ifndef __RS_TYPES_RSH__ |
| 42 | #define __RS_TYPES_RSH__ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 43 | |
Rajeev Sharma | 20d5530 | 2012-07-24 17:16:05 -0700 | [diff] [blame] | 44 | /* Constants */ |
| 45 | #define M_E 2.718281828459045235360287471352662498f /* e */ |
| 46 | #define M_LOG2E 1.442695040888963407359924681001892137f /* log_2 e */ |
| 47 | #define M_LOG10E 0.434294481903251827651128918916605082f /* log_10 e */ |
| 48 | #define M_LN2 0.693147180559945309417232121458176568f /* log_e 2 */ |
| 49 | #define M_LN10 2.302585092994045684017991454684364208f /* log_e 10 */ |
| 50 | #define M_PI 3.141592653589793238462643383279502884f /* pi */ |
| 51 | #define M_PI_2 1.570796326794896619231321691639751442f /* pi/2 */ |
| 52 | #define M_PI_4 0.785398163397448309615660845819875721f /* pi/4 */ |
| 53 | #define M_1_PI 0.318309886183790671537767526745028724f /* 1/pi */ |
| 54 | #define M_2_PIl 0.636619772367581343075535053490057448f /* 2/pi */ |
| 55 | #define M_2_SQRTPI 1.128379167095512573896158903121545172f /* 2/sqrt(pi) */ |
| 56 | #define M_SQRT2 1.414213562373095048801688724209698079f /* sqrt(2) */ |
| 57 | #define M_SQRT1_2 0.707106781186547524400844362104849039f /* 1/sqrt(2) */ |
Rajeev Sharma | 7539820 | 2012-07-24 16:36:14 -0700 | [diff] [blame] | 58 | |
Shih-wei Liao | ed2ea27 | 2011-01-19 12:17:54 -0800 | [diff] [blame] | 59 | #include "stdbool.h" |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 60 | /** |
| 61 | * 8 bit integer type |
| 62 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 63 | typedef char int8_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 64 | /** |
| 65 | * 16 bit integer type |
| 66 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 67 | typedef short int16_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 68 | /** |
| 69 | * 32 bit integer type |
| 70 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 71 | typedef int int32_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 72 | /** |
| 73 | * 64 bit integer type |
| 74 | */ |
Jason Sams | d8b8f8a | 2014-08-19 17:53:08 -0700 | [diff] [blame] | 75 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 76 | typedef long int64_t; |
| 77 | #else |
| 78 | typedef long long int64_t; |
| 79 | #endif |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 80 | /** |
| 81 | * 8 bit unsigned integer type |
| 82 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 83 | typedef unsigned char uint8_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 84 | /** |
| 85 | * 16 bit unsigned integer type |
| 86 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 87 | typedef unsigned short uint16_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 88 | /** |
| 89 | * 32 bit unsigned integer type |
| 90 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 91 | typedef unsigned int uint32_t; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 92 | /** |
| 93 | * 64 bit unsigned integer type |
| 94 | */ |
Jason Sams | d8b8f8a | 2014-08-19 17:53:08 -0700 | [diff] [blame] | 95 | #if (defined(RS_VERSION) && (RS_VERSION >= 21)) |
| 96 | typedef unsigned long uint64_t; |
| 97 | #else |
| 98 | typedef unsigned long long uint64_t; |
| 99 | #endif |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 100 | /** |
| 101 | * 8 bit unsigned integer type |
| 102 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 103 | typedef uint8_t uchar; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 104 | /** |
| 105 | * 16 bit unsigned integer type |
| 106 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 107 | typedef uint16_t ushort; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 108 | /** |
| 109 | * 32 bit unsigned integer type |
| 110 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 111 | typedef uint32_t uint; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 112 | /** |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 113 | * Typedef for unsigned long (use for 64-bit unsigned integers) |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 114 | */ |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 115 | typedef uint64_t ulong; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 116 | /** |
Tim Murray | e3af53b | 2014-06-10 09:46:51 -0700 | [diff] [blame] | 117 | * Typedef for size_t |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 118 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 119 | #ifndef __LP64__ |
Tim Murray | e3af53b | 2014-06-10 09:46:51 -0700 | [diff] [blame] | 120 | typedef uint32_t size_t; |
| 121 | typedef int32_t ssize_t; |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 122 | #else |
Tim Murray | e3af53b | 2014-06-10 09:46:51 -0700 | [diff] [blame] | 123 | typedef uint64_t size_t; |
| 124 | typedef int64_t ssize_t; |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 125 | #endif |
| 126 | |
Tim Murray | fa6f90e | 2014-06-12 14:16:10 -0700 | [diff] [blame] | 127 | #ifndef __LP64__ |
Tim Murray | e3af53b | 2014-06-10 09:46:51 -0700 | [diff] [blame] | 128 | #define RS_BASE_OBJ typedef struct { const int* const p; } __attribute__((packed, aligned(4))) |
Tim Murray | fa6f90e | 2014-06-12 14:16:10 -0700 | [diff] [blame] | 129 | #else |
| 130 | #define RS_BASE_OBJ typedef struct { const long* const p; const long* const r; const long* const v1; const long* const v2; } |
| 131 | #endif |
Tim Murray | e3af53b | 2014-06-10 09:46:51 -0700 | [diff] [blame] | 132 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 133 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 134 | * \brief Opaque handle to a RenderScript element. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 135 | * |
| 136 | * See: android.renderscript.Element |
| 137 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 138 | RS_BASE_OBJ rs_element; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 139 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 140 | * \brief Opaque handle to a RenderScript type. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 141 | * |
| 142 | * See: android.renderscript.Type |
| 143 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 144 | RS_BASE_OBJ rs_type; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 145 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 146 | * \brief Opaque handle to a RenderScript allocation. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 147 | * |
| 148 | * See: android.renderscript.Allocation |
| 149 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 150 | RS_BASE_OBJ rs_allocation; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 151 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 152 | * \brief Opaque handle to a RenderScript sampler object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 153 | * |
| 154 | * See: android.renderscript.Sampler |
| 155 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 156 | RS_BASE_OBJ rs_sampler; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 157 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 158 | * \brief Opaque handle to a RenderScript script object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 159 | * |
| 160 | * See: android.renderscript.ScriptC |
| 161 | */ |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 162 | RS_BASE_OBJ rs_script; |
| 163 | |
| 164 | #ifndef __LP64__ |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 165 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 166 | * \brief Opaque handle to a RenderScript mesh object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 167 | * |
| 168 | * See: android.renderscript.Mesh |
| 169 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 170 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 171 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 172 | * \brief Opaque handle to a RenderScript Path object. |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 173 | * |
| 174 | * See: android.renderscript.Path |
| 175 | */ |
| 176 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_path; |
| 177 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 178 | * \brief Opaque handle to a RenderScript ProgramFragment object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 179 | * |
| 180 | * See: android.renderscript.ProgramFragment |
| 181 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 182 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 183 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 184 | * \brief Opaque handle to a RenderScript ProgramVertex object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 185 | * |
| 186 | * See: android.renderscript.ProgramVertex |
| 187 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 188 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 189 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 190 | * \brief Opaque handle to a RenderScript ProgramRaster object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 191 | * |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 192 | * See: android.renderscript.ProgramRaster |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 193 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 194 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 195 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 196 | * \brief Opaque handle to a RenderScript ProgramStore object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 197 | * |
| 198 | * See: android.renderscript.ProgramStore |
| 199 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 200 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 201 | /** |
Stephen Hines | e227f9a | 2013-05-29 14:48:19 -0700 | [diff] [blame] | 202 | * \brief Opaque handle to a RenderScript font object. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 203 | * |
| 204 | * See: android.renderscript.Font |
| 205 | */ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 206 | typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font; |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 207 | #endif // __LP64__ |
Jason Sams | c093685 | 2010-08-16 12:41:48 -0700 | [diff] [blame] | 208 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 209 | /** |
| 210 | * Vector version of the basic float type. |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 211 | * Provides two float fields packed into a single 64 bit field with 64 bit |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 212 | * alignment. |
| 213 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 214 | typedef float float2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 215 | /** |
| 216 | * Vector version of the basic float type. Provides three float fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 217 | * into a single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 218 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 219 | typedef float float3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 220 | /** |
| 221 | * Vector version of the basic float type. |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 222 | * Provides four float fields packed into a single 128 bit field with 128 bit |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 223 | * alignment. |
| 224 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 225 | typedef float float4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 226 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 227 | /** |
| 228 | * Vector version of the basic double type. Provides two double fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 229 | * into a single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 230 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 231 | typedef double double2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 232 | /** |
| 233 | * Vector version of the basic double type. Provides three double fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 234 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 235 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 236 | typedef double double3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 237 | /** |
| 238 | * Vector version of the basic double type. Provides four double fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 239 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 240 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 241 | typedef double double4 __attribute__((ext_vector_type(4))); |
| 242 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 243 | /** |
| 244 | * Vector version of the basic uchar type. Provides two uchar fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 245 | * into a single 16 bit field with 16 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 246 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 247 | typedef uchar uchar2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 248 | /** |
| 249 | * Vector version of the basic uchar type. Provides three uchar fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 250 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 251 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 252 | typedef uchar uchar3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 253 | /** |
| 254 | * Vector version of the basic uchar type. Provides four uchar fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 255 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 256 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 257 | typedef uchar uchar4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 258 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 259 | /** |
| 260 | * Vector version of the basic ushort type. Provides two ushort fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 261 | * into a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 262 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 263 | typedef ushort ushort2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 264 | /** |
| 265 | * Vector version of the basic ushort type. Provides three ushort fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 266 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 267 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 268 | typedef ushort ushort3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 269 | /** |
| 270 | * Vector version of the basic ushort type. Provides four ushort fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 271 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 272 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 273 | typedef ushort ushort4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 274 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 275 | /** |
| 276 | * Vector version of the basic uint type. Provides two uint fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 277 | * single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 278 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 279 | typedef uint uint2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 280 | /** |
| 281 | * Vector version of the basic uint type. Provides three uint fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 282 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 283 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 284 | typedef uint uint3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 285 | /** |
| 286 | * Vector version of the basic uint type. Provides four uint fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 287 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 288 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 289 | typedef uint uint4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 290 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 291 | /** |
| 292 | * Vector version of the basic ulong type. Provides two ulong fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 293 | * a single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 294 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 295 | typedef ulong ulong2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 296 | /** |
| 297 | * Vector version of the basic ulong type. Provides three ulong fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 298 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 299 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 300 | typedef ulong ulong3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 301 | /** |
| 302 | * Vector version of the basic ulong type. Provides four ulong fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 303 | * into a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 304 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 305 | typedef ulong ulong4 __attribute__((ext_vector_type(4))); |
| 306 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 307 | /** |
| 308 | * Vector version of the basic char type. Provides two char fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 309 | * single 16 bit field with 16 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 310 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 311 | typedef char char2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 312 | /** |
| 313 | * Vector version of the basic char type. Provides three char fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 314 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 315 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 316 | typedef char char3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 317 | /** |
| 318 | * Vector version of the basic char type. Provides four char fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 319 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 320 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 321 | typedef char char4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 322 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 323 | /** |
| 324 | * Vector version of the basic short type. Provides two short fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 325 | * a single 32 bit field with 32 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 326 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 327 | typedef short short2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 328 | /** |
| 329 | * Vector version of the basic short type. Provides three short fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 330 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 331 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 332 | typedef short short3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 333 | /** |
| 334 | * Vector version of the basic short type. Provides four short fields packed |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 335 | * into a single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 336 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 337 | typedef short short4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 338 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 339 | /** |
| 340 | * Vector version of the basic int type. Provides two int fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 341 | * single 64 bit field with 64 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 342 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 343 | typedef int int2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 344 | /** |
| 345 | * Vector version of the basic int type. Provides three int fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 346 | * single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 347 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 348 | typedef int int3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 349 | /** |
| 350 | * Vector version of the basic int type. Provides two four fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 351 | * single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 352 | */ |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 353 | typedef int int4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 354 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 355 | /** |
| 356 | * Vector version of the basic long type. Provides two long fields packed into a |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 357 | * single 128 bit field with 128 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 358 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 359 | typedef long long2 __attribute__((ext_vector_type(2))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 360 | /** |
| 361 | * Vector version of the basic long type. Provides three long fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 362 | * a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 363 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 364 | typedef long long3 __attribute__((ext_vector_type(3))); |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 365 | /** |
| 366 | * Vector version of the basic long type. Provides four long fields packed into |
Stephen Hines | d5dccb8 | 2011-08-26 19:03:16 -0700 | [diff] [blame] | 367 | * a single 256 bit field with 256 bit alignment. |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 368 | */ |
Jason Sams | 46f2e72 | 2011-04-22 17:05:25 -0700 | [diff] [blame] | 369 | typedef long long4 __attribute__((ext_vector_type(4))); |
Jason Sams | 717e34a | 2010-03-16 15:35:57 -0700 | [diff] [blame] | 370 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 371 | /** |
| 372 | * \brief 4x4 float matrix |
| 373 | * |
| 374 | * Native holder for RS matrix. Elements are stored in the array at the |
| 375 | * location [row*4 + col] |
| 376 | */ |
Alex Sakhartchouk | 05f1cb4 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 377 | typedef struct { |
Jason Sams | 22fa371 | 2010-05-19 17:22:57 -0700 | [diff] [blame] | 378 | float m[16]; |
| 379 | } rs_matrix4x4; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 380 | /** |
| 381 | * \brief 3x3 float matrix |
| 382 | * |
| 383 | * Native holder for RS matrix. Elements are stored in the array at the |
| 384 | * location [row*3 + col] |
| 385 | */ |
Alex Sakhartchouk | 05f1cb4 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 386 | typedef struct { |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 387 | float m[9]; |
| 388 | } rs_matrix3x3; |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 389 | /** |
| 390 | * \brief 2x2 float matrix |
| 391 | * |
| 392 | * Native holder for RS matrix. Elements are stored in the array at the |
| 393 | * location [row*2 + col] |
| 394 | */ |
Alex Sakhartchouk | 05f1cb4 | 2010-08-11 10:04:21 -0700 | [diff] [blame] | 395 | typedef struct { |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 396 | float m[4]; |
| 397 | } rs_matrix2x2; |
| 398 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 399 | /** |
| 400 | * quaternion type for use with the quaternion functions |
| 401 | */ |
Alex Sakhartchouk | 0bd010a | 2010-08-11 14:41:28 -0700 | [diff] [blame] | 402 | typedef float4 rs_quaternion; |
Jason Sams | 7fe6bce | 2010-06-24 13:54:11 -0700 | [diff] [blame] | 403 | |
Jason Sams | 97589cb | 2010-06-17 15:55:00 -0700 | [diff] [blame] | 404 | #define RS_PACKED __attribute__((packed, aligned(4))) |
Stephen Hines | 6a057c3 | 2011-12-06 16:47:32 -0800 | [diff] [blame] | 405 | #define NULL ((void *)0) |
Jason Sams | c500e74 | 2011-07-25 12:58:37 -0700 | [diff] [blame] | 406 | |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 407 | #if (defined(RS_VERSION) && (RS_VERSION >= 14)) |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 408 | |
| 409 | /** |
| 410 | * \brief Enum for selecting cube map faces |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 411 | */ |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 412 | typedef enum { |
| 413 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0, |
| 414 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1, |
| 415 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2, |
| 416 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3, |
| 417 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4, |
| 418 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5 |
| 419 | } rs_allocation_cubemap_face; |
| 420 | |
Jason Sams | 9df3b2b | 2011-08-08 14:31:25 -0700 | [diff] [blame] | 421 | /** |
| 422 | * \brief Bitfield to specify the usage types for an allocation. |
| 423 | * |
| 424 | * These values are ORed together to specify which usages or memory spaces are |
| 425 | * relevant to an allocation or an operation on an allocation. |
| 426 | */ |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 427 | typedef enum { |
| 428 | RS_ALLOCATION_USAGE_SCRIPT = 0x0001, |
| 429 | RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, |
| 430 | RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, |
| 431 | RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, |
| 432 | RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010 |
| 433 | } rs_allocation_usage_type; |
| 434 | |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 435 | #endif //defined(RS_VERSION) && (RS_VERSION >= 14) |
| 436 | |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 437 | // New API's |
Alex Sakhartchouk | 3c0c606 | 2012-03-22 16:59:38 -0700 | [diff] [blame] | 438 | #if (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 439 | |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 440 | #ifndef __LP64__ |
Alex Sakhartchouk | 8d0f59e | 2011-12-16 14:15:07 -0800 | [diff] [blame] | 441 | /** |
| 442 | * Describes the way mesh vertex data is interpreted when rendering |
| 443 | * |
| 444 | **/ |
Alex Sakhartchouk | 253325d | 2011-12-15 09:56:10 -0800 | [diff] [blame] | 445 | typedef enum { |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 446 | /** |
| 447 | * Vertex data will be rendered as a series of points |
| 448 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 449 | RS_PRIMITIVE_POINT = 0, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 450 | /** |
| 451 | * Vertex pairs will be rendered as lines |
| 452 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 453 | RS_PRIMITIVE_LINE = 1, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 454 | /** |
| 455 | * Vertex data will be rendered as a connected line strip |
| 456 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 457 | RS_PRIMITIVE_LINE_STRIP = 2, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 458 | /** |
| 459 | * Vertices will be rendered as individual triangles |
| 460 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 461 | RS_PRIMITIVE_TRIANGLE = 3, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 462 | /** |
| 463 | * Vertices will be rendered as a connected triangle strip |
| 464 | * defined by the first three vertices with each additional |
| 465 | * triangle defined by a new vertex |
| 466 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 467 | RS_PRIMITIVE_TRIANGLE_STRIP = 4, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 468 | /** |
| 469 | * Vertices will be rendered as a sequence of triangles that all |
| 470 | * share first vertex as the origin |
| 471 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 472 | RS_PRIMITIVE_TRIANGLE_FAN = 5, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 473 | |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 474 | /** |
| 475 | * Invalid primitive |
| 476 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 477 | RS_PRIMITIVE_INVALID = 100, |
Alex Sakhartchouk | 253325d | 2011-12-15 09:56:10 -0800 | [diff] [blame] | 478 | } rs_primitive; |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 479 | #endif // __LP64__ |
Alex Sakhartchouk | 253325d | 2011-12-15 09:56:10 -0800 | [diff] [blame] | 480 | |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 481 | /** |
| 482 | * \brief Enumeration for possible element data types |
| 483 | * |
| 484 | * DataType represents the basic type information for a basic element. The |
| 485 | * naming convention follows. For numeric types it is FLOAT, |
| 486 | * SIGNED, or UNSIGNED followed by the _BITS where BITS is the |
| 487 | * size of the data. BOOLEAN is a true / false (1,0) |
| 488 | * represented in an 8 bit container. The UNSIGNED variants |
| 489 | * with multiple bit definitions are for packed graphical data |
| 490 | * formats and represent vectors with per vector member sizes |
| 491 | * which are treated as a single unit for packing and alignment |
| 492 | * purposes. |
| 493 | * |
| 494 | * MATRIX the three matrix types contain FLOAT_32 elements and are treated |
| 495 | * as 32 bits for alignment purposes. |
| 496 | * |
| 497 | * RS_* objects. 32 bit opaque handles. |
| 498 | */ |
| 499 | typedef enum { |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 500 | RS_TYPE_NONE = 0, |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 501 | RS_TYPE_FLOAT_32 = 2, |
| 502 | RS_TYPE_FLOAT_64 = 3, |
| 503 | RS_TYPE_SIGNED_8 = 4, |
| 504 | RS_TYPE_SIGNED_16 = 5, |
| 505 | RS_TYPE_SIGNED_32 = 6, |
| 506 | RS_TYPE_SIGNED_64 = 7, |
| 507 | RS_TYPE_UNSIGNED_8 = 8, |
| 508 | RS_TYPE_UNSIGNED_16 = 9, |
| 509 | RS_TYPE_UNSIGNED_32 = 10, |
| 510 | RS_TYPE_UNSIGNED_64 = 11, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 511 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 512 | RS_TYPE_BOOLEAN = 12, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 513 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 514 | RS_TYPE_UNSIGNED_5_6_5 = 13, |
| 515 | RS_TYPE_UNSIGNED_5_5_5_1 = 14, |
| 516 | RS_TYPE_UNSIGNED_4_4_4_4 = 15, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 517 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 518 | RS_TYPE_MATRIX_4X4 = 16, |
| 519 | RS_TYPE_MATRIX_3X3 = 17, |
| 520 | RS_TYPE_MATRIX_2X2 = 18, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 521 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 522 | RS_TYPE_ELEMENT = 1000, |
| 523 | RS_TYPE_TYPE = 1001, |
| 524 | RS_TYPE_ALLOCATION = 1002, |
| 525 | RS_TYPE_SAMPLER = 1003, |
| 526 | RS_TYPE_SCRIPT = 1004, |
| 527 | RS_TYPE_MESH = 1005, |
| 528 | RS_TYPE_PROGRAM_FRAGMENT = 1006, |
| 529 | RS_TYPE_PROGRAM_VERTEX = 1007, |
| 530 | RS_TYPE_PROGRAM_RASTER = 1008, |
| 531 | RS_TYPE_PROGRAM_STORE = 1009, |
Stephen Hines | ae8b795 | 2012-04-11 18:09:54 -0700 | [diff] [blame] | 532 | RS_TYPE_FONT = 1010, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 533 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 534 | RS_TYPE_INVALID = 10000, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 535 | } rs_data_type; |
| 536 | |
| 537 | /** |
| 538 | * \brief Enumeration for possible element data kind |
| 539 | * |
| 540 | * The special interpretation of the data if required. This is primarly |
| 541 | * useful for graphical data. USER indicates no special interpretation is |
| 542 | * expected. PIXEL is used in conjunction with the standard data types for |
| 543 | * representing texture formats. |
| 544 | */ |
| 545 | typedef enum { |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 546 | RS_KIND_USER = 0, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 547 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 548 | RS_KIND_PIXEL_L = 7, |
| 549 | RS_KIND_PIXEL_A = 8, |
| 550 | RS_KIND_PIXEL_LA = 9, |
| 551 | RS_KIND_PIXEL_RGB = 10, |
| 552 | RS_KIND_PIXEL_RGBA = 11, |
| 553 | RS_KIND_PIXEL_DEPTH = 12, |
Jason Sams | bc0ca6b | 2013-02-15 18:13:43 -0800 | [diff] [blame] | 554 | RS_KIND_PIXEL_YUV = 13, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 555 | |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 556 | RS_KIND_INVALID = 100, |
Alex Sakhartchouk | b0fa3a6 | 2011-12-16 09:44:26 -0800 | [diff] [blame] | 557 | } rs_data_kind; |
Alex Sakhartchouk | 4325387 | 2011-09-28 15:23:18 -0700 | [diff] [blame] | 558 | |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 559 | #ifndef __LP64__ |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame^] | 560 | /** |
| 561 | * Specifies conditional drawing depending on the comparison of the incoming |
| 562 | * depth to that found in the depth buffer. |
| 563 | * |
| 564 | **/ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 565 | typedef enum { |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 566 | /** |
| 567 | * Always drawn |
| 568 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 569 | RS_DEPTH_FUNC_ALWAYS = 0, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 570 | /** |
| 571 | * Drawn if the incoming depth value is less than that in the |
| 572 | * depth buffer |
| 573 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 574 | RS_DEPTH_FUNC_LESS = 1, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 575 | /** |
| 576 | * Drawn if the incoming depth value is less or equal to that in |
| 577 | * the depth buffer |
| 578 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 579 | RS_DEPTH_FUNC_LEQUAL = 2, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 580 | /** |
| 581 | * Drawn if the incoming depth value is greater than that in the |
| 582 | * depth buffer |
| 583 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 584 | RS_DEPTH_FUNC_GREATER = 3, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 585 | /** |
| 586 | * Drawn if the incoming depth value is greater or equal to that |
| 587 | * in the depth buffer |
| 588 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 589 | RS_DEPTH_FUNC_GEQUAL = 4, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 590 | /** |
| 591 | * Drawn if the incoming depth value is equal to that in the |
| 592 | * depth buffer |
| 593 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 594 | RS_DEPTH_FUNC_EQUAL = 5, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 595 | /** |
| 596 | * Drawn if the incoming depth value is not equal to that in the |
| 597 | * depth buffer |
| 598 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 599 | RS_DEPTH_FUNC_NOTEQUAL = 6, |
Alex Sakhartchouk | 340d15a | 2012-04-16 13:50:40 -0700 | [diff] [blame] | 600 | /** |
| 601 | * Invalid depth function |
| 602 | */ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 603 | RS_DEPTH_FUNC_INVALID = 100, |
| 604 | } rs_depth_func; |
| 605 | |
| 606 | typedef enum { |
| 607 | RS_BLEND_SRC_ZERO = 0, |
| 608 | RS_BLEND_SRC_ONE = 1, |
| 609 | RS_BLEND_SRC_DST_COLOR = 2, |
| 610 | RS_BLEND_SRC_ONE_MINUS_DST_COLOR = 3, |
| 611 | RS_BLEND_SRC_SRC_ALPHA = 4, |
| 612 | RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 5, |
| 613 | RS_BLEND_SRC_DST_ALPHA = 6, |
| 614 | RS_BLEND_SRC_ONE_MINUS_DST_ALPHA = 7, |
| 615 | RS_BLEND_SRC_SRC_ALPHA_SATURATE = 8, |
| 616 | |
| 617 | RS_BLEND_SRC_INVALID = 100, |
| 618 | } rs_blend_src_func; |
| 619 | |
| 620 | typedef enum { |
| 621 | RS_BLEND_DST_ZERO = 0, |
| 622 | RS_BLEND_DST_ONE = 1, |
| 623 | RS_BLEND_DST_SRC_COLOR = 2, |
| 624 | RS_BLEND_DST_ONE_MINUS_SRC_COLOR = 3, |
| 625 | RS_BLEND_DST_SRC_ALPHA = 4, |
| 626 | RS_BLEND_DST_ONE_MINUS_SRC_ALPHA = 5, |
| 627 | RS_BLEND_DST_DST_ALPHA = 6, |
| 628 | RS_BLEND_DST_ONE_MINUS_DST_ALPHA = 7, |
| 629 | |
| 630 | RS_BLEND_DST_INVALID = 100, |
| 631 | } rs_blend_dst_func; |
| 632 | |
| 633 | typedef enum { |
| 634 | RS_CULL_BACK = 0, |
| 635 | RS_CULL_FRONT = 1, |
| 636 | RS_CULL_NONE = 2, |
| 637 | |
| 638 | RS_CULL_INVALID = 100, |
| 639 | } rs_cull_mode; |
Jason Sams | 3ff0fe7 | 2014-05-19 15:06:59 -0700 | [diff] [blame] | 640 | #endif //__LP64__ |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 641 | |
| 642 | typedef enum { |
| 643 | RS_SAMPLER_NEAREST = 0, |
| 644 | RS_SAMPLER_LINEAR = 1, |
| 645 | RS_SAMPLER_LINEAR_MIP_LINEAR = 2, |
| 646 | RS_SAMPLER_WRAP = 3, |
| 647 | RS_SAMPLER_CLAMP = 4, |
| 648 | RS_SAMPLER_LINEAR_MIP_NEAREST = 5, |
Tim Murray | 9e913f4 | 2013-02-15 13:29:24 -0800 | [diff] [blame] | 649 | RS_SAMPLER_MIRRORED_REPEAT = 6, |
Alex Sakhartchouk | 09db907 | 2012-02-29 16:43:24 -0800 | [diff] [blame] | 650 | |
| 651 | RS_SAMPLER_INVALID = 100, |
| 652 | } rs_sampler_value; |
| 653 | |
Alex Sakhartchouk | 3c0c606 | 2012-03-22 16:59:38 -0700 | [diff] [blame] | 654 | #endif // (defined(RS_VERSION) && (RS_VERSION >= 16)) |
| 655 | |
| 656 | #endif // __RS_TYPES_RSH__ |