Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | #ifndef RENDER_SCRIPT_H |
| 18 | #define RENDER_SCRIPT_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | ////////////////////////////////////////////////////// |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 28 | // |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 29 | |
| 30 | typedef void * RsAdapter1D; |
| 31 | typedef void * RsAdapter2D; |
| 32 | typedef void * RsAllocation; |
| 33 | typedef void * RsContext; |
| 34 | typedef void * RsDevice; |
| 35 | typedef void * RsElement; |
Jason Sams | 64676f3 | 2009-07-08 18:01:53 -0700 | [diff] [blame] | 36 | typedef void * RsFile; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 37 | typedef void * RsSampler; |
| 38 | typedef void * RsScript; |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 39 | typedef void * RsSimpleMesh; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 40 | typedef void * RsType; |
Jason Sams | bba134c | 2009-06-22 15:49:21 -0700 | [diff] [blame] | 41 | typedef void * RsLight; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 42 | |
Jason Sams | 0011bcf | 2009-12-15 12:58:36 -0800 | [diff] [blame] | 43 | typedef void * RsProgram; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 44 | typedef void * RsProgramVertex; |
| 45 | typedef void * RsProgramFragment; |
| 46 | typedef void * RsProgramFragmentStore; |
Jason Sams | ebfb436 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 47 | typedef void * RsProgramRaster; |
| 48 | |
| 49 | enum RsDeviceParam { |
| 50 | RS_DEVICE_PARAM_FORCE_SOFTWARE_GL, |
| 51 | RS_DEVICE_PARAM_COUNT |
| 52 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 53 | |
| 54 | RsDevice rsDeviceCreate(); |
| 55 | void rsDeviceDestroy(RsDevice); |
Jason Sams | ebfb436 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 56 | void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 57 | |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 58 | RsContext rsContextCreate(RsDevice, uint32_t version); |
| 59 | RsContext rsContextCreateGL(RsDevice, uint32_t version, bool useDepth); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 60 | void rsContextDestroy(RsContext); |
Jason Sams | 730ee65 | 2009-08-18 17:07:09 -0700 | [diff] [blame] | 61 | void rsObjDestroyOOB(RsContext, void *); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 62 | |
Jason Sams | 516c319 | 2009-10-06 13:58:47 -0700 | [diff] [blame] | 63 | uint32_t rsContextGetMessage(RsContext, void *data, size_t *receiveLen, size_t bufferLen, bool wait); |
| 64 | void rsContextInitToClient(RsContext); |
| 65 | void rsContextDeinitToClient(RsContext); |
| 66 | |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 67 | #define RS_MAX_TEXTURE 2 |
Jason Sams | a09a6e1 | 2010-01-06 11:57:52 -0800 | [diff] [blame] | 68 | #define RS_MAX_ATTRIBS 16 |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 69 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 70 | enum RsDataType { |
Jason Sams | 718cd1f | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 71 | RS_TYPE_NONE, |
| 72 | RS_TYPE_FLOAT_16, |
| 73 | RS_TYPE_FLOAT_32, |
| 74 | RS_TYPE_FLOAT_64, |
| 75 | RS_TYPE_SIGNED_8, |
| 76 | RS_TYPE_SIGNED_16, |
| 77 | RS_TYPE_SIGNED_32, |
| 78 | RS_TYPE_SIGNED_64, |
| 79 | RS_TYPE_UNSIGNED_8, |
| 80 | RS_TYPE_UNSIGNED_16, |
| 81 | RS_TYPE_UNSIGNED_32, |
| 82 | RS_TYPE_UNSIGNED_64, |
| 83 | |
| 84 | RS_TYPE_UNSIGNED_5_6_5, |
| 85 | RS_TYPE_UNSIGNED_5_5_5_1, |
| 86 | RS_TYPE_UNSIGNED_4_4_4_4, |
| 87 | |
| 88 | RS_TYPE_ELEMENT, |
| 89 | RS_TYPE_TYPE, |
| 90 | RS_TYPE_ALLOCATION, |
| 91 | RS_TYPE_SAMPLER, |
| 92 | RS_TYPE_SCRIPT, |
| 93 | RS_TYPE_MESH, |
| 94 | RS_TYPE_PROGRAM_FRAGMENT, |
| 95 | RS_TYPE_PROGRAM_VERTEX, |
| 96 | RS_TYPE_PROGRAM_RASTER, |
| 97 | RS_TYPE_PROGRAM_STORE |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | enum RsDataKind { |
| 101 | RS_KIND_USER, |
Jason Sams | 718cd1f | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 102 | RS_KIND_COLOR, |
| 103 | RS_KIND_POSITION, |
| 104 | RS_KIND_TEXTURE, |
| 105 | RS_KIND_NORMAL, |
Jason Sams | 25ffcdc | 2009-08-20 16:10:36 -0700 | [diff] [blame] | 106 | RS_KIND_INDEX, |
Jason Sams | 718cd1f | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 107 | RS_KIND_POINT_SIZE, |
| 108 | |
| 109 | RS_KIND_PIXEL_L, |
| 110 | RS_KIND_PIXEL_A, |
| 111 | RS_KIND_PIXEL_LA, |
| 112 | RS_KIND_PIXEL_RGB, |
| 113 | RS_KIND_PIXEL_RGBA, |
| 114 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 115 | }; |
| 116 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 117 | enum RsSamplerParam { |
| 118 | RS_SAMPLER_MIN_FILTER, |
| 119 | RS_SAMPLER_MAG_FILTER, |
| 120 | RS_SAMPLER_WRAP_S, |
| 121 | RS_SAMPLER_WRAP_T, |
| 122 | RS_SAMPLER_WRAP_R |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 123 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 124 | |
| 125 | enum RsSamplerValue { |
| 126 | RS_SAMPLER_NEAREST, |
| 127 | RS_SAMPLER_LINEAR, |
| 128 | RS_SAMPLER_LINEAR_MIP_LINEAR, |
| 129 | RS_SAMPLER_WRAP, |
| 130 | RS_SAMPLER_CLAMP |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 131 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 132 | |
| 133 | enum RsDimension { |
| 134 | RS_DIMENSION_X, |
| 135 | RS_DIMENSION_Y, |
| 136 | RS_DIMENSION_Z, |
| 137 | RS_DIMENSION_LOD, |
| 138 | RS_DIMENSION_FACE, |
| 139 | |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 140 | RS_DIMENSION_ARRAY_0 = 100, |
| 141 | RS_DIMENSION_ARRAY_1, |
| 142 | RS_DIMENSION_ARRAY_2, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 143 | RS_DIMENSION_ARRAY_3, |
| 144 | RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3 |
| 145 | }; |
| 146 | |
| 147 | enum RsDepthFunc { |
| 148 | RS_DEPTH_FUNC_ALWAYS, |
| 149 | RS_DEPTH_FUNC_LESS, |
| 150 | RS_DEPTH_FUNC_LEQUAL, |
| 151 | RS_DEPTH_FUNC_GREATER, |
| 152 | RS_DEPTH_FUNC_GEQUAL, |
| 153 | RS_DEPTH_FUNC_EQUAL, |
| 154 | RS_DEPTH_FUNC_NOTEQUAL |
| 155 | }; |
| 156 | |
| 157 | enum RsBlendSrcFunc { |
Jason Sams | b0ec1b4 | 2009-07-28 12:02:16 -0700 | [diff] [blame] | 158 | RS_BLEND_SRC_ZERO, // 0 |
| 159 | RS_BLEND_SRC_ONE, // 1 |
| 160 | RS_BLEND_SRC_DST_COLOR, // 2 |
| 161 | RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3 |
| 162 | RS_BLEND_SRC_SRC_ALPHA, // 4 |
| 163 | RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5 |
| 164 | RS_BLEND_SRC_DST_ALPHA, // 6 |
| 165 | RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7 |
| 166 | RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8 |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | enum RsBlendDstFunc { |
Jason Sams | b0ec1b4 | 2009-07-28 12:02:16 -0700 | [diff] [blame] | 170 | RS_BLEND_DST_ZERO, // 0 |
| 171 | RS_BLEND_DST_ONE, // 1 |
| 172 | RS_BLEND_DST_SRC_COLOR, // 2 |
| 173 | RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3 |
| 174 | RS_BLEND_DST_SRC_ALPHA, // 4 |
| 175 | RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5 |
| 176 | RS_BLEND_DST_DST_ALPHA, // 6 |
| 177 | RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7 |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | enum RsTexEnvMode { |
Jason Sams | 68afd01 | 2009-12-17 16:55:08 -0800 | [diff] [blame] | 181 | RS_TEX_ENV_MODE_NONE, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 182 | RS_TEX_ENV_MODE_REPLACE, |
| 183 | RS_TEX_ENV_MODE_MODULATE, |
| 184 | RS_TEX_ENV_MODE_DECAL |
| 185 | }; |
| 186 | |
Jason Sams | 0011bcf | 2009-12-15 12:58:36 -0800 | [diff] [blame] | 187 | enum RsProgramParam { |
| 188 | RS_PROGRAM_PARAM_INPUT, |
| 189 | RS_PROGRAM_PARAM_OUTPUT, |
| 190 | RS_PROGRAM_PARAM_CONSTANT, |
Jason Sams | 7e5ab3b | 2009-12-15 13:27:04 -0800 | [diff] [blame] | 191 | RS_PROGRAM_PARAM_TEXTURE_COUNT, |
Jason Sams | 0011bcf | 2009-12-15 12:58:36 -0800 | [diff] [blame] | 192 | }; |
| 193 | |
Jason Sams | 7c878f3 | 2009-06-30 14:13:04 -0700 | [diff] [blame] | 194 | enum RsPrimitive { |
| 195 | RS_PRIMITIVE_POINT, |
| 196 | RS_PRIMITIVE_LINE, |
| 197 | RS_PRIMITIVE_LINE_STRIP, |
| 198 | RS_PRIMITIVE_TRIANGLE, |
| 199 | RS_PRIMITIVE_TRIANGLE_STRIP, |
| 200 | RS_PRIMITIVE_TRIANGLE_FAN |
| 201 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 202 | |
| 203 | |
| 204 | #include "rsgApiFuncDecl.h" |
| 205 | |
| 206 | #ifdef __cplusplus |
| 207 | }; |
| 208 | #endif |
| 209 | |
| 210 | #endif // RENDER_SCRIPT_H |
| 211 | |
| 212 | |
| 213 | |