1 /*
2  * Copyright (C) 2014 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_INTERNAL_DEFINES_H
18 #define RENDER_SCRIPT_INTERNAL_DEFINES_H
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #include "rsDefines.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 //////////////////////////////////////////////////////
30 //
31 
32 
33 typedef void (* RsBitmapCallback_t)(void *);
34 
35 
36 typedef struct {
37     uint32_t colorMin;
38     uint32_t colorPref;
39     uint32_t alphaMin;
40     uint32_t alphaPref;
41     uint32_t depthMin;
42     uint32_t depthPref;
43     uint32_t stencilMin;
44     uint32_t stencilPref;
45     uint32_t samplesMin;
46     uint32_t samplesPref;
47     float samplesQ;
48 } RsSurfaceConfig;
49 
50 enum RsMessageToClientType {
51     RS_MESSAGE_TO_CLIENT_NONE = 0,
52     RS_MESSAGE_TO_CLIENT_EXCEPTION = 1,
53     RS_MESSAGE_TO_CLIENT_RESIZE = 2,
54     RS_MESSAGE_TO_CLIENT_ERROR = 3,
55     RS_MESSAGE_TO_CLIENT_USER = 4,
56     RS_MESSAGE_TO_CLIENT_NEW_BUFFER = 5
57 };
58 
59 enum RsTextureTarget {
60     RS_TEXTURE_2D,
61     RS_TEXTURE_CUBE
62 };
63 
64 enum RsDepthFunc {
65     RS_DEPTH_FUNC_ALWAYS,
66     RS_DEPTH_FUNC_LESS,
67     RS_DEPTH_FUNC_LEQUAL,
68     RS_DEPTH_FUNC_GREATER,
69     RS_DEPTH_FUNC_GEQUAL,
70     RS_DEPTH_FUNC_EQUAL,
71     RS_DEPTH_FUNC_NOTEQUAL
72 };
73 
74 enum RsBlendSrcFunc {
75     RS_BLEND_SRC_ZERO,                  // 0
76     RS_BLEND_SRC_ONE,                   // 1
77     RS_BLEND_SRC_DST_COLOR,             // 2
78     RS_BLEND_SRC_ONE_MINUS_DST_COLOR,   // 3
79     RS_BLEND_SRC_SRC_ALPHA,             // 4
80     RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA,   // 5
81     RS_BLEND_SRC_DST_ALPHA,             // 6
82     RS_BLEND_SRC_ONE_MINUS_DST_ALPHA,   // 7
83     RS_BLEND_SRC_SRC_ALPHA_SATURATE,    // 8
84     RS_BLEND_SRC_INVALID = 100,
85 };
86 
87 enum RsBlendDstFunc {
88     RS_BLEND_DST_ZERO,                  // 0
89     RS_BLEND_DST_ONE,                   // 1
90     RS_BLEND_DST_SRC_COLOR,             // 2
91     RS_BLEND_DST_ONE_MINUS_SRC_COLOR,   // 3
92     RS_BLEND_DST_SRC_ALPHA,             // 4
93     RS_BLEND_DST_ONE_MINUS_SRC_ALPHA,   // 5
94     RS_BLEND_DST_DST_ALPHA,             // 6
95     RS_BLEND_DST_ONE_MINUS_DST_ALPHA,   // 7
96 
97     RS_BLEND_DST_INVALID = 100,
98 };
99 
100 enum RsTexEnvMode {
101     RS_TEX_ENV_MODE_NONE,
102     RS_TEX_ENV_MODE_REPLACE,
103     RS_TEX_ENV_MODE_MODULATE,
104     RS_TEX_ENV_MODE_DECAL
105 };
106 
107 enum RsProgramParam {
108     RS_PROGRAM_PARAM_INPUT,
109     RS_PROGRAM_PARAM_OUTPUT,
110     RS_PROGRAM_PARAM_CONSTANT,
111     RS_PROGRAM_PARAM_TEXTURE_TYPE,
112 };
113 
114 enum RsPrimitive {
115     RS_PRIMITIVE_POINT,
116     RS_PRIMITIVE_LINE,
117     RS_PRIMITIVE_LINE_STRIP,
118     RS_PRIMITIVE_TRIANGLE,
119     RS_PRIMITIVE_TRIANGLE_STRIP,
120     RS_PRIMITIVE_TRIANGLE_FAN,
121 
122     RS_PRIMITIVE_INVALID = 100,
123 };
124 
125 enum RsPathPrimitive {
126     RS_PATH_PRIMITIVE_QUADRATIC_BEZIER,
127     RS_PATH_PRIMITIVE_CUBIC_BEZIER
128 };
129 
130 enum RsAnimationInterpolation {
131     RS_ANIMATION_INTERPOLATION_STEP,
132     RS_ANIMATION_INTERPOLATION_LINEAR,
133     RS_ANIMATION_INTERPOLATION_BEZIER,
134     RS_ANIMATION_INTERPOLATION_CARDINAL,
135     RS_ANIMATION_INTERPOLATION_HERMITE,
136     RS_ANIMATION_INTERPOLATION_BSPLINE
137 };
138 
139 enum RsAnimationEdge {
140     RS_ANIMATION_EDGE_UNDEFINED,
141     RS_ANIMATION_EDGE_CONSTANT,
142     RS_ANIMATION_EDGE_GRADIENT,
143     RS_ANIMATION_EDGE_CYCLE,
144     RS_ANIMATION_EDGE_OSCILLATE,
145     RS_ANIMATION_EDGE_CYLE_RELATIVE
146 };
147 
148 enum RsA3DClassID {
149     RS_A3D_CLASS_ID_UNKNOWN,
150     RS_A3D_CLASS_ID_MESH,
151     RS_A3D_CLASS_ID_TYPE,
152     RS_A3D_CLASS_ID_ELEMENT,
153     RS_A3D_CLASS_ID_ALLOCATION,
154     RS_A3D_CLASS_ID_PROGRAM_VERTEX,
155     RS_A3D_CLASS_ID_PROGRAM_RASTER,
156     RS_A3D_CLASS_ID_PROGRAM_FRAGMENT,
157     RS_A3D_CLASS_ID_PROGRAM_STORE,
158     RS_A3D_CLASS_ID_SAMPLER,
159     RS_A3D_CLASS_ID_ANIMATION,
160     RS_A3D_CLASS_ID_ADAPTER_1D,
161     RS_A3D_CLASS_ID_ADAPTER_2D,
162     RS_A3D_CLASS_ID_SCRIPT_C,
163     RS_A3D_CLASS_ID_SCRIPT_KERNEL_ID,
164     RS_A3D_CLASS_ID_SCRIPT_FIELD_ID,
165     RS_A3D_CLASS_ID_SCRIPT_METHOD_ID,
166     RS_A3D_CLASS_ID_SCRIPT_GROUP,
167     RS_A3D_CLASS_ID_CLOSURE,
168     RS_A3D_CLASS_ID_SCRIPT_GROUP2,
169     RS_A3D_CLASS_ID_SCRIPT_INVOKE_ID
170 };
171 
172 enum RsCullMode {
173     RS_CULL_BACK,
174     RS_CULL_FRONT,
175     RS_CULL_NONE,
176     RS_CULL_INVALID = 100,
177 };
178 
179 enum RsScriptIntrinsicID {
180     RS_SCRIPT_INTRINSIC_ID_UNDEFINED = 0,
181     RS_SCRIPT_INTRINSIC_ID_CONVOLVE_3x3 = 1,
182     RS_SCRIPT_INTRINSIC_ID_COLOR_MATRIX = 2,
183     RS_SCRIPT_INTRINSIC_ID_LUT = 3,
184     RS_SCRIPT_INTRINSIC_ID_CONVOLVE_5x5 = 4,
185     RS_SCRIPT_INTRINSIC_ID_BLUR = 5,
186     RS_SCRIPT_INTRINSIC_ID_YUV_TO_RGB = 6,
187     RS_SCRIPT_INTRINSIC_ID_BLEND = 7,
188     RS_SCRIPT_INTRINSIC_ID_3DLUT = 8,
189     RS_SCRIPT_INTRINSIC_ID_HISTOGRAM = 9,
190     // unused 10, 11
191     RS_SCRIPT_INTRINSIC_ID_RESIZE = 12,
192     RS_SCRIPT_INTRINSIC_ID_BLAS = 13,
193     RS_SCRIPT_INTRINSIC_ID_EXTBLAS = 14,
194     RS_SCRIPT_INTRINSIC_ID_OEM_START = 0x10000000
195 };
196 
197 typedef struct {
198     RsA3DClassID classID;
199     const char* objectName;
200 } RsFileIndexEntry;
201 
202 
203 enum RsThreadPriorities {
204     RS_THREAD_PRIORITY_LOW = 15,
205     RS_THREAD_PRIORITY_NORMAL_GRAPHICS = -8,
206     RS_THREAD_PRIORITY_NORMAL = -1,
207     RS_THREAD_PRIORITY_LOW_LATENCY = -4
208 };
209 
210 
211 // Structure for rs.spec functions
212 
213 typedef struct {
214     RsElement e;
215     uint32_t dimX;
216     uint32_t dimY;
217     uint32_t dimZ;
218     bool mipmaps;
219     bool faces;
220     uint32_t yuv;
221     uint32_t array0;
222     uint32_t array1;
223     uint32_t array2;
224     uint32_t array3;
225 } RsTypeCreateParams;
226 
227 
228 
229 #ifdef __cplusplus
230 };
231 #endif
232 
233 #endif // RENDER_SCRIPT_DEFINES_H
234