blob: 1d14f70e87ecd259bd3697cb5b2b694f0ddaeb60 [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//////////////////////////////////////////////////////
28//
29
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;
41typedef void * RsType;
Jason Sams62bc1db2009-06-22 15:49:21 -070042typedef void * RsLight;
Jason Sams326e0dd2009-05-22 14:03:28 -070043
44typedef void * RsProgramVertex;
45typedef void * RsProgramFragment;
46typedef void * RsProgramFragmentStore;
47
48RsDevice rsDeviceCreate();
49void rsDeviceDestroy(RsDevice);
50
51RsContext rsContextCreate(RsDevice, void *, uint32_t version);
52void rsContextDestroy(RsContext);
53
54enum RsDataType {
55 RS_TYPE_FLOAT,
56 RS_TYPE_UNSIGNED,
57 RS_TYPE_SIGNED
58};
59
60enum RsDataKind {
61 RS_KIND_USER,
62 RS_KIND_RED,
63 RS_KIND_GREEN,
64 RS_KIND_BLUE,
65 RS_KIND_ALPHA,
66 RS_KIND_LUMINANCE,
67 RS_KIND_INTENSITY,
68 RS_KIND_X,
69 RS_KIND_Y,
70 RS_KIND_Z,
71 RS_KIND_W,
72 RS_KIND_S,
73 RS_KIND_T,
74 RS_KIND_Q,
75 RS_KIND_R,
76 RS_KIND_NX,
77 RS_KIND_NY,
78 RS_KIND_NZ,
79 RS_KIND_INDEX
80};
81
82enum RsElementPredefined {
83 RS_ELEMENT_USER_U8,
84 RS_ELEMENT_USER_I8,
85 RS_ELEMENT_USER_U16,
86 RS_ELEMENT_USER_I16,
87 RS_ELEMENT_USER_U32,
88 RS_ELEMENT_USER_I32,
89 RS_ELEMENT_USER_FLOAT,
90
Jason Sams52a9f522009-06-01 17:45:53 -070091 RS_ELEMENT_A_8, // 7
92 RS_ELEMENT_RGB_565, // 8
93 RS_ELEMENT_RGBA_5551, // 9
94 RS_ELEMENT_RGBA_4444, // 10
95 RS_ELEMENT_RGB_888, // 11
96 RS_ELEMENT_RGBA_8888, // 12
Jason Sams326e0dd2009-05-22 14:03:28 -070097
Jason Sams52a9f522009-06-01 17:45:53 -070098 RS_ELEMENT_INDEX_16, //13
Jason Sams326e0dd2009-05-22 14:03:28 -070099 RS_ELEMENT_INDEX_32,
100 RS_ELEMENT_XY_F32,
101 RS_ELEMENT_XYZ_F32,
102 RS_ELEMENT_ST_XY_F32,
103 RS_ELEMENT_ST_XYZ_F32,
104 RS_ELEMENT_NORM_XYZ_F32,
105 RS_ELEMENT_NORM_ST_XYZ_F32,
106};
107
108enum RsSamplerParam {
109 RS_SAMPLER_MIN_FILTER,
110 RS_SAMPLER_MAG_FILTER,
111 RS_SAMPLER_WRAP_S,
112 RS_SAMPLER_WRAP_T,
113 RS_SAMPLER_WRAP_R
114};
115
116enum RsSamplerValue {
117 RS_SAMPLER_NEAREST,
118 RS_SAMPLER_LINEAR,
119 RS_SAMPLER_LINEAR_MIP_LINEAR,
120 RS_SAMPLER_WRAP,
121 RS_SAMPLER_CLAMP
122};
123
124enum RsDimension {
125 RS_DIMENSION_X,
126 RS_DIMENSION_Y,
127 RS_DIMENSION_Z,
128 RS_DIMENSION_LOD,
129 RS_DIMENSION_FACE,
130
131 RS_DIMENSION_ARRAY_0 = 100,
132 RS_DIMENSION_ARRAY_1,
133 RS_DIMENSION_ARRAY_2,
134 RS_DIMENSION_ARRAY_3,
135 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
136};
137
138enum RsDepthFunc {
139 RS_DEPTH_FUNC_ALWAYS,
140 RS_DEPTH_FUNC_LESS,
141 RS_DEPTH_FUNC_LEQUAL,
142 RS_DEPTH_FUNC_GREATER,
143 RS_DEPTH_FUNC_GEQUAL,
144 RS_DEPTH_FUNC_EQUAL,
145 RS_DEPTH_FUNC_NOTEQUAL
146};
147
148enum RsBlendSrcFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700149 RS_BLEND_SRC_ZERO, // 0
150 RS_BLEND_SRC_ONE, // 1
151 RS_BLEND_SRC_DST_COLOR, // 2
152 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
153 RS_BLEND_SRC_SRC_ALPHA, // 4
154 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
155 RS_BLEND_SRC_DST_ALPHA, // 6
156 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
157 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Sams326e0dd2009-05-22 14:03:28 -0700158};
159
160enum RsBlendDstFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700161 RS_BLEND_DST_ZERO, // 0
162 RS_BLEND_DST_ONE, // 1
163 RS_BLEND_DST_SRC_COLOR, // 2
164 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
165 RS_BLEND_DST_SRC_ALPHA, // 4
166 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
167 RS_BLEND_DST_DST_ALPHA, // 6
168 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Sams326e0dd2009-05-22 14:03:28 -0700169};
170
171enum RsTexEnvMode {
172 RS_TEX_ENV_MODE_REPLACE,
173 RS_TEX_ENV_MODE_MODULATE,
174 RS_TEX_ENV_MODE_DECAL
175};
176
Jason Samsa89371c2009-06-30 14:13:04 -0700177enum RsPrimitive {
178 RS_PRIMITIVE_POINT,
179 RS_PRIMITIVE_LINE,
180 RS_PRIMITIVE_LINE_STRIP,
181 RS_PRIMITIVE_TRIANGLE,
182 RS_PRIMITIVE_TRIANGLE_STRIP,
183 RS_PRIMITIVE_TRIANGLE_FAN
184};
Jason Sams326e0dd2009-05-22 14:03:28 -0700185
186
187#include "rsgApiFuncDecl.h"
188
189#ifdef __cplusplus
190};
191#endif
192
193#endif // RENDER_SCRIPT_H
194
195
196