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; |
| 39 | typedef void * RsScriptBasicTemp; |
| 40 | typedef void * RsTriangleMesh; |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 41 | typedef void * RsSimpleMesh; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 42 | typedef void * RsType; |
Jason Sams | bba134c | 2009-06-22 15:49:21 -0700 | [diff] [blame] | 43 | typedef void * RsLight; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 44 | |
| 45 | typedef void * RsProgramVertex; |
| 46 | typedef void * RsProgramFragment; |
| 47 | typedef void * RsProgramFragmentStore; |
| 48 | |
| 49 | RsDevice rsDeviceCreate(); |
| 50 | void rsDeviceDestroy(RsDevice); |
| 51 | |
Jason Sams | b13ada5 | 2009-08-25 11:34:49 -0700 | [diff] [blame] | 52 | RsContext rsContextCreate(RsDevice, void *, uint32_t version, bool useDepth); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 53 | void rsContextDestroy(RsContext); |
Jason Sams | 730ee65 | 2009-08-18 17:07:09 -0700 | [diff] [blame] | 54 | void rsObjDestroyOOB(RsContext, void *); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 55 | |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 56 | #define RS_MAX_TEXTURE 2 |
| 57 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 58 | enum RsDataType { |
| 59 | RS_TYPE_FLOAT, |
| 60 | RS_TYPE_UNSIGNED, |
| 61 | RS_TYPE_SIGNED |
| 62 | }; |
| 63 | |
| 64 | enum RsDataKind { |
| 65 | RS_KIND_USER, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 66 | RS_KIND_RED, |
| 67 | RS_KIND_GREEN, |
| 68 | RS_KIND_BLUE, |
| 69 | RS_KIND_ALPHA, |
| 70 | RS_KIND_LUMINANCE, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 71 | RS_KIND_INTENSITY, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 72 | RS_KIND_X, |
| 73 | RS_KIND_Y, |
| 74 | RS_KIND_Z, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 75 | RS_KIND_W, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 76 | RS_KIND_S, |
| 77 | RS_KIND_T, |
| 78 | RS_KIND_Q, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 79 | RS_KIND_R, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 80 | RS_KIND_NX, |
| 81 | RS_KIND_NY, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 82 | RS_KIND_NZ, |
Jason Sams | 25ffcdc | 2009-08-20 16:10:36 -0700 | [diff] [blame] | 83 | RS_KIND_INDEX, |
| 84 | RS_KIND_POINT_SIZE |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | enum RsElementPredefined { |
| 88 | RS_ELEMENT_USER_U8, |
| 89 | RS_ELEMENT_USER_I8, |
| 90 | RS_ELEMENT_USER_U16, |
| 91 | RS_ELEMENT_USER_I16, |
| 92 | RS_ELEMENT_USER_U32, |
| 93 | RS_ELEMENT_USER_I32, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 94 | RS_ELEMENT_USER_FLOAT, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 95 | |
Jason Sams | ffe9f48 | 2009-06-01 17:45:53 -0700 | [diff] [blame] | 96 | RS_ELEMENT_A_8, // 7 |
| 97 | RS_ELEMENT_RGB_565, // 8 |
| 98 | RS_ELEMENT_RGBA_5551, // 9 |
| 99 | RS_ELEMENT_RGBA_4444, // 10 |
| 100 | RS_ELEMENT_RGB_888, // 11 |
| 101 | RS_ELEMENT_RGBA_8888, // 12 |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 102 | |
Jason Sams | ffe9f48 | 2009-06-01 17:45:53 -0700 | [diff] [blame] | 103 | RS_ELEMENT_INDEX_16, //13 |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 104 | RS_ELEMENT_INDEX_32, |
| 105 | RS_ELEMENT_XY_F32, |
| 106 | RS_ELEMENT_XYZ_F32, |
| 107 | RS_ELEMENT_ST_XY_F32, |
| 108 | RS_ELEMENT_ST_XYZ_F32, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 109 | RS_ELEMENT_NORM_XYZ_F32, |
| 110 | RS_ELEMENT_NORM_ST_XYZ_F32, |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 111 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 112 | |
| 113 | enum RsSamplerParam { |
| 114 | RS_SAMPLER_MIN_FILTER, |
| 115 | RS_SAMPLER_MAG_FILTER, |
| 116 | RS_SAMPLER_WRAP_S, |
| 117 | RS_SAMPLER_WRAP_T, |
| 118 | RS_SAMPLER_WRAP_R |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 119 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 120 | |
| 121 | enum RsSamplerValue { |
| 122 | RS_SAMPLER_NEAREST, |
| 123 | RS_SAMPLER_LINEAR, |
| 124 | RS_SAMPLER_LINEAR_MIP_LINEAR, |
| 125 | RS_SAMPLER_WRAP, |
| 126 | RS_SAMPLER_CLAMP |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 127 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 128 | |
| 129 | enum RsDimension { |
| 130 | RS_DIMENSION_X, |
| 131 | RS_DIMENSION_Y, |
| 132 | RS_DIMENSION_Z, |
| 133 | RS_DIMENSION_LOD, |
| 134 | RS_DIMENSION_FACE, |
| 135 | |
Jason Sams | 1bada8c | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 136 | RS_DIMENSION_ARRAY_0 = 100, |
| 137 | RS_DIMENSION_ARRAY_1, |
| 138 | RS_DIMENSION_ARRAY_2, |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 139 | RS_DIMENSION_ARRAY_3, |
| 140 | RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3 |
| 141 | }; |
| 142 | |
| 143 | enum RsDepthFunc { |
| 144 | RS_DEPTH_FUNC_ALWAYS, |
| 145 | RS_DEPTH_FUNC_LESS, |
| 146 | RS_DEPTH_FUNC_LEQUAL, |
| 147 | RS_DEPTH_FUNC_GREATER, |
| 148 | RS_DEPTH_FUNC_GEQUAL, |
| 149 | RS_DEPTH_FUNC_EQUAL, |
| 150 | RS_DEPTH_FUNC_NOTEQUAL |
| 151 | }; |
| 152 | |
| 153 | enum RsBlendSrcFunc { |
Jason Sams | b0ec1b4 | 2009-07-28 12:02:16 -0700 | [diff] [blame] | 154 | RS_BLEND_SRC_ZERO, // 0 |
| 155 | RS_BLEND_SRC_ONE, // 1 |
| 156 | RS_BLEND_SRC_DST_COLOR, // 2 |
| 157 | RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3 |
| 158 | RS_BLEND_SRC_SRC_ALPHA, // 4 |
| 159 | RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5 |
| 160 | RS_BLEND_SRC_DST_ALPHA, // 6 |
| 161 | RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7 |
| 162 | RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8 |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | enum RsBlendDstFunc { |
Jason Sams | b0ec1b4 | 2009-07-28 12:02:16 -0700 | [diff] [blame] | 166 | RS_BLEND_DST_ZERO, // 0 |
| 167 | RS_BLEND_DST_ONE, // 1 |
| 168 | RS_BLEND_DST_SRC_COLOR, // 2 |
| 169 | RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3 |
| 170 | RS_BLEND_DST_SRC_ALPHA, // 4 |
| 171 | RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5 |
| 172 | RS_BLEND_DST_DST_ALPHA, // 6 |
| 173 | RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7 |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | enum RsTexEnvMode { |
| 177 | RS_TEX_ENV_MODE_REPLACE, |
| 178 | RS_TEX_ENV_MODE_MODULATE, |
| 179 | RS_TEX_ENV_MODE_DECAL |
| 180 | }; |
| 181 | |
Jason Sams | 7c878f3 | 2009-06-30 14:13:04 -0700 | [diff] [blame] | 182 | enum RsPrimitive { |
| 183 | RS_PRIMITIVE_POINT, |
| 184 | RS_PRIMITIVE_LINE, |
| 185 | RS_PRIMITIVE_LINE_STRIP, |
| 186 | RS_PRIMITIVE_TRIANGLE, |
| 187 | RS_PRIMITIVE_TRIANGLE_STRIP, |
| 188 | RS_PRIMITIVE_TRIANGLE_FAN |
| 189 | }; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 190 | |
| 191 | |
| 192 | #include "rsgApiFuncDecl.h" |
| 193 | |
| 194 | #ifdef __cplusplus |
| 195 | }; |
| 196 | #endif |
| 197 | |
| 198 | #endif // RENDER_SCRIPT_H |
| 199 | |
| 200 | |
| 201 | |