Jason Sams | bad8074 | 2011-03-16 16:29:28 -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 | bad8074 | 2011-03-16 16:29:28 -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 | #ifndef RENDER_SCRIPT_DEFINES_H |
| 18 | #define RENDER_SCRIPT_DEFINES_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | ////////////////////////////////////////////////////// |
| 28 | // |
| 29 | |
| 30 | typedef void * RsAsyncVoidPtr; |
| 31 | |
| 32 | typedef void * RsAdapter1D; |
| 33 | typedef void * RsAdapter2D; |
| 34 | typedef void * RsAllocation; |
| 35 | typedef void * RsAnimation; |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame] | 36 | typedef void * RsClosure; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 37 | typedef void * RsContext; |
| 38 | typedef void * RsDevice; |
| 39 | typedef void * RsElement; |
| 40 | typedef void * RsFile; |
| 41 | typedef void * RsFont; |
| 42 | typedef void * RsSampler; |
| 43 | typedef void * RsScript; |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 44 | typedef void * RsScriptKernelID; |
Yang Ni | eb9aa67 | 2015-01-27 14:32:25 -0800 | [diff] [blame^] | 45 | typedef void * RsScriptInvokeID; |
Jason Sams | dbe66d6 | 2012-09-17 13:54:41 -0700 | [diff] [blame] | 46 | typedef void * RsScriptFieldID; |
| 47 | typedef void * RsScriptMethodID; |
| 48 | typedef void * RsScriptGroup; |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame] | 49 | typedef void * RsScriptGroup2; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 50 | typedef void * RsMesh; |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 51 | typedef void * RsPath; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 52 | typedef void * RsType; |
| 53 | typedef void * RsObjectBase; |
| 54 | |
| 55 | typedef void * RsProgram; |
| 56 | typedef void * RsProgramVertex; |
| 57 | typedef void * RsProgramFragment; |
| 58 | typedef void * RsProgramStore; |
| 59 | typedef void * RsProgramRaster; |
| 60 | |
Alex Sakhartchouk | 7257c7e | 2011-05-17 12:32:47 -0700 | [diff] [blame] | 61 | typedef void * RsNativeWindow; |
| 62 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 63 | typedef void (* RsBitmapCallback_t)(void *); |
| 64 | |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 65 | typedef struct { |
| 66 | float m[16]; |
| 67 | } rs_matrix4x4; |
| 68 | |
| 69 | typedef struct { |
| 70 | float m[9]; |
| 71 | } rs_matrix3x3; |
| 72 | |
| 73 | typedef struct { |
| 74 | float m[4]; |
| 75 | } rs_matrix2x2; |
| 76 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 77 | enum RsDeviceParam { |
| 78 | RS_DEVICE_PARAM_FORCE_SOFTWARE_GL, |
| 79 | RS_DEVICE_PARAM_COUNT |
| 80 | }; |
| 81 | |
Jason Sams | 14982c8 | 2013-02-22 18:17:05 -0800 | [diff] [blame] | 82 | enum RsContextType { |
| 83 | RS_CONTEXT_TYPE_NORMAL, |
| 84 | RS_CONTEXT_TYPE_DEBUG, |
| 85 | RS_CONTEXT_TYPE_PROFILE |
| 86 | }; |
| 87 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 88 | |
| 89 | enum RsAllocationUsageType { |
| 90 | RS_ALLOCATION_USAGE_SCRIPT = 0x0001, |
| 91 | RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, |
| 92 | RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, |
| 93 | RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 94 | RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010, |
Jason Sams | 3522f40 | 2012-03-23 11:47:26 -0700 | [diff] [blame] | 95 | RS_ALLOCATION_USAGE_IO_INPUT = 0x0020, |
| 96 | RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040, |
Tim Murray | 9e2bda5 | 2012-12-18 12:05:46 -0800 | [diff] [blame] | 97 | RS_ALLOCATION_USAGE_SHARED = 0x0080, |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 98 | |
Jason Sams | 41e373d | 2012-01-13 14:01:20 -0800 | [diff] [blame] | 99 | RS_ALLOCATION_USAGE_ALL = 0x00FF |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | enum RsAllocationMipmapControl { |
| 103 | RS_ALLOCATION_MIPMAP_NONE = 0, |
| 104 | RS_ALLOCATION_MIPMAP_FULL = 1, |
| 105 | RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2 |
| 106 | }; |
| 107 | |
| 108 | enum RsAllocationCubemapFace { |
Alex Sakhartchouk | 74a8279 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 109 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0, |
| 110 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1, |
| 111 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2, |
| 112 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3, |
| 113 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4, |
| 114 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5 |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | enum RsDataType { |
| 118 | RS_TYPE_NONE, |
| 119 | RS_TYPE_FLOAT_16, |
| 120 | RS_TYPE_FLOAT_32, |
| 121 | RS_TYPE_FLOAT_64, |
| 122 | RS_TYPE_SIGNED_8, |
| 123 | RS_TYPE_SIGNED_16, |
| 124 | RS_TYPE_SIGNED_32, |
| 125 | RS_TYPE_SIGNED_64, |
| 126 | RS_TYPE_UNSIGNED_8, |
| 127 | RS_TYPE_UNSIGNED_16, |
| 128 | RS_TYPE_UNSIGNED_32, |
| 129 | RS_TYPE_UNSIGNED_64, |
| 130 | |
| 131 | RS_TYPE_BOOLEAN, |
| 132 | |
| 133 | RS_TYPE_UNSIGNED_5_6_5, |
| 134 | RS_TYPE_UNSIGNED_5_5_5_1, |
| 135 | RS_TYPE_UNSIGNED_4_4_4_4, |
| 136 | |
| 137 | RS_TYPE_MATRIX_4X4, |
| 138 | RS_TYPE_MATRIX_3X3, |
| 139 | RS_TYPE_MATRIX_2X2, |
| 140 | |
| 141 | RS_TYPE_ELEMENT = 1000, |
| 142 | RS_TYPE_TYPE, |
| 143 | RS_TYPE_ALLOCATION, |
| 144 | RS_TYPE_SAMPLER, |
| 145 | RS_TYPE_SCRIPT, |
| 146 | RS_TYPE_MESH, |
| 147 | RS_TYPE_PROGRAM_FRAGMENT, |
| 148 | RS_TYPE_PROGRAM_VERTEX, |
| 149 | RS_TYPE_PROGRAM_RASTER, |
| 150 | RS_TYPE_PROGRAM_STORE, |
Stephen Hines | ae8b795 | 2012-04-11 18:09:54 -0700 | [diff] [blame] | 151 | RS_TYPE_FONT, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 152 | |
| 153 | RS_TYPE_INVALID = 10000, |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 154 | }; |
| 155 | |
| 156 | enum RsDataKind { |
| 157 | RS_KIND_USER, |
| 158 | |
| 159 | RS_KIND_PIXEL_L = 7, |
| 160 | RS_KIND_PIXEL_A, |
| 161 | RS_KIND_PIXEL_LA, |
| 162 | RS_KIND_PIXEL_RGB, |
| 163 | RS_KIND_PIXEL_RGBA, |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 164 | RS_KIND_PIXEL_DEPTH, |
Jason Sams | bc0ca6b | 2013-02-15 18:13:43 -0800 | [diff] [blame] | 165 | RS_KIND_PIXEL_YUV, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 166 | |
| 167 | RS_KIND_INVALID = 100, |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | enum RsSamplerParam { |
| 171 | RS_SAMPLER_MIN_FILTER, |
| 172 | RS_SAMPLER_MAG_FILTER, |
| 173 | RS_SAMPLER_WRAP_S, |
| 174 | RS_SAMPLER_WRAP_T, |
| 175 | RS_SAMPLER_WRAP_R, |
| 176 | RS_SAMPLER_ANISO |
| 177 | }; |
| 178 | |
| 179 | enum RsSamplerValue { |
| 180 | RS_SAMPLER_NEAREST, |
| 181 | RS_SAMPLER_LINEAR, |
| 182 | RS_SAMPLER_LINEAR_MIP_LINEAR, |
| 183 | RS_SAMPLER_WRAP, |
| 184 | RS_SAMPLER_CLAMP, |
| 185 | RS_SAMPLER_LINEAR_MIP_NEAREST, |
Tim Murray | 9e913f4 | 2013-02-15 13:29:24 -0800 | [diff] [blame] | 186 | RS_SAMPLER_MIRRORED_REPEAT, |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 187 | |
| 188 | RS_SAMPLER_INVALID = 100, |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 189 | }; |
| 190 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 191 | enum RsDimension { |
| 192 | RS_DIMENSION_X, |
| 193 | RS_DIMENSION_Y, |
| 194 | RS_DIMENSION_Z, |
| 195 | RS_DIMENSION_LOD, |
| 196 | RS_DIMENSION_FACE, |
| 197 | |
| 198 | RS_DIMENSION_ARRAY_0 = 100, |
| 199 | RS_DIMENSION_ARRAY_1, |
| 200 | RS_DIMENSION_ARRAY_2, |
| 201 | RS_DIMENSION_ARRAY_3, |
| 202 | RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3 |
| 203 | }; |
| 204 | |
Jason Sams | 9e0afb5 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 205 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 206 | enum RsError { |
| 207 | RS_ERROR_NONE = 0, |
| 208 | RS_ERROR_BAD_SHADER = 1, |
| 209 | RS_ERROR_BAD_SCRIPT = 2, |
| 210 | RS_ERROR_BAD_VALUE = 3, |
| 211 | RS_ERROR_OUT_OF_MEMORY = 4, |
| 212 | RS_ERROR_DRIVER = 5, |
| 213 | |
Stephen Hines | cca3d6c | 2013-04-15 01:06:39 -0700 | [diff] [blame] | 214 | // Errors that only occur in the debug context. |
| 215 | RS_ERROR_FATAL_DEBUG = 0x0800, |
| 216 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 217 | RS_ERROR_FATAL_UNKNOWN = 0x1000, |
| 218 | RS_ERROR_FATAL_DRIVER = 0x1001, |
| 219 | RS_ERROR_FATAL_PROGRAM_LINK = 0x1002 |
| 220 | }; |
| 221 | |
Stephen Hines | f598811 | 2012-10-16 00:05:46 -0700 | [diff] [blame] | 222 | enum RsForEachStrategy { |
| 223 | RS_FOR_EACH_STRATEGY_SERIAL = 0, |
| 224 | RS_FOR_EACH_STRATEGY_DONT_CARE = 1, |
| 225 | RS_FOR_EACH_STRATEGY_DST_LINEAR = 2, |
| 226 | RS_FOR_EACH_STRATEGY_TILE_SMALL = 3, |
| 227 | RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4, |
| 228 | RS_FOR_EACH_STRATEGY_TILE_LARGE = 5 |
| 229 | }; |
| 230 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 231 | // Script to Script |
| 232 | typedef struct { |
Stephen Hines | f598811 | 2012-10-16 00:05:46 -0700 | [diff] [blame] | 233 | enum RsForEachStrategy strategy; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 234 | uint32_t xStart; |
| 235 | uint32_t xEnd; |
| 236 | uint32_t yStart; |
| 237 | uint32_t yEnd; |
| 238 | uint32_t zStart; |
| 239 | uint32_t zEnd; |
| 240 | uint32_t arrayStart; |
| 241 | uint32_t arrayEnd; |
Jason Sams | bf2111d | 2015-01-26 18:13:41 -0800 | [diff] [blame] | 242 | uint32_t array2Start; |
| 243 | uint32_t array2End; |
| 244 | uint32_t array3Start; |
| 245 | uint32_t array3End; |
| 246 | uint32_t array4Start; |
| 247 | uint32_t array4End; |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 248 | |
| 249 | } RsScriptCall; |
| 250 | |
Tim Murray | 84e3dea | 2013-09-09 16:12:51 -0700 | [diff] [blame] | 251 | enum RsContextFlags { |
Jason Sams | bfa5a8e | 2014-05-20 18:16:20 -0700 | [diff] [blame] | 252 | RS_CONTEXT_SYNCHRONOUS = 0x0001, |
| 253 | RS_CONTEXT_LOW_LATENCY = 0x0002, |
| 254 | RS_CONTEXT_LOW_POWER = 0x0004 |
Tim Murray | 84e3dea | 2013-09-09 16:12:51 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 258 | #ifdef __cplusplus |
| 259 | }; |
| 260 | #endif |
| 261 | |
| 262 | #endif // RENDER_SCRIPT_DEFINES_H |