blob: 0a1e3a12ebdaf5b7f59761c4d07904048dedd097 [file] [log] [blame]
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001/*
2 * Copyright (C) 2015 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// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
18
19/*
20 * rs_for_each.rsh: TODO Add documentation
21 *
22 * TODO Add documentation
23 */
24#ifndef RENDERSCRIPT_RS_FOR_EACH_RSH
25#define RENDERSCRIPT_RS_FOR_EACH_RSH
26
27/*
28 * rs_for_each_strategy_t: Launch order hint for rsForEach calls
29 *
30 * Launch order hint for rsForEach calls. This provides a hint to the system to
31 * determine in which order the root function of the target is called with each
32 * cell of the allocation.
33 *
34 * This is a hint and implementations may not obey the order.
35 */
36typedef enum rs_for_each_strategy {
37 RS_FOR_EACH_STRATEGY_SERIAL = 0,
38 RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
39 RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
40 RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
41 RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
42 RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
43} rs_for_each_strategy_t;
44
45/*
46 * rs_kernel_context: Opaque handle to RenderScript kernel invocation context
47 *
48 * TODO
49 */
50#if (defined(RS_VERSION) && (RS_VERSION >= 23))
51typedef const struct rs_kernel_context_t * rs_kernel_context;
52#endif
53
54/*
55 * rs_script_call_t: Provides extra information to a rsForEach call
56 *
57 * Structure to provide extra information to a rsForEach call. Primarly used to
58 * restrict the call to a subset of cells in the allocation.
59 */
60typedef struct rs_script_call {
61 rs_for_each_strategy_t strategy;
62 uint32_t xStart;
63 uint32_t xEnd;
64 uint32_t yStart;
65 uint32_t yEnd;
66 uint32_t zStart;
67 uint32_t zEnd;
68 uint32_t arrayStart;
69 uint32_t arrayEnd;
70} rs_script_call_t;
71
72/*
73 * Make a script to script call to launch work. One of the input or output is
74 * required to be a valid object. The input and output must be of the same
75 * dimensions.
76 *
77 * Parameters:
78 * script The target script to call
79 * input The allocation to source data from
80 * output the allocation to write date into
81 * usrData The user defined params to pass to the root script. May be NULL.
82 * sc Extra control infomation used to select a sub-region of the allocation to be processed or suggest a walking strategy. May be NULL.
83 * usrDataLen The size of the userData structure. This will be used to perform a shallow copy of the data if necessary.
84 */
85#if !defined(RS_VERSION) || (RS_VERSION <= 13)
86extern void __attribute__((overloadable))
87 rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
88 const rs_script_call_t* sc);
89#endif
90
91#if !defined(RS_VERSION) || (RS_VERSION <= 13)
92extern void __attribute__((overloadable))
93 rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData);
94#endif
95
96#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
97extern void __attribute__((overloadable))
98 rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
99 size_t usrDataLen, const rs_script_call_t* sc);
100#endif
101
102#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
103extern void __attribute__((overloadable))
104 rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
105 size_t usrDataLen);
106#endif
107
108#if (defined(RS_VERSION) && (RS_VERSION >= 14))
109extern void __attribute__((overloadable))
110 rsForEach(rs_script script, rs_allocation input, rs_allocation output);
111#endif
112
113/*
114 * rsGetArray0: Index in the Array0 dimension for the specified context
115 *
116 * Returns the index in the Array0 dimension of the cell being processed,
117 * as specified by the supplied context.
118 *
119 * This context is created when a kernel is launched and updated at each
120 * iteration. It contains common characteristics of the allocations being
121 * iterated over and rarely used indexes, like the Array0 index.
122 *
123 * You can access the context by adding a rs_kernel_context argument to your
124 * kernel function. E.g.
125 * short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {
126 * // The current index in the common x, y, z, w dimensions are accessed by
127 * // adding these variables as arguments. For the more rarely used indexes
128 * // to the other dimensions, extract them from the context:
129 * uint32_t index_a0 = rsGetArray0(context);
130 * //...
131 * }
132 *
133 * This function returns 0 if the Array0 dimension is not present.
134 */
135#if (defined(RS_VERSION) && (RS_VERSION >= 23))
136extern uint32_t __attribute__((overloadable))
137 rsGetArray0(rs_kernel_context ctxt);
138#endif
139
140/*
141 * rsGetArray1: Index in the Array1 dimension for the specified context
142 *
143 * Returns the index in the Array1 dimension of the cell being processed,
144 * as specified by the supplied context. See rsGetArray0() for an explanation
145 * of the context.
146 *
147 * Returns 0 if the Array1 dimension is not present.
148 */
149#if (defined(RS_VERSION) && (RS_VERSION >= 23))
150extern uint32_t __attribute__((overloadable))
151 rsGetArray1(rs_kernel_context ctxt);
152#endif
153
154/*
155 * rsGetArray2: Index in the Array2 dimension for the specified context
156 *
157 * Returns the index in the Array2 dimension of the cell being processed,
158 * as specified by the supplied context. See rsGetArray0() for an explanation
159 * of the context.
160 *
161 * Returns 0 if the Array2 dimension is not present.
162 */
163#if (defined(RS_VERSION) && (RS_VERSION >= 23))
164extern uint32_t __attribute__((overloadable))
165 rsGetArray2(rs_kernel_context ctxt);
166#endif
167
168/*
169 * rsGetArray3: Index in the Array3 dimension for the specified context
170 *
171 * Returns the index in the Array3 dimension of the cell being processed,
172 * as specified by the supplied context. See rsGetArray0() for an explanation
173 * of the context.
174 *
175 * Returns 0 if the Array3 dimension is not present.
176 */
177#if (defined(RS_VERSION) && (RS_VERSION >= 23))
178extern uint32_t __attribute__((overloadable))
179 rsGetArray3(rs_kernel_context ctxt);
180#endif
181
182/*
183 * rsGetDimArray0: Size of the Array0 dimension for the specified context
184 *
185 * Returns the size of the Array0 dimension for the specified context.
186 * See rsGetDimX() for an explanation of the context.
187 *
188 * Returns 0 if the Array0 dimension is not present.
189 */
190#if (defined(RS_VERSION) && (RS_VERSION >= 23))
191extern uint32_t __attribute__((overloadable))
192 rsGetDimArray0(rs_kernel_context ctxt);
193#endif
194
195/*
196 * rsGetDimArray1: Size of the Array1 dimension for the specified context
197 *
198 * Returns the size of the Array1 dimension for the specified context.
199 * See rsGetDimX() for an explanation of the context.
200 *
201 * Returns 0 if the Array1 dimension is not present.
202 */
203#if (defined(RS_VERSION) && (RS_VERSION >= 23))
204extern uint32_t __attribute__((overloadable))
205 rsGetDimArray1(rs_kernel_context ctxt);
206#endif
207
208/*
209 * rsGetDimArray2: Size of the Array2 dimension for the specified context
210 *
211 * Returns the size of the Array2 dimension for the specified context.
212 * See rsGetDimX() for an explanation of the context.
213 *
214 * Returns 0 if the Array2 dimension is not present.
215 */
216#if (defined(RS_VERSION) && (RS_VERSION >= 23))
217extern uint32_t __attribute__((overloadable))
218 rsGetDimArray2(rs_kernel_context ctxt);
219#endif
220
221/*
222 * rsGetDimArray3: Size of the Array3 dimension for the specified context
223 *
224 * Returns the size of the Array3 dimension for the specified context.
225 * See rsGetDimX() for an explanation of the context.
226 *
227 * Returns 0 if the Array3 dimension is not present.
228 */
229#if (defined(RS_VERSION) && (RS_VERSION >= 23))
230extern uint32_t __attribute__((overloadable))
231 rsGetDimArray3(rs_kernel_context ctxt);
232#endif
233
234/*
235 * rsGetDimHasFaces: Presence of more than one face for the specified context
236 *
237 * If the context refers to a cubemap, this function returns true if there's
238 * more than one face present. In all other cases, it returns false.
239 * See rsGetDimX() for an explanation of the context.
240 *
241 * rsAllocationGetDimFaces() is similar but returns 0 or 1 instead of a bool.
242 *
243 * Returns: Returns true if more than one face is present, false otherwise.
244 */
245#if (defined(RS_VERSION) && (RS_VERSION >= 23))
246extern bool __attribute__((overloadable))
247 rsGetDimHasFaces(rs_kernel_context ctxt);
248#endif
249
250/*
251 * rsGetDimLod: Number of levels of detail for the specified context
252 *
253 * Returns the number of levels of detail for the specified context.
254 * This is useful for mipmaps. See rsGetDimX() for an explanation of the context.
255 * Returns 0 if Level of Detail is not used.
256 *
257 * rsAllocationGetDimLOD() is similar but returns 0 or 1 instead the actual
258 * number of levels.
259 */
260#if (defined(RS_VERSION) && (RS_VERSION >= 23))
261extern uint32_t __attribute__((overloadable))
262 rsGetDimLod(rs_kernel_context ctxt);
263#endif
264
265/*
266 * rsGetDimX: Size of the X dimension for the specified context
267 *
268 * Returns the size of the X dimension for the specified context.
269 *
270 * This context is created when a kernel is launched. It contains common
271 * characteristics of the allocations being iterated over by the kernel in
272 * a very efficient structure. It also contains rarely used indexes.
273 *
274 * You can access it by adding a rs_kernel_context argument to your kernel
275 * function. E.g.
276 * int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {
277 * uint32_t size = rsGetDimX(context); //...
278 */
279#if (defined(RS_VERSION) && (RS_VERSION >= 23))
280extern uint32_t __attribute__((overloadable))
281 rsGetDimX(rs_kernel_context ctxt);
282#endif
283
284/*
285 * rsGetDimY: Size of the Y dimension for the specified context
286 *
287 * Returns the size of the X dimension for the specified context.
288 * See rsGetDimX() for an explanation of the context.
289 *
290 * Returns 0 if the Y dimension is not present.
291 */
292#if (defined(RS_VERSION) && (RS_VERSION >= 23))
293extern uint32_t __attribute__((overloadable))
294 rsGetDimY(rs_kernel_context ctxt);
295#endif
296
297/*
298 * rsGetDimZ: Size of the Z dimension for the specified context
299 *
300 * Returns the size of the Z dimension for the specified context.
301 * See rsGetDimX() for an explanation of the context.
302 *
303 * Returns 0 if the Z dimension is not present.
304 */
305#if (defined(RS_VERSION) && (RS_VERSION >= 23))
306extern uint32_t __attribute__((overloadable))
307 rsGetDimZ(rs_kernel_context ctxt);
308#endif
309
310/*
311 * rsGetFace: Coordinate of the Face for the specified context
312 *
313 * Returns the face on which the cell being processed is found, as specified
314 * by the supplied context. See rsGetArray0() for an explanation of the context.
315 *
316 * Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not
317 * present.
318 */
319#if (defined(RS_VERSION) && (RS_VERSION >= 23))
320extern rs_allocation_cubemap_face __attribute__((overloadable))
321 rsGetFace(rs_kernel_context ctxt);
322#endif
323
324/*
325 * rsGetLod: Index in the Levels of Detail dimension for the specified context.
326 *
327 * Returns the index in the Levels of Detail dimension of the cell being
328 * processed, as specified by the supplied context. See rsGetArray0() for
329 * an explanation of the context.
330 *
331 * Returns 0 if the Levels of Detail dimension is not present.
332 */
333#if (defined(RS_VERSION) && (RS_VERSION >= 23))
334extern uint32_t __attribute__((overloadable))
335 rsGetLod(rs_kernel_context ctxt);
336#endif
337
338#endif // RENDERSCRIPT_RS_FOR_EACH_RSH