blob: 2f60c9fe77f3960de94aac53893de1f15be40d50 [file] [log] [blame]
Jason Sams326e0dd2009-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 Samse5ffb872009-08-09 17:01:55 -070028//
Jason Sams326e0dd2009-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 Samsa5597fc2009-07-08 18:01:53 -070036typedef void * RsFile;
Jason Sams326e0dd2009-05-22 14:03:28 -070037typedef void * RsSampler;
38typedef void * RsScript;
39typedef void * RsScriptBasicTemp;
40typedef void * RsTriangleMesh;
Jason Samse5ffb872009-08-09 17:01:55 -070041typedef void * RsSimpleMesh;
Jason Sams326e0dd2009-05-22 14:03:28 -070042typedef void * RsType;
Jason Sams62bc1db2009-06-22 15:49:21 -070043typedef void * RsLight;
Jason Sams326e0dd2009-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 Sams50869382009-08-18 17:07:09 -070054void rsObjDestroyOOB(RsContext, void *);
Jason Sams326e0dd2009-05-22 14:03:28 -070055
Jason Samse5ffb872009-08-09 17:01:55 -070056#define RS_MAX_TEXTURE 2
57
Jason Sams326e0dd2009-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 Samse5ffb872009-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 Sams326e0dd2009-05-22 14:03:28 -070071 RS_KIND_INTENSITY,
Jason Samse5ffb872009-08-09 17:01:55 -070072 RS_KIND_X,
73 RS_KIND_Y,
74 RS_KIND_Z,
Jason Sams326e0dd2009-05-22 14:03:28 -070075 RS_KIND_W,
Jason Samse5ffb872009-08-09 17:01:55 -070076 RS_KIND_S,
77 RS_KIND_T,
78 RS_KIND_Q,
Jason Sams326e0dd2009-05-22 14:03:28 -070079 RS_KIND_R,
Jason Samse5ffb872009-08-09 17:01:55 -070080 RS_KIND_NX,
81 RS_KIND_NY,
Jason Sams326e0dd2009-05-22 14:03:28 -070082 RS_KIND_NZ,
Jason Samse0158412009-08-20 16:10:36 -070083 RS_KIND_INDEX,
84 RS_KIND_POINT_SIZE
Jason Sams326e0dd2009-05-22 14:03:28 -070085};
86
87enum RsElementPredefined {
88 RS_ELEMENT_USER_U8,
89 RS_ELEMENT_USER_I8,
90 RS_ELEMENT_USER_U16,
91 RS_ELEMENT_USER_I16,
92 RS_ELEMENT_USER_U32,
93 RS_ELEMENT_USER_I32,
Jason Samse5ffb872009-08-09 17:01:55 -070094 RS_ELEMENT_USER_FLOAT,
Jason Sams326e0dd2009-05-22 14:03:28 -070095
Jason Sams52a9f522009-06-01 17:45:53 -070096 RS_ELEMENT_A_8, // 7
97 RS_ELEMENT_RGB_565, // 8
98 RS_ELEMENT_RGBA_5551, // 9
99 RS_ELEMENT_RGBA_4444, // 10
100 RS_ELEMENT_RGB_888, // 11
101 RS_ELEMENT_RGBA_8888, // 12
Jason Sams326e0dd2009-05-22 14:03:28 -0700102
Jason Sams52a9f522009-06-01 17:45:53 -0700103 RS_ELEMENT_INDEX_16, //13
Jason Samse5ffb872009-08-09 17:01:55 -0700104 RS_ELEMENT_INDEX_32,
105 RS_ELEMENT_XY_F32,
106 RS_ELEMENT_XYZ_F32,
107 RS_ELEMENT_ST_XY_F32,
108 RS_ELEMENT_ST_XYZ_F32,
Jason Sams326e0dd2009-05-22 14:03:28 -0700109 RS_ELEMENT_NORM_XYZ_F32,
110 RS_ELEMENT_NORM_ST_XYZ_F32,
Jason Samse5ffb872009-08-09 17:01:55 -0700111};
Jason Sams326e0dd2009-05-22 14:03:28 -0700112
113enum RsSamplerParam {
114 RS_SAMPLER_MIN_FILTER,
115 RS_SAMPLER_MAG_FILTER,
116 RS_SAMPLER_WRAP_S,
117 RS_SAMPLER_WRAP_T,
118 RS_SAMPLER_WRAP_R
Jason Samse5ffb872009-08-09 17:01:55 -0700119};
Jason Sams326e0dd2009-05-22 14:03:28 -0700120
121enum RsSamplerValue {
122 RS_SAMPLER_NEAREST,
123 RS_SAMPLER_LINEAR,
124 RS_SAMPLER_LINEAR_MIP_LINEAR,
125 RS_SAMPLER_WRAP,
126 RS_SAMPLER_CLAMP
Jason Samse5ffb872009-08-09 17:01:55 -0700127};
Jason Sams326e0dd2009-05-22 14:03:28 -0700128
129enum RsDimension {
130 RS_DIMENSION_X,
131 RS_DIMENSION_Y,
132 RS_DIMENSION_Z,
133 RS_DIMENSION_LOD,
134 RS_DIMENSION_FACE,
135
Jason Samse5ffb872009-08-09 17:01:55 -0700136 RS_DIMENSION_ARRAY_0 = 100,
137 RS_DIMENSION_ARRAY_1,
138 RS_DIMENSION_ARRAY_2,
Jason Sams326e0dd2009-05-22 14:03:28 -0700139 RS_DIMENSION_ARRAY_3,
140 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
141};
142
143enum RsDepthFunc {
144 RS_DEPTH_FUNC_ALWAYS,
145 RS_DEPTH_FUNC_LESS,
146 RS_DEPTH_FUNC_LEQUAL,
147 RS_DEPTH_FUNC_GREATER,
148 RS_DEPTH_FUNC_GEQUAL,
149 RS_DEPTH_FUNC_EQUAL,
150 RS_DEPTH_FUNC_NOTEQUAL
151};
152
153enum RsBlendSrcFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700154 RS_BLEND_SRC_ZERO, // 0
155 RS_BLEND_SRC_ONE, // 1
156 RS_BLEND_SRC_DST_COLOR, // 2
157 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
158 RS_BLEND_SRC_SRC_ALPHA, // 4
159 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
160 RS_BLEND_SRC_DST_ALPHA, // 6
161 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
162 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Sams326e0dd2009-05-22 14:03:28 -0700163};
164
165enum RsBlendDstFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700166 RS_BLEND_DST_ZERO, // 0
167 RS_BLEND_DST_ONE, // 1
168 RS_BLEND_DST_SRC_COLOR, // 2
169 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
170 RS_BLEND_DST_SRC_ALPHA, // 4
171 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
172 RS_BLEND_DST_DST_ALPHA, // 6
173 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Sams326e0dd2009-05-22 14:03:28 -0700174};
175
176enum RsTexEnvMode {
177 RS_TEX_ENV_MODE_REPLACE,
178 RS_TEX_ENV_MODE_MODULATE,
179 RS_TEX_ENV_MODE_DECAL
180};
181
Jason Samsa89371c2009-06-30 14:13:04 -0700182enum RsPrimitive {
183 RS_PRIMITIVE_POINT,
184 RS_PRIMITIVE_LINE,
185 RS_PRIMITIVE_LINE_STRIP,
186 RS_PRIMITIVE_TRIANGLE,
187 RS_PRIMITIVE_TRIANGLE_STRIP,
188 RS_PRIMITIVE_TRIANGLE_FAN
189};
Jason Sams326e0dd2009-05-22 14:03:28 -0700190
191
192#include "rsgApiFuncDecl.h"
193
194#ifdef __cplusplus
195};
196#endif
197
198#endif // RENDER_SCRIPT_H
199
200
201