blob: 44ff9019056d834f777d9dfdd5b9e941a3e63e80 [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
67
Jason Samsd19f10d2009-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 Sams1bada8c2009-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 Samsd19f10d2009-05-22 14:03:28 -070081 RS_KIND_INTENSITY,
Jason Sams1bada8c2009-08-09 17:01:55 -070082 RS_KIND_X,
83 RS_KIND_Y,
84 RS_KIND_Z,
Jason Samsd19f10d2009-05-22 14:03:28 -070085 RS_KIND_W,
Jason Sams1bada8c2009-08-09 17:01:55 -070086 RS_KIND_S,
87 RS_KIND_T,
88 RS_KIND_Q,
Jason Samsd19f10d2009-05-22 14:03:28 -070089 RS_KIND_R,
Jason Sams1bada8c2009-08-09 17:01:55 -070090 RS_KIND_NX,
91 RS_KIND_NY,
Jason Samsd19f10d2009-05-22 14:03:28 -070092 RS_KIND_NZ,
Jason Sams25ffcdc2009-08-20 16:10:36 -070093 RS_KIND_INDEX,
94 RS_KIND_POINT_SIZE
Jason Samsd19f10d2009-05-22 14:03:28 -070095};
96
Jason Samsd19f10d2009-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 Sams1bada8c2009-08-09 17:01:55 -0700103};
Jason Samsd19f10d2009-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 Sams1bada8c2009-08-09 17:01:55 -0700111};
Jason Samsd19f10d2009-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 Sams1bada8c2009-08-09 17:01:55 -0700120 RS_DIMENSION_ARRAY_0 = 100,
121 RS_DIMENSION_ARRAY_1,
122 RS_DIMENSION_ARRAY_2,
Jason Samsd19f10d2009-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 Samsb0ec1b42009-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 Samsd19f10d2009-05-22 14:03:28 -0700147};
148
149enum RsBlendDstFunc {
Jason Samsb0ec1b42009-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 Samsd19f10d2009-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 Sams0011bcf2009-12-15 12:58:36 -0800166enum RsProgramParam {
167 RS_PROGRAM_PARAM_INPUT,
168 RS_PROGRAM_PARAM_OUTPUT,
169 RS_PROGRAM_PARAM_CONSTANT,
Jason Sams7e5ab3b2009-12-15 13:27:04 -0800170 RS_PROGRAM_PARAM_TEXTURE_COUNT,
Jason Sams0011bcf2009-12-15 12:58:36 -0800171};
172
Jason Sams7c878f32009-06-30 14:13:04 -0700173enum RsPrimitive {
174 RS_PRIMITIVE_POINT,
175 RS_PRIMITIVE_LINE,
176 RS_PRIMITIVE_LINE_STRIP,
177 RS_PRIMITIVE_TRIANGLE,
178 RS_PRIMITIVE_TRIANGLE_STRIP,
179 RS_PRIMITIVE_TRIANGLE_FAN
180};
Jason Samsd19f10d2009-05-22 14:03:28 -0700181
182
183#include "rsgApiFuncDecl.h"
184
185#ifdef __cplusplus
186};
187#endif
188
189#endif // RENDER_SCRIPT_H
190
191
192