blob: 0a91ea8d4a189aaa67e3c46760843c37f3141584 [file] [log] [blame]
Jason Samsbad80742011-03-16 16:29:28 -07001/*
Jason Samsbc0ca6b2013-02-15 18:13:43 -08002 * Copyright (C) 2013 The Android Open Source Project
Jason Samsbad80742011-03-16 16:29:28 -07003 *
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_DEFINES_H
18#define RENDER_SCRIPT_DEFINES_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 * RsAsyncVoidPtr;
31
32typedef void * RsAdapter1D;
33typedef void * RsAdapter2D;
34typedef void * RsAllocation;
35typedef void * RsAnimation;
36typedef void * RsContext;
37typedef void * RsDevice;
38typedef void * RsElement;
39typedef void * RsFile;
40typedef void * RsFont;
41typedef void * RsSampler;
42typedef void * RsScript;
Jason Samsdbe66d62012-09-17 13:54:41 -070043typedef void * RsScriptKernelID;
44typedef void * RsScriptFieldID;
45typedef void * RsScriptMethodID;
46typedef void * RsScriptGroup;
Jason Samsbad80742011-03-16 16:29:28 -070047typedef void * RsMesh;
Jason Sams9e0afb52011-10-31 13:23:43 -070048typedef void * RsPath;
Jason Samsbad80742011-03-16 16:29:28 -070049typedef void * RsType;
50typedef void * RsObjectBase;
51
52typedef void * RsProgram;
53typedef void * RsProgramVertex;
54typedef void * RsProgramFragment;
55typedef void * RsProgramStore;
56typedef void * RsProgramRaster;
57
Alex Sakhartchouk7257c7e2011-05-17 12:32:47 -070058typedef void * RsNativeWindow;
59
Jason Samsbad80742011-03-16 16:29:28 -070060typedef void (* RsBitmapCallback_t)(void *);
61
Jason Sams87fe59a2011-04-20 15:09:01 -070062typedef struct {
63 float m[16];
64} rs_matrix4x4;
65
66typedef struct {
67 float m[9];
68} rs_matrix3x3;
69
70typedef struct {
71 float m[4];
72} rs_matrix2x2;
73
Jason Samsbad80742011-03-16 16:29:28 -070074enum RsDeviceParam {
75 RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
76 RS_DEVICE_PARAM_COUNT
77};
78
Jason Sams14982c82013-02-22 18:17:05 -080079enum RsContextType {
80 RS_CONTEXT_TYPE_NORMAL,
81 RS_CONTEXT_TYPE_DEBUG,
82 RS_CONTEXT_TYPE_PROFILE
83};
84
Jason Samsbad80742011-03-16 16:29:28 -070085
86enum RsAllocationUsageType {
87 RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
88 RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
89 RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
90 RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070091 RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010,
Jason Sams3522f402012-03-23 11:47:26 -070092 RS_ALLOCATION_USAGE_IO_INPUT = 0x0020,
93 RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040,
Tim Murray9e2bda52012-12-18 12:05:46 -080094 RS_ALLOCATION_USAGE_SHARED = 0x0080,
Jason Samsbad80742011-03-16 16:29:28 -070095
Jason Sams41e373d2012-01-13 14:01:20 -080096 RS_ALLOCATION_USAGE_ALL = 0x00FF
Jason Samsbad80742011-03-16 16:29:28 -070097};
98
99enum RsAllocationMipmapControl {
100 RS_ALLOCATION_MIPMAP_NONE = 0,
101 RS_ALLOCATION_MIPMAP_FULL = 1,
102 RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
103};
104
105enum RsAllocationCubemapFace {
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700106 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
107 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
108 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2,
109 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3,
110 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
111 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
Jason Samsbad80742011-03-16 16:29:28 -0700112};
113
114enum RsDataType {
115 RS_TYPE_NONE,
116 RS_TYPE_FLOAT_16,
117 RS_TYPE_FLOAT_32,
118 RS_TYPE_FLOAT_64,
119 RS_TYPE_SIGNED_8,
120 RS_TYPE_SIGNED_16,
121 RS_TYPE_SIGNED_32,
122 RS_TYPE_SIGNED_64,
123 RS_TYPE_UNSIGNED_8,
124 RS_TYPE_UNSIGNED_16,
125 RS_TYPE_UNSIGNED_32,
126 RS_TYPE_UNSIGNED_64,
127
128 RS_TYPE_BOOLEAN,
129
130 RS_TYPE_UNSIGNED_5_6_5,
131 RS_TYPE_UNSIGNED_5_5_5_1,
132 RS_TYPE_UNSIGNED_4_4_4_4,
133
134 RS_TYPE_MATRIX_4X4,
135 RS_TYPE_MATRIX_3X3,
136 RS_TYPE_MATRIX_2X2,
137
138 RS_TYPE_ELEMENT = 1000,
139 RS_TYPE_TYPE,
140 RS_TYPE_ALLOCATION,
141 RS_TYPE_SAMPLER,
142 RS_TYPE_SCRIPT,
143 RS_TYPE_MESH,
144 RS_TYPE_PROGRAM_FRAGMENT,
145 RS_TYPE_PROGRAM_VERTEX,
146 RS_TYPE_PROGRAM_RASTER,
147 RS_TYPE_PROGRAM_STORE,
Stephen Hinesae8b7952012-04-11 18:09:54 -0700148 RS_TYPE_FONT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800149
150 RS_TYPE_INVALID = 10000,
Jason Samsbad80742011-03-16 16:29:28 -0700151};
152
153enum RsDataKind {
154 RS_KIND_USER,
155
156 RS_KIND_PIXEL_L = 7,
157 RS_KIND_PIXEL_A,
158 RS_KIND_PIXEL_LA,
159 RS_KIND_PIXEL_RGB,
160 RS_KIND_PIXEL_RGBA,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -0700161 RS_KIND_PIXEL_DEPTH,
Jason Samsbc0ca6b2013-02-15 18:13:43 -0800162 RS_KIND_PIXEL_YUV,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800163
164 RS_KIND_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700165};
166
167enum RsSamplerParam {
168 RS_SAMPLER_MIN_FILTER,
169 RS_SAMPLER_MAG_FILTER,
170 RS_SAMPLER_WRAP_S,
171 RS_SAMPLER_WRAP_T,
172 RS_SAMPLER_WRAP_R,
173 RS_SAMPLER_ANISO
174};
175
176enum RsSamplerValue {
177 RS_SAMPLER_NEAREST,
178 RS_SAMPLER_LINEAR,
179 RS_SAMPLER_LINEAR_MIP_LINEAR,
180 RS_SAMPLER_WRAP,
181 RS_SAMPLER_CLAMP,
182 RS_SAMPLER_LINEAR_MIP_NEAREST,
Tim Murray9e913f42013-02-15 13:29:24 -0800183 RS_SAMPLER_MIRRORED_REPEAT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800184
185 RS_SAMPLER_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700186};
187
Jason Samsbad80742011-03-16 16:29:28 -0700188enum RsDimension {
189 RS_DIMENSION_X,
190 RS_DIMENSION_Y,
191 RS_DIMENSION_Z,
192 RS_DIMENSION_LOD,
193 RS_DIMENSION_FACE,
194
195 RS_DIMENSION_ARRAY_0 = 100,
196 RS_DIMENSION_ARRAY_1,
197 RS_DIMENSION_ARRAY_2,
198 RS_DIMENSION_ARRAY_3,
199 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
200};
201
Jason Sams9e0afb52011-10-31 13:23:43 -0700202
Jason Samsbad80742011-03-16 16:29:28 -0700203enum RsError {
204 RS_ERROR_NONE = 0,
205 RS_ERROR_BAD_SHADER = 1,
206 RS_ERROR_BAD_SCRIPT = 2,
207 RS_ERROR_BAD_VALUE = 3,
208 RS_ERROR_OUT_OF_MEMORY = 4,
209 RS_ERROR_DRIVER = 5,
210
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700211 // Errors that only occur in the debug context.
212 RS_ERROR_FATAL_DEBUG = 0x0800,
213
Jason Samsbad80742011-03-16 16:29:28 -0700214 RS_ERROR_FATAL_UNKNOWN = 0x1000,
215 RS_ERROR_FATAL_DRIVER = 0x1001,
216 RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
217};
218
Stephen Hinesf5988112012-10-16 00:05:46 -0700219enum RsForEachStrategy {
220 RS_FOR_EACH_STRATEGY_SERIAL = 0,
221 RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
222 RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
223 RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
224 RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
225 RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
226};
227
Jason Samsbad80742011-03-16 16:29:28 -0700228// Script to Script
229typedef struct {
Stephen Hinesf5988112012-10-16 00:05:46 -0700230 enum RsForEachStrategy strategy;
Jason Samsbad80742011-03-16 16:29:28 -0700231 uint32_t xStart;
232 uint32_t xEnd;
233 uint32_t yStart;
234 uint32_t yEnd;
235 uint32_t zStart;
236 uint32_t zEnd;
237 uint32_t arrayStart;
238 uint32_t arrayEnd;
239
240} RsScriptCall;
241
Tim Murray84e3dea2013-09-09 16:12:51 -0700242enum RsContextFlags {
Jason Samsbfa5a8e2014-05-20 18:16:20 -0700243 RS_CONTEXT_SYNCHRONOUS = 0x0001,
244 RS_CONTEXT_LOW_LATENCY = 0x0002,
245 RS_CONTEXT_LOW_POWER = 0x0004
Tim Murray84e3dea2013-09-09 16:12:51 -0700246};
247
248
Jason Samsbad80742011-03-16 16:29:28 -0700249#ifdef __cplusplus
250};
251#endif
252
253#endif // RENDER_SCRIPT_DEFINES_H
254
255
256
257