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