blob: 6662333d7420d910ffa4c2893532bed6cf55896b [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;
Jason Sams1bada8c2009-08-09 17:01:55 -070039typedef void * RsSimpleMesh;
Jason Samsd19f10d2009-05-22 14:03:28 -070040typedef void * RsType;
Jason Samsbba134c2009-06-22 15:49:21 -070041typedef void * RsLight;
Jason Samsd19f10d2009-05-22 14:03:28 -070042
Jason Sams0011bcf2009-12-15 12:58:36 -080043typedef void * RsProgram;
Jason Samsd19f10d2009-05-22 14:03:28 -070044typedef void * RsProgramVertex;
45typedef void * RsProgramFragment;
46typedef void * RsProgramFragmentStore;
Jason Samsebfb4362009-09-23 13:57:02 -070047typedef void * RsProgramRaster;
48
49enum RsDeviceParam {
50 RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
51 RS_DEVICE_PARAM_COUNT
52};
Jason Samsd19f10d2009-05-22 14:03:28 -070053
54RsDevice rsDeviceCreate();
55void rsDeviceDestroy(RsDevice);
Jason Samsebfb4362009-09-23 13:57:02 -070056void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value);
Jason Samsd19f10d2009-05-22 14:03:28 -070057
Jason Sams3bc47d42009-11-12 15:10:25 -080058RsContext rsContextCreate(RsDevice, uint32_t version, bool useDepth);
Jason Samsd19f10d2009-05-22 14:03:28 -070059void rsContextDestroy(RsContext);
Jason Sams730ee652009-08-18 17:07:09 -070060void rsObjDestroyOOB(RsContext, void *);
Jason Samsd19f10d2009-05-22 14:03:28 -070061
Jason Sams516c3192009-10-06 13:58:47 -070062uint32_t rsContextGetMessage(RsContext, void *data, size_t *receiveLen, size_t bufferLen, bool wait);
63void rsContextInitToClient(RsContext);
64void rsContextDeinitToClient(RsContext);
65
Jason Sams1bada8c2009-08-09 17:01:55 -070066#define RS_MAX_TEXTURE 2
Jason Samsa09a6e12010-01-06 11:57:52 -080067#define RS_MAX_ATTRIBS 16
Jason Sams1bada8c2009-08-09 17:01:55 -070068
Jason Samsd19f10d2009-05-22 14:03:28 -070069enum RsDataType {
Jason Sams718cd1f2009-12-23 14:35:29 -080070 RS_TYPE_NONE,
71 RS_TYPE_FLOAT_16,
72 RS_TYPE_FLOAT_32,
73 RS_TYPE_FLOAT_64,
74 RS_TYPE_SIGNED_8,
75 RS_TYPE_SIGNED_16,
76 RS_TYPE_SIGNED_32,
77 RS_TYPE_SIGNED_64,
78 RS_TYPE_UNSIGNED_8,
79 RS_TYPE_UNSIGNED_16,
80 RS_TYPE_UNSIGNED_32,
81 RS_TYPE_UNSIGNED_64,
82
83 RS_TYPE_UNSIGNED_5_6_5,
84 RS_TYPE_UNSIGNED_5_5_5_1,
85 RS_TYPE_UNSIGNED_4_4_4_4,
86
87 RS_TYPE_ELEMENT,
88 RS_TYPE_TYPE,
89 RS_TYPE_ALLOCATION,
90 RS_TYPE_SAMPLER,
91 RS_TYPE_SCRIPT,
92 RS_TYPE_MESH,
93 RS_TYPE_PROGRAM_FRAGMENT,
94 RS_TYPE_PROGRAM_VERTEX,
95 RS_TYPE_PROGRAM_RASTER,
96 RS_TYPE_PROGRAM_STORE
Jason Samsd19f10d2009-05-22 14:03:28 -070097};
98
99enum RsDataKind {
100 RS_KIND_USER,
Jason Sams718cd1f2009-12-23 14:35:29 -0800101 RS_KIND_COLOR,
102 RS_KIND_POSITION,
103 RS_KIND_TEXTURE,
104 RS_KIND_NORMAL,
Jason Sams25ffcdc2009-08-20 16:10:36 -0700105 RS_KIND_INDEX,
Jason Sams718cd1f2009-12-23 14:35:29 -0800106 RS_KIND_POINT_SIZE,
107
108 RS_KIND_PIXEL_L,
109 RS_KIND_PIXEL_A,
110 RS_KIND_PIXEL_LA,
111 RS_KIND_PIXEL_RGB,
112 RS_KIND_PIXEL_RGBA,
113
Jason Samsd19f10d2009-05-22 14:03:28 -0700114};
115
Jason Samsd19f10d2009-05-22 14:03:28 -0700116enum RsSamplerParam {
117 RS_SAMPLER_MIN_FILTER,
118 RS_SAMPLER_MAG_FILTER,
119 RS_SAMPLER_WRAP_S,
120 RS_SAMPLER_WRAP_T,
121 RS_SAMPLER_WRAP_R
Jason Sams1bada8c2009-08-09 17:01:55 -0700122};
Jason Samsd19f10d2009-05-22 14:03:28 -0700123
124enum RsSamplerValue {
125 RS_SAMPLER_NEAREST,
126 RS_SAMPLER_LINEAR,
127 RS_SAMPLER_LINEAR_MIP_LINEAR,
128 RS_SAMPLER_WRAP,
129 RS_SAMPLER_CLAMP
Jason Sams1bada8c2009-08-09 17:01:55 -0700130};
Jason Samsd19f10d2009-05-22 14:03:28 -0700131
132enum RsDimension {
133 RS_DIMENSION_X,
134 RS_DIMENSION_Y,
135 RS_DIMENSION_Z,
136 RS_DIMENSION_LOD,
137 RS_DIMENSION_FACE,
138
Jason Sams1bada8c2009-08-09 17:01:55 -0700139 RS_DIMENSION_ARRAY_0 = 100,
140 RS_DIMENSION_ARRAY_1,
141 RS_DIMENSION_ARRAY_2,
Jason Samsd19f10d2009-05-22 14:03:28 -0700142 RS_DIMENSION_ARRAY_3,
143 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
144};
145
146enum RsDepthFunc {
147 RS_DEPTH_FUNC_ALWAYS,
148 RS_DEPTH_FUNC_LESS,
149 RS_DEPTH_FUNC_LEQUAL,
150 RS_DEPTH_FUNC_GREATER,
151 RS_DEPTH_FUNC_GEQUAL,
152 RS_DEPTH_FUNC_EQUAL,
153 RS_DEPTH_FUNC_NOTEQUAL
154};
155
156enum RsBlendSrcFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700157 RS_BLEND_SRC_ZERO, // 0
158 RS_BLEND_SRC_ONE, // 1
159 RS_BLEND_SRC_DST_COLOR, // 2
160 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
161 RS_BLEND_SRC_SRC_ALPHA, // 4
162 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
163 RS_BLEND_SRC_DST_ALPHA, // 6
164 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
165 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Samsd19f10d2009-05-22 14:03:28 -0700166};
167
168enum RsBlendDstFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700169 RS_BLEND_DST_ZERO, // 0
170 RS_BLEND_DST_ONE, // 1
171 RS_BLEND_DST_SRC_COLOR, // 2
172 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
173 RS_BLEND_DST_SRC_ALPHA, // 4
174 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
175 RS_BLEND_DST_DST_ALPHA, // 6
176 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Samsd19f10d2009-05-22 14:03:28 -0700177};
178
179enum RsTexEnvMode {
Jason Sams68afd012009-12-17 16:55:08 -0800180 RS_TEX_ENV_MODE_NONE,
Jason Samsd19f10d2009-05-22 14:03:28 -0700181 RS_TEX_ENV_MODE_REPLACE,
182 RS_TEX_ENV_MODE_MODULATE,
183 RS_TEX_ENV_MODE_DECAL
184};
185
Jason Sams0011bcf2009-12-15 12:58:36 -0800186enum RsProgramParam {
187 RS_PROGRAM_PARAM_INPUT,
188 RS_PROGRAM_PARAM_OUTPUT,
189 RS_PROGRAM_PARAM_CONSTANT,
Jason Sams7e5ab3b2009-12-15 13:27:04 -0800190 RS_PROGRAM_PARAM_TEXTURE_COUNT,
Jason Sams0011bcf2009-12-15 12:58:36 -0800191};
192
Jason Sams7c878f32009-06-30 14:13:04 -0700193enum RsPrimitive {
194 RS_PRIMITIVE_POINT,
195 RS_PRIMITIVE_LINE,
196 RS_PRIMITIVE_LINE_STRIP,
197 RS_PRIMITIVE_TRIANGLE,
198 RS_PRIMITIVE_TRIANGLE_STRIP,
199 RS_PRIMITIVE_TRIANGLE_FAN
200};
Jason Samsd19f10d2009-05-22 14:03:28 -0700201
202
203#include "rsgApiFuncDecl.h"
204
205#ifdef __cplusplus
206};
207#endif
208
209#endif // RENDER_SCRIPT_H
210
211
212