blob: 9345eb9bca81202b28534995ce0775cf1ded4ca3 [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;
Yang Ni1ffd86b2015-01-07 09:16:40 -080036typedef void * RsClosure;
Jason Samsbad80742011-03-16 16:29:28 -070037typedef void * RsContext;
38typedef void * RsDevice;
39typedef void * RsElement;
40typedef void * RsFile;
41typedef void * RsFont;
42typedef void * RsSampler;
43typedef void * RsScript;
Jason Samsdbe66d62012-09-17 13:54:41 -070044typedef void * RsScriptKernelID;
45typedef void * RsScriptFieldID;
46typedef void * RsScriptMethodID;
47typedef void * RsScriptGroup;
Yang Ni1ffd86b2015-01-07 09:16:40 -080048typedef void * RsScriptGroup2;
Jason Samsbad80742011-03-16 16:29:28 -070049typedef void * RsMesh;
Jason Sams9e0afb52011-10-31 13:23:43 -070050typedef void * RsPath;
Jason Samsbad80742011-03-16 16:29:28 -070051typedef void * RsType;
52typedef void * RsObjectBase;
53
54typedef void * RsProgram;
55typedef void * RsProgramVertex;
56typedef void * RsProgramFragment;
57typedef void * RsProgramStore;
58typedef void * RsProgramRaster;
59
Alex Sakhartchouk7257c7e2011-05-17 12:32:47 -070060typedef void * RsNativeWindow;
61
Jason Samsbad80742011-03-16 16:29:28 -070062typedef void (* RsBitmapCallback_t)(void *);
63
Jason Sams87fe59a2011-04-20 15:09:01 -070064typedef struct {
65 float m[16];
66} rs_matrix4x4;
67
68typedef struct {
69 float m[9];
70} rs_matrix3x3;
71
72typedef struct {
73 float m[4];
74} rs_matrix2x2;
75
Jason Samsbad80742011-03-16 16:29:28 -070076enum RsDeviceParam {
77 RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
78 RS_DEVICE_PARAM_COUNT
79};
80
Jason Sams14982c82013-02-22 18:17:05 -080081enum RsContextType {
82 RS_CONTEXT_TYPE_NORMAL,
83 RS_CONTEXT_TYPE_DEBUG,
84 RS_CONTEXT_TYPE_PROFILE
85};
86
Jason Samsbad80742011-03-16 16:29:28 -070087
88enum RsAllocationUsageType {
89 RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
90 RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
91 RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
92 RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070093 RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010,
Jason Sams3522f402012-03-23 11:47:26 -070094 RS_ALLOCATION_USAGE_IO_INPUT = 0x0020,
95 RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040,
Tim Murray9e2bda52012-12-18 12:05:46 -080096 RS_ALLOCATION_USAGE_SHARED = 0x0080,
Jason Samsbad80742011-03-16 16:29:28 -070097
Jason Sams41e373d2012-01-13 14:01:20 -080098 RS_ALLOCATION_USAGE_ALL = 0x00FF
Jason Samsbad80742011-03-16 16:29:28 -070099};
100
101enum RsAllocationMipmapControl {
102 RS_ALLOCATION_MIPMAP_NONE = 0,
103 RS_ALLOCATION_MIPMAP_FULL = 1,
104 RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
105};
106
107enum RsAllocationCubemapFace {
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700108 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
109 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
110 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2,
111 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3,
112 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
113 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
Jason Samsbad80742011-03-16 16:29:28 -0700114};
115
116enum RsDataType {
117 RS_TYPE_NONE,
118 RS_TYPE_FLOAT_16,
119 RS_TYPE_FLOAT_32,
120 RS_TYPE_FLOAT_64,
121 RS_TYPE_SIGNED_8,
122 RS_TYPE_SIGNED_16,
123 RS_TYPE_SIGNED_32,
124 RS_TYPE_SIGNED_64,
125 RS_TYPE_UNSIGNED_8,
126 RS_TYPE_UNSIGNED_16,
127 RS_TYPE_UNSIGNED_32,
128 RS_TYPE_UNSIGNED_64,
129
130 RS_TYPE_BOOLEAN,
131
132 RS_TYPE_UNSIGNED_5_6_5,
133 RS_TYPE_UNSIGNED_5_5_5_1,
134 RS_TYPE_UNSIGNED_4_4_4_4,
135
136 RS_TYPE_MATRIX_4X4,
137 RS_TYPE_MATRIX_3X3,
138 RS_TYPE_MATRIX_2X2,
139
140 RS_TYPE_ELEMENT = 1000,
141 RS_TYPE_TYPE,
142 RS_TYPE_ALLOCATION,
143 RS_TYPE_SAMPLER,
144 RS_TYPE_SCRIPT,
145 RS_TYPE_MESH,
146 RS_TYPE_PROGRAM_FRAGMENT,
147 RS_TYPE_PROGRAM_VERTEX,
148 RS_TYPE_PROGRAM_RASTER,
149 RS_TYPE_PROGRAM_STORE,
Stephen Hinesae8b7952012-04-11 18:09:54 -0700150 RS_TYPE_FONT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800151
152 RS_TYPE_INVALID = 10000,
Jason Samsbad80742011-03-16 16:29:28 -0700153};
154
155enum RsDataKind {
156 RS_KIND_USER,
157
158 RS_KIND_PIXEL_L = 7,
159 RS_KIND_PIXEL_A,
160 RS_KIND_PIXEL_LA,
161 RS_KIND_PIXEL_RGB,
162 RS_KIND_PIXEL_RGBA,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -0700163 RS_KIND_PIXEL_DEPTH,
Jason Samsbc0ca6b2013-02-15 18:13:43 -0800164 RS_KIND_PIXEL_YUV,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800165
166 RS_KIND_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700167};
168
169enum RsSamplerParam {
170 RS_SAMPLER_MIN_FILTER,
171 RS_SAMPLER_MAG_FILTER,
172 RS_SAMPLER_WRAP_S,
173 RS_SAMPLER_WRAP_T,
174 RS_SAMPLER_WRAP_R,
175 RS_SAMPLER_ANISO
176};
177
178enum RsSamplerValue {
179 RS_SAMPLER_NEAREST,
180 RS_SAMPLER_LINEAR,
181 RS_SAMPLER_LINEAR_MIP_LINEAR,
182 RS_SAMPLER_WRAP,
183 RS_SAMPLER_CLAMP,
184 RS_SAMPLER_LINEAR_MIP_NEAREST,
Tim Murray9e913f42013-02-15 13:29:24 -0800185 RS_SAMPLER_MIRRORED_REPEAT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800186
187 RS_SAMPLER_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700188};
189
Jason Samsbad80742011-03-16 16:29:28 -0700190enum RsDimension {
191 RS_DIMENSION_X,
192 RS_DIMENSION_Y,
193 RS_DIMENSION_Z,
194 RS_DIMENSION_LOD,
195 RS_DIMENSION_FACE,
196
197 RS_DIMENSION_ARRAY_0 = 100,
198 RS_DIMENSION_ARRAY_1,
199 RS_DIMENSION_ARRAY_2,
200 RS_DIMENSION_ARRAY_3,
201 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
202};
203
Jason Sams9e0afb52011-10-31 13:23:43 -0700204
Jason Samsbad80742011-03-16 16:29:28 -0700205enum RsError {
206 RS_ERROR_NONE = 0,
207 RS_ERROR_BAD_SHADER = 1,
208 RS_ERROR_BAD_SCRIPT = 2,
209 RS_ERROR_BAD_VALUE = 3,
210 RS_ERROR_OUT_OF_MEMORY = 4,
211 RS_ERROR_DRIVER = 5,
212
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700213 // Errors that only occur in the debug context.
214 RS_ERROR_FATAL_DEBUG = 0x0800,
215
Jason Samsbad80742011-03-16 16:29:28 -0700216 RS_ERROR_FATAL_UNKNOWN = 0x1000,
217 RS_ERROR_FATAL_DRIVER = 0x1001,
218 RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
219};
220
Stephen Hinesf5988112012-10-16 00:05:46 -0700221enum RsForEachStrategy {
222 RS_FOR_EACH_STRATEGY_SERIAL = 0,
223 RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
224 RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
225 RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
226 RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
227 RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
228};
229
Jason Samsbad80742011-03-16 16:29:28 -0700230// Script to Script
231typedef struct {
Stephen Hinesf5988112012-10-16 00:05:46 -0700232 enum RsForEachStrategy strategy;
Jason Samsbad80742011-03-16 16:29:28 -0700233 uint32_t xStart;
234 uint32_t xEnd;
235 uint32_t yStart;
236 uint32_t yEnd;
237 uint32_t zStart;
238 uint32_t zEnd;
239 uint32_t arrayStart;
240 uint32_t arrayEnd;
241
242} RsScriptCall;
243
Tim Murray84e3dea2013-09-09 16:12:51 -0700244enum RsContextFlags {
Jason Samsbfa5a8e2014-05-20 18:16:20 -0700245 RS_CONTEXT_SYNCHRONOUS = 0x0001,
246 RS_CONTEXT_LOW_LATENCY = 0x0002,
247 RS_CONTEXT_LOW_POWER = 0x0004
Tim Murray84e3dea2013-09-09 16:12:51 -0700248};
249
250
Jason Samsbad80742011-03-16 16:29:28 -0700251#ifdef __cplusplus
252};
253#endif
254
255#endif // RENDER_SCRIPT_DEFINES_H