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