blob: e4cf00f0d4fc3f4cf825e70f39371dd2d8f13e85 [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
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
24extern "C" {
25#endif
26
27//////////////////////////////////////////////////////
Jason Sams1bada8c2009-08-09 17:01:55 -070028//
Jason Samsd19f10d2009-05-22 14:03:28 -070029
30typedef void * RsAdapter1D;
31typedef void * RsAdapter2D;
32typedef void * RsAllocation;
33typedef void * RsContext;
34typedef void * RsDevice;
35typedef void * RsElement;
Jason Sams64676f32009-07-08 18:01:53 -070036typedef void * RsFile;
Jason Samsd19f10d2009-05-22 14:03:28 -070037typedef void * RsSampler;
38typedef void * RsScript;
39typedef void * RsScriptBasicTemp;
40typedef void * RsTriangleMesh;
Jason Sams1bada8c2009-08-09 17:01:55 -070041typedef void * RsSimpleMesh;
Jason Samsd19f10d2009-05-22 14:03:28 -070042typedef void * RsType;
Jason Samsbba134c2009-06-22 15:49:21 -070043typedef void * RsLight;
Jason Samsd19f10d2009-05-22 14:03:28 -070044
45typedef void * RsProgramVertex;
46typedef void * RsProgramFragment;
47typedef void * RsProgramFragmentStore;
48
49RsDevice rsDeviceCreate();
50void rsDeviceDestroy(RsDevice);
51
52RsContext rsContextCreate(RsDevice, void *, uint32_t version);
53void rsContextDestroy(RsContext);
Jason Sams730ee652009-08-18 17:07:09 -070054void rsObjDestroyOOB(RsContext, void *);
Jason Samsd19f10d2009-05-22 14:03:28 -070055
Jason Sams1bada8c2009-08-09 17:01:55 -070056#define RS_MAX_TEXTURE 2
57
Jason Samsd19f10d2009-05-22 14:03:28 -070058enum RsDataType {
59 RS_TYPE_FLOAT,
60 RS_TYPE_UNSIGNED,
61 RS_TYPE_SIGNED
62};
63
64enum RsDataKind {
65 RS_KIND_USER,
Jason Sams1bada8c2009-08-09 17:01:55 -070066 RS_KIND_RED,
67 RS_KIND_GREEN,
68 RS_KIND_BLUE,
69 RS_KIND_ALPHA,
70 RS_KIND_LUMINANCE,
Jason Samsd19f10d2009-05-22 14:03:28 -070071 RS_KIND_INTENSITY,
Jason Sams1bada8c2009-08-09 17:01:55 -070072 RS_KIND_X,
73 RS_KIND_Y,
74 RS_KIND_Z,
Jason Samsd19f10d2009-05-22 14:03:28 -070075 RS_KIND_W,
Jason Sams1bada8c2009-08-09 17:01:55 -070076 RS_KIND_S,
77 RS_KIND_T,
78 RS_KIND_Q,
Jason Samsd19f10d2009-05-22 14:03:28 -070079 RS_KIND_R,
Jason Sams1bada8c2009-08-09 17:01:55 -070080 RS_KIND_NX,
81 RS_KIND_NY,
Jason Samsd19f10d2009-05-22 14:03:28 -070082 RS_KIND_NZ,
83 RS_KIND_INDEX
84};
85
86enum RsElementPredefined {
87 RS_ELEMENT_USER_U8,
88 RS_ELEMENT_USER_I8,
89 RS_ELEMENT_USER_U16,
90 RS_ELEMENT_USER_I16,
91 RS_ELEMENT_USER_U32,
92 RS_ELEMENT_USER_I32,
Jason Sams1bada8c2009-08-09 17:01:55 -070093 RS_ELEMENT_USER_FLOAT,
Jason Samsd19f10d2009-05-22 14:03:28 -070094
Jason Samsffe9f482009-06-01 17:45:53 -070095 RS_ELEMENT_A_8, // 7
96 RS_ELEMENT_RGB_565, // 8
97 RS_ELEMENT_RGBA_5551, // 9
98 RS_ELEMENT_RGBA_4444, // 10
99 RS_ELEMENT_RGB_888, // 11
100 RS_ELEMENT_RGBA_8888, // 12
Jason Samsd19f10d2009-05-22 14:03:28 -0700101
Jason Samsffe9f482009-06-01 17:45:53 -0700102 RS_ELEMENT_INDEX_16, //13
Jason Sams1bada8c2009-08-09 17:01:55 -0700103 RS_ELEMENT_INDEX_32,
104 RS_ELEMENT_XY_F32,
105 RS_ELEMENT_XYZ_F32,
106 RS_ELEMENT_ST_XY_F32,
107 RS_ELEMENT_ST_XYZ_F32,
Jason Samsd19f10d2009-05-22 14:03:28 -0700108 RS_ELEMENT_NORM_XYZ_F32,
109 RS_ELEMENT_NORM_ST_XYZ_F32,
Jason Sams1bada8c2009-08-09 17:01:55 -0700110};
Jason Samsd19f10d2009-05-22 14:03:28 -0700111
112enum RsSamplerParam {
113 RS_SAMPLER_MIN_FILTER,
114 RS_SAMPLER_MAG_FILTER,
115 RS_SAMPLER_WRAP_S,
116 RS_SAMPLER_WRAP_T,
117 RS_SAMPLER_WRAP_R
Jason Sams1bada8c2009-08-09 17:01:55 -0700118};
Jason Samsd19f10d2009-05-22 14:03:28 -0700119
120enum RsSamplerValue {
121 RS_SAMPLER_NEAREST,
122 RS_SAMPLER_LINEAR,
123 RS_SAMPLER_LINEAR_MIP_LINEAR,
124 RS_SAMPLER_WRAP,
125 RS_SAMPLER_CLAMP
Jason Sams1bada8c2009-08-09 17:01:55 -0700126};
Jason Samsd19f10d2009-05-22 14:03:28 -0700127
128enum RsDimension {
129 RS_DIMENSION_X,
130 RS_DIMENSION_Y,
131 RS_DIMENSION_Z,
132 RS_DIMENSION_LOD,
133 RS_DIMENSION_FACE,
134
Jason Sams1bada8c2009-08-09 17:01:55 -0700135 RS_DIMENSION_ARRAY_0 = 100,
136 RS_DIMENSION_ARRAY_1,
137 RS_DIMENSION_ARRAY_2,
Jason Samsd19f10d2009-05-22 14:03:28 -0700138 RS_DIMENSION_ARRAY_3,
139 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
140};
141
142enum RsDepthFunc {
143 RS_DEPTH_FUNC_ALWAYS,
144 RS_DEPTH_FUNC_LESS,
145 RS_DEPTH_FUNC_LEQUAL,
146 RS_DEPTH_FUNC_GREATER,
147 RS_DEPTH_FUNC_GEQUAL,
148 RS_DEPTH_FUNC_EQUAL,
149 RS_DEPTH_FUNC_NOTEQUAL
150};
151
152enum RsBlendSrcFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700153 RS_BLEND_SRC_ZERO, // 0
154 RS_BLEND_SRC_ONE, // 1
155 RS_BLEND_SRC_DST_COLOR, // 2
156 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
157 RS_BLEND_SRC_SRC_ALPHA, // 4
158 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
159 RS_BLEND_SRC_DST_ALPHA, // 6
160 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
161 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Samsd19f10d2009-05-22 14:03:28 -0700162};
163
164enum RsBlendDstFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700165 RS_BLEND_DST_ZERO, // 0
166 RS_BLEND_DST_ONE, // 1
167 RS_BLEND_DST_SRC_COLOR, // 2
168 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
169 RS_BLEND_DST_SRC_ALPHA, // 4
170 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
171 RS_BLEND_DST_DST_ALPHA, // 6
172 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Samsd19f10d2009-05-22 14:03:28 -0700173};
174
175enum RsTexEnvMode {
176 RS_TEX_ENV_MODE_REPLACE,
177 RS_TEX_ENV_MODE_MODULATE,
178 RS_TEX_ENV_MODE_DECAL
179};
180
Jason Sams7c878f32009-06-30 14:13:04 -0700181enum RsPrimitive {
182 RS_PRIMITIVE_POINT,
183 RS_PRIMITIVE_LINE,
184 RS_PRIMITIVE_LINE_STRIP,
185 RS_PRIMITIVE_TRIANGLE,
186 RS_PRIMITIVE_TRIANGLE_STRIP,
187 RS_PRIMITIVE_TRIANGLE_FAN
188};
Jason Samsd19f10d2009-05-22 14:03:28 -0700189
190
191#include "rsgApiFuncDecl.h"
192
193#ifdef __cplusplus
194};
195#endif
196
197#endif // RENDER_SCRIPT_H
198
199
200