Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 1 | /* |
Jason Sams | fe1d5ff | 2012-03-23 11:47:26 -0700 | [diff] [blame] | 2 | * Copyright (C) 2007-2012 The Android Open Source Project |
Jason Sams | e4a06c5 | 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; |
| 36 | typedef void * RsContext; |
| 37 | typedef void * RsDevice; |
| 38 | typedef void * RsElement; |
| 39 | typedef void * RsFile; |
| 40 | typedef void * RsFont; |
| 41 | typedef void * RsSampler; |
| 42 | typedef void * RsScript; |
| 43 | typedef void * RsMesh; |
Jason Sams | f15ed01 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 44 | typedef void * RsPath; |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 45 | typedef void * RsType; |
| 46 | typedef void * RsObjectBase; |
| 47 | |
| 48 | typedef void * RsProgram; |
| 49 | typedef void * RsProgramVertex; |
| 50 | typedef void * RsProgramFragment; |
| 51 | typedef void * RsProgramStore; |
| 52 | typedef void * RsProgramRaster; |
| 53 | |
Alex Sakhartchouk | 6c72eec | 2011-05-17 12:32:47 -0700 | [diff] [blame] | 54 | typedef void * RsNativeWindow; |
| 55 | |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 56 | typedef void (* RsBitmapCallback_t)(void *); |
| 57 | |
Jason Sams | fcf7231 | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 58 | typedef struct { |
| 59 | float m[16]; |
| 60 | } rs_matrix4x4; |
| 61 | |
| 62 | typedef struct { |
| 63 | float m[9]; |
| 64 | } rs_matrix3x3; |
| 65 | |
| 66 | typedef struct { |
| 67 | float m[4]; |
| 68 | } rs_matrix2x2; |
| 69 | |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 70 | enum RsDeviceParam { |
| 71 | RS_DEVICE_PARAM_FORCE_SOFTWARE_GL, |
| 72 | RS_DEVICE_PARAM_COUNT |
| 73 | }; |
| 74 | |
| 75 | typedef struct { |
| 76 | uint32_t colorMin; |
| 77 | uint32_t colorPref; |
| 78 | uint32_t alphaMin; |
| 79 | uint32_t alphaPref; |
| 80 | uint32_t depthMin; |
| 81 | uint32_t depthPref; |
| 82 | uint32_t stencilMin; |
| 83 | uint32_t stencilPref; |
| 84 | uint32_t samplesMin; |
| 85 | uint32_t samplesPref; |
| 86 | float samplesQ; |
| 87 | } RsSurfaceConfig; |
| 88 | |
| 89 | enum RsMessageToClientType { |
| 90 | RS_MESSAGE_TO_CLIENT_NONE = 0, |
| 91 | RS_MESSAGE_TO_CLIENT_EXCEPTION = 1, |
| 92 | RS_MESSAGE_TO_CLIENT_RESIZE = 2, |
| 93 | RS_MESSAGE_TO_CLIENT_ERROR = 3, |
| 94 | RS_MESSAGE_TO_CLIENT_USER = 4 |
| 95 | }; |
| 96 | |
| 97 | enum RsAllocationUsageType { |
| 98 | RS_ALLOCATION_USAGE_SCRIPT = 0x0001, |
| 99 | RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, |
| 100 | RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, |
| 101 | RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, |
Alex Sakhartchouk | 8e90f2b | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 102 | RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010, |
Jason Sams | fe1d5ff | 2012-03-23 11:47:26 -0700 | [diff] [blame] | 103 | RS_ALLOCATION_USAGE_IO_INPUT = 0x0020, |
| 104 | RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 105 | |
Jason Sams | 615e7ce | 2012-01-13 14:01:20 -0800 | [diff] [blame] | 106 | RS_ALLOCATION_USAGE_ALL = 0x00FF |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | enum RsAllocationMipmapControl { |
| 110 | RS_ALLOCATION_MIPMAP_NONE = 0, |
| 111 | RS_ALLOCATION_MIPMAP_FULL = 1, |
| 112 | RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2 |
| 113 | }; |
| 114 | |
| 115 | enum RsAllocationCubemapFace { |
Alex Sakhartchouk | 304b1f5 | 2011-06-14 11:13:19 -0700 | [diff] [blame] | 116 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0, |
| 117 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1, |
| 118 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2, |
| 119 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3, |
| 120 | RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4, |
| 121 | RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5 |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | enum RsDataType { |
| 125 | RS_TYPE_NONE, |
| 126 | RS_TYPE_FLOAT_16, |
| 127 | RS_TYPE_FLOAT_32, |
| 128 | RS_TYPE_FLOAT_64, |
| 129 | RS_TYPE_SIGNED_8, |
| 130 | RS_TYPE_SIGNED_16, |
| 131 | RS_TYPE_SIGNED_32, |
| 132 | RS_TYPE_SIGNED_64, |
| 133 | RS_TYPE_UNSIGNED_8, |
| 134 | RS_TYPE_UNSIGNED_16, |
| 135 | RS_TYPE_UNSIGNED_32, |
| 136 | RS_TYPE_UNSIGNED_64, |
| 137 | |
| 138 | RS_TYPE_BOOLEAN, |
| 139 | |
| 140 | RS_TYPE_UNSIGNED_5_6_5, |
| 141 | RS_TYPE_UNSIGNED_5_5_5_1, |
| 142 | RS_TYPE_UNSIGNED_4_4_4_4, |
| 143 | |
| 144 | RS_TYPE_MATRIX_4X4, |
| 145 | RS_TYPE_MATRIX_3X3, |
| 146 | RS_TYPE_MATRIX_2X2, |
| 147 | |
| 148 | RS_TYPE_ELEMENT = 1000, |
| 149 | RS_TYPE_TYPE, |
| 150 | RS_TYPE_ALLOCATION, |
| 151 | RS_TYPE_SAMPLER, |
| 152 | RS_TYPE_SCRIPT, |
| 153 | RS_TYPE_MESH, |
| 154 | RS_TYPE_PROGRAM_FRAGMENT, |
| 155 | RS_TYPE_PROGRAM_VERTEX, |
| 156 | RS_TYPE_PROGRAM_RASTER, |
| 157 | RS_TYPE_PROGRAM_STORE, |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 158 | |
| 159 | RS_TYPE_INVALID = 10000, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | enum RsDataKind { |
| 163 | RS_KIND_USER, |
| 164 | |
| 165 | RS_KIND_PIXEL_L = 7, |
| 166 | RS_KIND_PIXEL_A, |
| 167 | RS_KIND_PIXEL_LA, |
| 168 | RS_KIND_PIXEL_RGB, |
| 169 | RS_KIND_PIXEL_RGBA, |
Alex Sakhartchouk | 8e90f2b | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 170 | RS_KIND_PIXEL_DEPTH, |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 171 | |
| 172 | RS_KIND_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 173 | }; |
| 174 | |
| 175 | enum RsSamplerParam { |
| 176 | RS_SAMPLER_MIN_FILTER, |
| 177 | RS_SAMPLER_MAG_FILTER, |
| 178 | RS_SAMPLER_WRAP_S, |
| 179 | RS_SAMPLER_WRAP_T, |
| 180 | RS_SAMPLER_WRAP_R, |
| 181 | RS_SAMPLER_ANISO |
| 182 | }; |
| 183 | |
| 184 | enum RsSamplerValue { |
| 185 | RS_SAMPLER_NEAREST, |
| 186 | RS_SAMPLER_LINEAR, |
| 187 | RS_SAMPLER_LINEAR_MIP_LINEAR, |
| 188 | RS_SAMPLER_WRAP, |
| 189 | RS_SAMPLER_CLAMP, |
| 190 | RS_SAMPLER_LINEAR_MIP_NEAREST, |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 191 | |
| 192 | RS_SAMPLER_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | enum RsTextureTarget { |
| 196 | RS_TEXTURE_2D, |
| 197 | RS_TEXTURE_CUBE |
| 198 | }; |
| 199 | |
| 200 | enum RsDimension { |
| 201 | RS_DIMENSION_X, |
| 202 | RS_DIMENSION_Y, |
| 203 | RS_DIMENSION_Z, |
| 204 | RS_DIMENSION_LOD, |
| 205 | RS_DIMENSION_FACE, |
| 206 | |
| 207 | RS_DIMENSION_ARRAY_0 = 100, |
| 208 | RS_DIMENSION_ARRAY_1, |
| 209 | RS_DIMENSION_ARRAY_2, |
| 210 | RS_DIMENSION_ARRAY_3, |
| 211 | RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3 |
| 212 | }; |
| 213 | |
| 214 | enum RsDepthFunc { |
| 215 | RS_DEPTH_FUNC_ALWAYS, |
| 216 | RS_DEPTH_FUNC_LESS, |
| 217 | RS_DEPTH_FUNC_LEQUAL, |
| 218 | RS_DEPTH_FUNC_GREATER, |
| 219 | RS_DEPTH_FUNC_GEQUAL, |
| 220 | RS_DEPTH_FUNC_EQUAL, |
| 221 | RS_DEPTH_FUNC_NOTEQUAL |
| 222 | }; |
| 223 | |
| 224 | enum RsBlendSrcFunc { |
| 225 | RS_BLEND_SRC_ZERO, // 0 |
| 226 | RS_BLEND_SRC_ONE, // 1 |
| 227 | RS_BLEND_SRC_DST_COLOR, // 2 |
| 228 | RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3 |
| 229 | RS_BLEND_SRC_SRC_ALPHA, // 4 |
| 230 | RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5 |
| 231 | RS_BLEND_SRC_DST_ALPHA, // 6 |
| 232 | RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7 |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 233 | RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8 |
| 234 | RS_BLEND_SRC_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 235 | }; |
| 236 | |
| 237 | enum RsBlendDstFunc { |
| 238 | RS_BLEND_DST_ZERO, // 0 |
| 239 | RS_BLEND_DST_ONE, // 1 |
| 240 | RS_BLEND_DST_SRC_COLOR, // 2 |
| 241 | RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3 |
| 242 | RS_BLEND_DST_SRC_ALPHA, // 4 |
| 243 | RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5 |
| 244 | RS_BLEND_DST_DST_ALPHA, // 6 |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 245 | RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7 |
| 246 | |
| 247 | RS_BLEND_DST_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 248 | }; |
| 249 | |
| 250 | enum RsTexEnvMode { |
| 251 | RS_TEX_ENV_MODE_NONE, |
| 252 | RS_TEX_ENV_MODE_REPLACE, |
| 253 | RS_TEX_ENV_MODE_MODULATE, |
| 254 | RS_TEX_ENV_MODE_DECAL |
| 255 | }; |
| 256 | |
| 257 | enum RsProgramParam { |
| 258 | RS_PROGRAM_PARAM_INPUT, |
| 259 | RS_PROGRAM_PARAM_OUTPUT, |
| 260 | RS_PROGRAM_PARAM_CONSTANT, |
| 261 | RS_PROGRAM_PARAM_TEXTURE_TYPE, |
| 262 | }; |
| 263 | |
| 264 | enum RsPrimitive { |
| 265 | RS_PRIMITIVE_POINT, |
| 266 | RS_PRIMITIVE_LINE, |
| 267 | RS_PRIMITIVE_LINE_STRIP, |
| 268 | RS_PRIMITIVE_TRIANGLE, |
| 269 | RS_PRIMITIVE_TRIANGLE_STRIP, |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 270 | RS_PRIMITIVE_TRIANGLE_FAN, |
| 271 | |
| 272 | RS_PRIMITIVE_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 273 | }; |
| 274 | |
Jason Sams | f15ed01 | 2011-10-31 13:23:43 -0700 | [diff] [blame] | 275 | enum RsPathPrimitive { |
| 276 | RS_PATH_PRIMITIVE_QUADRATIC_BEZIER, |
| 277 | RS_PATH_PRIMITIVE_CUBIC_BEZIER |
| 278 | }; |
| 279 | |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 280 | enum RsError { |
| 281 | RS_ERROR_NONE = 0, |
| 282 | RS_ERROR_BAD_SHADER = 1, |
| 283 | RS_ERROR_BAD_SCRIPT = 2, |
| 284 | RS_ERROR_BAD_VALUE = 3, |
| 285 | RS_ERROR_OUT_OF_MEMORY = 4, |
| 286 | RS_ERROR_DRIVER = 5, |
| 287 | |
| 288 | RS_ERROR_FATAL_UNKNOWN = 0x1000, |
| 289 | RS_ERROR_FATAL_DRIVER = 0x1001, |
| 290 | RS_ERROR_FATAL_PROGRAM_LINK = 0x1002 |
| 291 | }; |
| 292 | |
| 293 | enum RsAnimationInterpolation { |
| 294 | RS_ANIMATION_INTERPOLATION_STEP, |
| 295 | RS_ANIMATION_INTERPOLATION_LINEAR, |
| 296 | RS_ANIMATION_INTERPOLATION_BEZIER, |
| 297 | RS_ANIMATION_INTERPOLATION_CARDINAL, |
| 298 | RS_ANIMATION_INTERPOLATION_HERMITE, |
| 299 | RS_ANIMATION_INTERPOLATION_BSPLINE |
| 300 | }; |
| 301 | |
| 302 | enum RsAnimationEdge { |
| 303 | RS_ANIMATION_EDGE_UNDEFINED, |
| 304 | RS_ANIMATION_EDGE_CONSTANT, |
| 305 | RS_ANIMATION_EDGE_GRADIENT, |
| 306 | RS_ANIMATION_EDGE_CYCLE, |
| 307 | RS_ANIMATION_EDGE_OSCILLATE, |
| 308 | RS_ANIMATION_EDGE_CYLE_RELATIVE |
| 309 | }; |
| 310 | |
| 311 | enum RsA3DClassID { |
| 312 | RS_A3D_CLASS_ID_UNKNOWN, |
| 313 | RS_A3D_CLASS_ID_MESH, |
| 314 | RS_A3D_CLASS_ID_TYPE, |
| 315 | RS_A3D_CLASS_ID_ELEMENT, |
| 316 | RS_A3D_CLASS_ID_ALLOCATION, |
| 317 | RS_A3D_CLASS_ID_PROGRAM_VERTEX, |
| 318 | RS_A3D_CLASS_ID_PROGRAM_RASTER, |
| 319 | RS_A3D_CLASS_ID_PROGRAM_FRAGMENT, |
| 320 | RS_A3D_CLASS_ID_PROGRAM_STORE, |
| 321 | RS_A3D_CLASS_ID_SAMPLER, |
| 322 | RS_A3D_CLASS_ID_ANIMATION, |
| 323 | RS_A3D_CLASS_ID_ADAPTER_1D, |
| 324 | RS_A3D_CLASS_ID_ADAPTER_2D, |
| 325 | RS_A3D_CLASS_ID_SCRIPT_C |
| 326 | }; |
| 327 | |
| 328 | enum RsCullMode { |
| 329 | RS_CULL_BACK, |
| 330 | RS_CULL_FRONT, |
Alex Sakhartchouk | 5b5664a | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 331 | RS_CULL_NONE, |
| 332 | RS_CULL_INVALID = 100, |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 333 | }; |
| 334 | |
| 335 | typedef struct { |
| 336 | RsA3DClassID classID; |
| 337 | const char* objectName; |
| 338 | } RsFileIndexEntry; |
| 339 | |
| 340 | // Script to Script |
| 341 | typedef struct { |
| 342 | uint32_t xStart; |
| 343 | uint32_t xEnd; |
| 344 | uint32_t yStart; |
| 345 | uint32_t yEnd; |
| 346 | uint32_t zStart; |
| 347 | uint32_t zEnd; |
| 348 | uint32_t arrayStart; |
| 349 | uint32_t arrayEnd; |
| 350 | |
| 351 | } RsScriptCall; |
| 352 | |
| 353 | #ifdef __cplusplus |
| 354 | }; |
| 355 | #endif |
| 356 | |
| 357 | #endif // RENDER_SCRIPT_DEFINES_H |
| 358 | |
| 359 | |
| 360 | |
| 361 | |