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