blob: 9b043930d5207d45ede7cc8d1468c6270d93f6c0 [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;
Jason Samse5ffb872009-08-09 17:01:55 -070040typedef void * RsSimpleMesh;
Jason Sams326e0dd2009-05-22 14:03:28 -070041typedef 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;
Jason Sams5fd09d82009-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 Sams326e0dd2009-05-22 14:03:28 -070053
54RsDevice rsDeviceCreate();
55void rsDeviceDestroy(RsDevice);
Jason Sams5fd09d82009-09-23 13:57:02 -070056void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value);
Jason Sams326e0dd2009-05-22 14:03:28 -070057
Jason Samsafcb25c2009-08-25 11:34:49 -070058RsContext rsContextCreate(RsDevice, void *, uint32_t version, bool useDepth);
Jason Sams326e0dd2009-05-22 14:03:28 -070059void rsContextDestroy(RsContext);
Jason Sams50869382009-08-18 17:07:09 -070060void rsObjDestroyOOB(RsContext, void *);
Jason Sams326e0dd2009-05-22 14:03:28 -070061
Jason Sams8c401ef2009-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 Samse5ffb872009-08-09 17:01:55 -070066#define RS_MAX_TEXTURE 2
67
Jason Sams326e0dd2009-05-22 14:03:28 -070068enum RsDataType {
69 RS_TYPE_FLOAT,
70 RS_TYPE_UNSIGNED,
71 RS_TYPE_SIGNED
72};
73
74enum RsDataKind {
75 RS_KIND_USER,
Jason Samse5ffb872009-08-09 17:01:55 -070076 RS_KIND_RED,
77 RS_KIND_GREEN,
78 RS_KIND_BLUE,
79 RS_KIND_ALPHA,
80 RS_KIND_LUMINANCE,
Jason Sams326e0dd2009-05-22 14:03:28 -070081 RS_KIND_INTENSITY,
Jason Samse5ffb872009-08-09 17:01:55 -070082 RS_KIND_X,
83 RS_KIND_Y,
84 RS_KIND_Z,
Jason Sams326e0dd2009-05-22 14:03:28 -070085 RS_KIND_W,
Jason Samse5ffb872009-08-09 17:01:55 -070086 RS_KIND_S,
87 RS_KIND_T,
88 RS_KIND_Q,
Jason Sams326e0dd2009-05-22 14:03:28 -070089 RS_KIND_R,
Jason Samse5ffb872009-08-09 17:01:55 -070090 RS_KIND_NX,
91 RS_KIND_NY,
Jason Sams326e0dd2009-05-22 14:03:28 -070092 RS_KIND_NZ,
Jason Samse0158412009-08-20 16:10:36 -070093 RS_KIND_INDEX,
94 RS_KIND_POINT_SIZE
Jason Sams326e0dd2009-05-22 14:03:28 -070095};
96
Jason Sams326e0dd2009-05-22 14:03:28 -070097enum RsSamplerParam {
98 RS_SAMPLER_MIN_FILTER,
99 RS_SAMPLER_MAG_FILTER,
100 RS_SAMPLER_WRAP_S,
101 RS_SAMPLER_WRAP_T,
102 RS_SAMPLER_WRAP_R
Jason Samse5ffb872009-08-09 17:01:55 -0700103};
Jason Sams326e0dd2009-05-22 14:03:28 -0700104
105enum RsSamplerValue {
106 RS_SAMPLER_NEAREST,
107 RS_SAMPLER_LINEAR,
108 RS_SAMPLER_LINEAR_MIP_LINEAR,
109 RS_SAMPLER_WRAP,
110 RS_SAMPLER_CLAMP
Jason Samse5ffb872009-08-09 17:01:55 -0700111};
Jason Sams326e0dd2009-05-22 14:03:28 -0700112
113enum RsDimension {
114 RS_DIMENSION_X,
115 RS_DIMENSION_Y,
116 RS_DIMENSION_Z,
117 RS_DIMENSION_LOD,
118 RS_DIMENSION_FACE,
119
Jason Samse5ffb872009-08-09 17:01:55 -0700120 RS_DIMENSION_ARRAY_0 = 100,
121 RS_DIMENSION_ARRAY_1,
122 RS_DIMENSION_ARRAY_2,
Jason Sams326e0dd2009-05-22 14:03:28 -0700123 RS_DIMENSION_ARRAY_3,
124 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
125};
126
127enum RsDepthFunc {
128 RS_DEPTH_FUNC_ALWAYS,
129 RS_DEPTH_FUNC_LESS,
130 RS_DEPTH_FUNC_LEQUAL,
131 RS_DEPTH_FUNC_GREATER,
132 RS_DEPTH_FUNC_GEQUAL,
133 RS_DEPTH_FUNC_EQUAL,
134 RS_DEPTH_FUNC_NOTEQUAL
135};
136
137enum RsBlendSrcFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700138 RS_BLEND_SRC_ZERO, // 0
139 RS_BLEND_SRC_ONE, // 1
140 RS_BLEND_SRC_DST_COLOR, // 2
141 RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
142 RS_BLEND_SRC_SRC_ALPHA, // 4
143 RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
144 RS_BLEND_SRC_DST_ALPHA, // 6
145 RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
146 RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
Jason Sams326e0dd2009-05-22 14:03:28 -0700147};
148
149enum RsBlendDstFunc {
Jason Samsc9d43db2009-07-28 12:02:16 -0700150 RS_BLEND_DST_ZERO, // 0
151 RS_BLEND_DST_ONE, // 1
152 RS_BLEND_DST_SRC_COLOR, // 2
153 RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
154 RS_BLEND_DST_SRC_ALPHA, // 4
155 RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
156 RS_BLEND_DST_DST_ALPHA, // 6
157 RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
Jason Sams326e0dd2009-05-22 14:03:28 -0700158};
159
160enum RsTexEnvMode {
161 RS_TEX_ENV_MODE_REPLACE,
162 RS_TEX_ENV_MODE_MODULATE,
163 RS_TEX_ENV_MODE_DECAL
164};
165
Jason Samsa89371c2009-06-30 14:13:04 -0700166enum RsPrimitive {
167 RS_PRIMITIVE_POINT,
168 RS_PRIMITIVE_LINE,
169 RS_PRIMITIVE_LINE_STRIP,
170 RS_PRIMITIVE_TRIANGLE,
171 RS_PRIMITIVE_TRIANGLE_STRIP,
172 RS_PRIMITIVE_TRIANGLE_FAN
173};
Jason Sams326e0dd2009-05-22 14:03:28 -0700174
175
176#include "rsgApiFuncDecl.h"
177
178#ifdef __cplusplus
179};
180#endif
181
182#endif // RENDER_SCRIPT_H
183
184
185