blob: 87a2f4a8f6ec9df1c21103b653a0bb6e84276969 [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;
Jason Sams1bada8c2009-08-09 17:01:55 -070040typedef void * RsSimpleMesh;
Jason Samsd19f10d2009-05-22 14:03:28 -070041typedef void * RsType;
Jason Samsbba134c2009-06-22 15:49:21 -070042typedef void * RsLight;
Jason Samsd19f10d2009-05-22 14:03:28 -070043
44typedef 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 Samsb13ada52009-08-25 11:34:49 -070058RsContext rsContextCreate(RsDevice, void *, 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 Sams1bada8c2009-08-09 17:01:55 -070062#define RS_MAX_TEXTURE 2
63
Jason Samsd19f10d2009-05-22 14:03:28 -070064enum RsDataType {
65 RS_TYPE_FLOAT,
66 RS_TYPE_UNSIGNED,
67 RS_TYPE_SIGNED
68};
69
70enum RsDataKind {
71 RS_KIND_USER,
Jason Sams1bada8c2009-08-09 17:01:55 -070072 RS_KIND_RED,
73 RS_KIND_GREEN,
74 RS_KIND_BLUE,
75 RS_KIND_ALPHA,
76 RS_KIND_LUMINANCE,
Jason Samsd19f10d2009-05-22 14:03:28 -070077 RS_KIND_INTENSITY,
Jason Sams1bada8c2009-08-09 17:01:55 -070078 RS_KIND_X,
79 RS_KIND_Y,
80 RS_KIND_Z,
Jason Samsd19f10d2009-05-22 14:03:28 -070081 RS_KIND_W,
Jason Sams1bada8c2009-08-09 17:01:55 -070082 RS_KIND_S,
83 RS_KIND_T,
84 RS_KIND_Q,
Jason Samsd19f10d2009-05-22 14:03:28 -070085 RS_KIND_R,
Jason Sams1bada8c2009-08-09 17:01:55 -070086 RS_KIND_NX,
87 RS_KIND_NY,
Jason Samsd19f10d2009-05-22 14:03:28 -070088 RS_KIND_NZ,
Jason Sams25ffcdc2009-08-20 16:10:36 -070089 RS_KIND_INDEX,
90 RS_KIND_POINT_SIZE
Jason Samsd19f10d2009-05-22 14:03:28 -070091};
92
Jason Samsd19f10d2009-05-22 14:03:28 -070093enum RsSamplerParam {
94 RS_SAMPLER_MIN_FILTER,
95 RS_SAMPLER_MAG_FILTER,
96 RS_SAMPLER_WRAP_S,
97 RS_SAMPLER_WRAP_T,
98 RS_SAMPLER_WRAP_R
Jason Sams1bada8c2009-08-09 17:01:55 -070099};
Jason Samsd19f10d2009-05-22 14:03:28 -0700100
101enum RsSamplerValue {
102 RS_SAMPLER_NEAREST,
103 RS_SAMPLER_LINEAR,
104 RS_SAMPLER_LINEAR_MIP_LINEAR,
105 RS_SAMPLER_WRAP,
106 RS_SAMPLER_CLAMP
Jason Sams1bada8c2009-08-09 17:01:55 -0700107};
Jason Samsd19f10d2009-05-22 14:03:28 -0700108
109enum RsDimension {
110 RS_DIMENSION_X,
111 RS_DIMENSION_Y,
112 RS_DIMENSION_Z,
113 RS_DIMENSION_LOD,
114 RS_DIMENSION_FACE,
115
Jason Sams1bada8c2009-08-09 17:01:55 -0700116 RS_DIMENSION_ARRAY_0 = 100,
117 RS_DIMENSION_ARRAY_1,
118 RS_DIMENSION_ARRAY_2,
Jason Samsd19f10d2009-05-22 14:03:28 -0700119 RS_DIMENSION_ARRAY_3,
120 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
121};
122
123enum RsDepthFunc {
124 RS_DEPTH_FUNC_ALWAYS,
125 RS_DEPTH_FUNC_LESS,
126 RS_DEPTH_FUNC_LEQUAL,
127 RS_DEPTH_FUNC_GREATER,
128 RS_DEPTH_FUNC_GEQUAL,
129 RS_DEPTH_FUNC_EQUAL,
130 RS_DEPTH_FUNC_NOTEQUAL
131};
132
133enum RsBlendSrcFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700134 RS_BLEND_SRC_ZERO, // 0
135 RS_BLEND_SRC_ONE, // 1
136 RS_BLEND_SRC_DST_COLOR, // 2
137 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
138 RS_BLEND_SRC_SRC_ALPHA, // 4
139 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
140 RS_BLEND_SRC_DST_ALPHA, // 6
141 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
142 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Samsd19f10d2009-05-22 14:03:28 -0700143};
144
145enum RsBlendDstFunc {
Jason Samsb0ec1b42009-07-28 12:02:16 -0700146 RS_BLEND_DST_ZERO, // 0
147 RS_BLEND_DST_ONE, // 1
148 RS_BLEND_DST_SRC_COLOR, // 2
149 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
150 RS_BLEND_DST_SRC_ALPHA, // 4
151 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
152 RS_BLEND_DST_DST_ALPHA, // 6
153 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Samsd19f10d2009-05-22 14:03:28 -0700154};
155
156enum RsTexEnvMode {
157 RS_TEX_ENV_MODE_REPLACE,
158 RS_TEX_ENV_MODE_MODULATE,
159 RS_TEX_ENV_MODE_DECAL
160};
161
Jason Sams7c878f32009-06-30 14:13:04 -0700162enum RsPrimitive {
163 RS_PRIMITIVE_POINT,
164 RS_PRIMITIVE_LINE,
165 RS_PRIMITIVE_LINE_STRIP,
166 RS_PRIMITIVE_TRIANGLE,
167 RS_PRIMITIVE_TRIANGLE_STRIP,
168 RS_PRIMITIVE_TRIANGLE_FAN
169};
Jason Samsd19f10d2009-05-22 14:03:28 -0700170
171
172#include "rsgApiFuncDecl.h"
173
174#ifdef __cplusplus
175};
176#endif
177
178#endif // RENDER_SCRIPT_H
179
180
181