blob: 0e0cd8dd4d576d7cf6e5f16f769bc8cedc11b230 [file] [log] [blame]
Jason Samse4a06c52011-03-16 16:29:28 -07001/*
Jason Samsfe1d5ff2012-03-23 11:47:26 -07002 * Copyright (C) 2007-2012 The Android Open Source Project
Jason Samse4a06c52011-03-16 16:29:28 -07003 *
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
24extern "C" {
25#endif
26
27//////////////////////////////////////////////////////
28//
29
30typedef void * RsAsyncVoidPtr;
31
32typedef void * RsAdapter1D;
33typedef void * RsAdapter2D;
34typedef void * RsAllocation;
35typedef void * RsAnimation;
36typedef void * RsContext;
37typedef void * RsDevice;
38typedef void * RsElement;
39typedef void * RsFile;
40typedef void * RsFont;
41typedef void * RsSampler;
42typedef void * RsScript;
43typedef void * RsMesh;
Jason Samsf15ed012011-10-31 13:23:43 -070044typedef void * RsPath;
Jason Samse4a06c52011-03-16 16:29:28 -070045typedef void * RsType;
46typedef void * RsObjectBase;
47
48typedef void * RsProgram;
49typedef void * RsProgramVertex;
50typedef void * RsProgramFragment;
51typedef void * RsProgramStore;
52typedef void * RsProgramRaster;
53
Alex Sakhartchouk6c72eec2011-05-17 12:32:47 -070054typedef void * RsNativeWindow;
55
Jason Samse4a06c52011-03-16 16:29:28 -070056typedef void (* RsBitmapCallback_t)(void *);
57
Jason Samsfcf72312011-04-20 15:09:01 -070058typedef struct {
59 float m[16];
60} rs_matrix4x4;
61
62typedef struct {
63 float m[9];
64} rs_matrix3x3;
65
66typedef struct {
67 float m[4];
68} rs_matrix2x2;
69
Jason Samse4a06c52011-03-16 16:29:28 -070070enum RsDeviceParam {
71 RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
72 RS_DEVICE_PARAM_COUNT
73};
74
75typedef 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
89enum 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
97enum 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 Sakhartchouk8e90f2b2011-04-01 14:19:01 -0700102 RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010,
Jason Samsfe1d5ff2012-03-23 11:47:26 -0700103 RS_ALLOCATION_USAGE_IO_INPUT = 0x0020,
104 RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040,
Jason Samse4a06c52011-03-16 16:29:28 -0700105
Jason Sams615e7ce2012-01-13 14:01:20 -0800106 RS_ALLOCATION_USAGE_ALL = 0x00FF
Jason Samse4a06c52011-03-16 16:29:28 -0700107};
108
109enum RsAllocationMipmapControl {
110 RS_ALLOCATION_MIPMAP_NONE = 0,
111 RS_ALLOCATION_MIPMAP_FULL = 1,
112 RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
113};
114
115enum RsAllocationCubemapFace {
Alex Sakhartchouk304b1f52011-06-14 11:13:19 -0700116 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 Samse4a06c52011-03-16 16:29:28 -0700122};
123
124enum 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 Sakhartchouk5b5664a2011-12-29 11:17:38 -0800158
159 RS_TYPE_INVALID = 10000,
Jason Samse4a06c52011-03-16 16:29:28 -0700160};
161
162enum 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 Sakhartchouk8e90f2b2011-04-01 14:19:01 -0700170 RS_KIND_PIXEL_DEPTH,
Alex Sakhartchouk5b5664a2011-12-29 11:17:38 -0800171
172 RS_KIND_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700173};
174
175enum 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
184enum 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 Sakhartchouk5b5664a2011-12-29 11:17:38 -0800191
192 RS_SAMPLER_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700193};
194
195enum RsTextureTarget {
196 RS_TEXTURE_2D,
197 RS_TEXTURE_CUBE
198};
199
200enum 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
214enum 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
224enum 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 Sakhartchouk5b5664a2011-12-29 11:17:38 -0800233 RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8
234 RS_BLEND_SRC_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700235};
236
237enum 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 Sakhartchouk5b5664a2011-12-29 11:17:38 -0800245 RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7
246
247 RS_BLEND_DST_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700248};
249
250enum 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
257enum RsProgramParam {
258 RS_PROGRAM_PARAM_INPUT,
259 RS_PROGRAM_PARAM_OUTPUT,
260 RS_PROGRAM_PARAM_CONSTANT,
261 RS_PROGRAM_PARAM_TEXTURE_TYPE,
262};
263
264enum RsPrimitive {
265 RS_PRIMITIVE_POINT,
266 RS_PRIMITIVE_LINE,
267 RS_PRIMITIVE_LINE_STRIP,
268 RS_PRIMITIVE_TRIANGLE,
269 RS_PRIMITIVE_TRIANGLE_STRIP,
Alex Sakhartchouk5b5664a2011-12-29 11:17:38 -0800270 RS_PRIMITIVE_TRIANGLE_FAN,
271
272 RS_PRIMITIVE_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700273};
274
Jason Samsf15ed012011-10-31 13:23:43 -0700275enum RsPathPrimitive {
276 RS_PATH_PRIMITIVE_QUADRATIC_BEZIER,
277 RS_PATH_PRIMITIVE_CUBIC_BEZIER
278};
279
Jason Samse4a06c52011-03-16 16:29:28 -0700280enum 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
293enum 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
302enum 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
311enum 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
328enum RsCullMode {
329 RS_CULL_BACK,
330 RS_CULL_FRONT,
Alex Sakhartchouk5b5664a2011-12-29 11:17:38 -0800331 RS_CULL_NONE,
332 RS_CULL_INVALID = 100,
Jason Samse4a06c52011-03-16 16:29:28 -0700333};
334
335typedef struct {
336 RsA3DClassID classID;
337 const char* objectName;
338} RsFileIndexEntry;
339
340// Script to Script
341typedef 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