blob: 69a62d6fa9e3bfde253851bff26a54babecde95b [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;
Yang Nieb9aa672015-01-27 14:32:25 -080045typedef void * RsScriptInvokeID;
Jason Samsdbe66d62012-09-17 13:54:41 -070046typedef void * RsScriptFieldID;
47typedef void * RsScriptMethodID;
48typedef void * RsScriptGroup;
Yang Ni1ffd86b2015-01-07 09:16:40 -080049typedef void * RsScriptGroup2;
Jason Samsbad80742011-03-16 16:29:28 -070050typedef void * RsMesh;
Jason Sams9e0afb52011-10-31 13:23:43 -070051typedef void * RsPath;
Jason Samsbad80742011-03-16 16:29:28 -070052typedef void * RsType;
53typedef void * RsObjectBase;
54
55typedef void * RsProgram;
56typedef void * RsProgramVertex;
57typedef void * RsProgramFragment;
58typedef void * RsProgramStore;
59typedef void * RsProgramRaster;
60
Alex Sakhartchouk7257c7e2011-05-17 12:32:47 -070061typedef void * RsNativeWindow;
62
Jason Samsbad80742011-03-16 16:29:28 -070063typedef void (* RsBitmapCallback_t)(void *);
64
Jason Sams87fe59a2011-04-20 15:09:01 -070065typedef struct {
66 float m[16];
67} rs_matrix4x4;
68
69typedef struct {
70 float m[9];
71} rs_matrix3x3;
72
73typedef struct {
74 float m[4];
75} rs_matrix2x2;
76
Jason Samsbad80742011-03-16 16:29:28 -070077enum RsDeviceParam {
78 RS_DEVICE_PARAM_FORCE_SOFTWARE_GL,
79 RS_DEVICE_PARAM_COUNT
80};
81
Jason Sams14982c82013-02-22 18:17:05 -080082enum RsContextType {
83 RS_CONTEXT_TYPE_NORMAL,
84 RS_CONTEXT_TYPE_DEBUG,
85 RS_CONTEXT_TYPE_PROFILE
86};
87
Jason Samsbad80742011-03-16 16:29:28 -070088
89enum RsAllocationUsageType {
90 RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
91 RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
92 RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
93 RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070094 RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010,
Jason Sams3522f402012-03-23 11:47:26 -070095 RS_ALLOCATION_USAGE_IO_INPUT = 0x0020,
96 RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040,
Tim Murray9e2bda52012-12-18 12:05:46 -080097 RS_ALLOCATION_USAGE_SHARED = 0x0080,
Jason Samsbad80742011-03-16 16:29:28 -070098
Jason Sams41e373d2012-01-13 14:01:20 -080099 RS_ALLOCATION_USAGE_ALL = 0x00FF
Jason Samsbad80742011-03-16 16:29:28 -0700100};
101
102enum RsAllocationMipmapControl {
103 RS_ALLOCATION_MIPMAP_NONE = 0,
104 RS_ALLOCATION_MIPMAP_FULL = 1,
105 RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE = 2
106};
107
108enum RsAllocationCubemapFace {
Alex Sakhartchouk74a82792011-06-14 11:13:19 -0700109 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
110 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
111 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2,
112 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3,
113 RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
114 RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
Jason Samsbad80742011-03-16 16:29:28 -0700115};
116
117enum RsDataType {
118 RS_TYPE_NONE,
119 RS_TYPE_FLOAT_16,
120 RS_TYPE_FLOAT_32,
121 RS_TYPE_FLOAT_64,
122 RS_TYPE_SIGNED_8,
123 RS_TYPE_SIGNED_16,
124 RS_TYPE_SIGNED_32,
125 RS_TYPE_SIGNED_64,
126 RS_TYPE_UNSIGNED_8,
127 RS_TYPE_UNSIGNED_16,
128 RS_TYPE_UNSIGNED_32,
129 RS_TYPE_UNSIGNED_64,
130
131 RS_TYPE_BOOLEAN,
132
133 RS_TYPE_UNSIGNED_5_6_5,
134 RS_TYPE_UNSIGNED_5_5_5_1,
135 RS_TYPE_UNSIGNED_4_4_4_4,
136
137 RS_TYPE_MATRIX_4X4,
138 RS_TYPE_MATRIX_3X3,
139 RS_TYPE_MATRIX_2X2,
140
141 RS_TYPE_ELEMENT = 1000,
142 RS_TYPE_TYPE,
143 RS_TYPE_ALLOCATION,
144 RS_TYPE_SAMPLER,
145 RS_TYPE_SCRIPT,
146 RS_TYPE_MESH,
147 RS_TYPE_PROGRAM_FRAGMENT,
148 RS_TYPE_PROGRAM_VERTEX,
149 RS_TYPE_PROGRAM_RASTER,
150 RS_TYPE_PROGRAM_STORE,
Stephen Hinesae8b7952012-04-11 18:09:54 -0700151 RS_TYPE_FONT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800152
153 RS_TYPE_INVALID = 10000,
Jason Samsbad80742011-03-16 16:29:28 -0700154};
155
156enum RsDataKind {
157 RS_KIND_USER,
158
159 RS_KIND_PIXEL_L = 7,
160 RS_KIND_PIXEL_A,
161 RS_KIND_PIXEL_LA,
162 RS_KIND_PIXEL_RGB,
163 RS_KIND_PIXEL_RGBA,
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -0700164 RS_KIND_PIXEL_DEPTH,
Jason Samsbc0ca6b2013-02-15 18:13:43 -0800165 RS_KIND_PIXEL_YUV,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800166
167 RS_KIND_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700168};
169
170enum RsSamplerParam {
171 RS_SAMPLER_MIN_FILTER,
172 RS_SAMPLER_MAG_FILTER,
173 RS_SAMPLER_WRAP_S,
174 RS_SAMPLER_WRAP_T,
175 RS_SAMPLER_WRAP_R,
176 RS_SAMPLER_ANISO
177};
178
179enum RsSamplerValue {
180 RS_SAMPLER_NEAREST,
181 RS_SAMPLER_LINEAR,
182 RS_SAMPLER_LINEAR_MIP_LINEAR,
183 RS_SAMPLER_WRAP,
184 RS_SAMPLER_CLAMP,
185 RS_SAMPLER_LINEAR_MIP_NEAREST,
Tim Murray9e913f42013-02-15 13:29:24 -0800186 RS_SAMPLER_MIRRORED_REPEAT,
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -0800187
188 RS_SAMPLER_INVALID = 100,
Jason Samsbad80742011-03-16 16:29:28 -0700189};
190
Jason Samsbad80742011-03-16 16:29:28 -0700191enum RsDimension {
192 RS_DIMENSION_X,
193 RS_DIMENSION_Y,
194 RS_DIMENSION_Z,
195 RS_DIMENSION_LOD,
196 RS_DIMENSION_FACE,
197
198 RS_DIMENSION_ARRAY_0 = 100,
199 RS_DIMENSION_ARRAY_1,
200 RS_DIMENSION_ARRAY_2,
201 RS_DIMENSION_ARRAY_3,
202 RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
203};
204
Jason Sams9e0afb52011-10-31 13:23:43 -0700205
Jason Samsbad80742011-03-16 16:29:28 -0700206enum RsError {
207 RS_ERROR_NONE = 0,
208 RS_ERROR_BAD_SHADER = 1,
209 RS_ERROR_BAD_SCRIPT = 2,
210 RS_ERROR_BAD_VALUE = 3,
211 RS_ERROR_OUT_OF_MEMORY = 4,
212 RS_ERROR_DRIVER = 5,
213
Stephen Hinescca3d6c2013-04-15 01:06:39 -0700214 // Errors that only occur in the debug context.
215 RS_ERROR_FATAL_DEBUG = 0x0800,
216
Jason Samsbad80742011-03-16 16:29:28 -0700217 RS_ERROR_FATAL_UNKNOWN = 0x1000,
218 RS_ERROR_FATAL_DRIVER = 0x1001,
219 RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
220};
221
Stephen Hinesf5988112012-10-16 00:05:46 -0700222enum RsForEachStrategy {
223 RS_FOR_EACH_STRATEGY_SERIAL = 0,
224 RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
225 RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
226 RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
227 RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
228 RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
229};
230
Jason Samsbad80742011-03-16 16:29:28 -0700231// Script to Script
232typedef struct {
Stephen Hinesf5988112012-10-16 00:05:46 -0700233 enum RsForEachStrategy strategy;
Jason Samsbad80742011-03-16 16:29:28 -0700234 uint32_t xStart;
235 uint32_t xEnd;
236 uint32_t yStart;
237 uint32_t yEnd;
238 uint32_t zStart;
239 uint32_t zEnd;
240 uint32_t arrayStart;
241 uint32_t arrayEnd;
Jason Samsbf2111d2015-01-26 18:13:41 -0800242 uint32_t array2Start;
243 uint32_t array2End;
244 uint32_t array3Start;
245 uint32_t array3End;
246 uint32_t array4Start;
247 uint32_t array4End;
Jason Samsbad80742011-03-16 16:29:28 -0700248
249} RsScriptCall;
250
Tim Murray84e3dea2013-09-09 16:12:51 -0700251enum RsContextFlags {
Jason Samsbfa5a8e2014-05-20 18:16:20 -0700252 RS_CONTEXT_SYNCHRONOUS = 0x0001,
253 RS_CONTEXT_LOW_LATENCY = 0x0002,
254 RS_CONTEXT_LOW_POWER = 0x0004
Tim Murray84e3dea2013-09-09 16:12:51 -0700255};
256
257
Jason Samsbad80742011-03-16 16:29:28 -0700258#ifdef __cplusplus
259};
260#endif
261
262#endif // RENDER_SCRIPT_DEFINES_H