• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2011-2012 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 /*! \mainpage notitle
18  *
19  * RenderScript is a high-performance runtime that provides
20  * compute operations at the native level. RenderScript code is compiled on devices
21  * at runtime to allow platform-independence as well.
22  * This reference documentation describes the RenderScript runtime APIs, which you
23  * can utilize to write RenderScript code in C99. The RenderScript compute header
24  * files are automatically included for you.
25  *
26  * To use RenderScript, you need to utilize the RenderScript runtime APIs documented here
27  * as well as the Android framework APIs for RenderScript.
28  * For documentation on the Android framework APIs, see the <a target="_parent" href=
29  * "http://developer.android.com/reference/android/renderscript/package-summary.html">
30  * android.renderscript</a> package reference.
31  * For more information on how to develop with RenderScript and how the runtime and
32  * Android framework APIs interact, see the <a target="_parent" href=
33  * "http://developer.android.com/guide/topics/renderscript/index.html">RenderScript
34  * developer guide</a> and the <a target="_parent" href=
35  * "http://developer.android.com/resources/samples/RenderScript/index.html">
36  * RenderScript samples</a>.
37  */
38
39/** @file rs_core.rsh
40 *  \brief todo-jsams
41 *
42 *  todo-jsams
43 *
44 */
45
46#ifndef __RS_CORE_RSH__
47#define __RS_CORE_RSH__
48
49#define _RS_RUNTIME extern
50
51#include "rs_types.rsh"
52#include "rs_allocation.rsh"
53#include "rs_atomic.rsh"
54#include "rs_cl.rsh"
55#include "rs_debug.rsh"
56#include "rs_element.rsh"
57#include "rs_math.rsh"
58#include "rs_matrix.rsh"
59#include "rs_object.rsh"
60#include "rs_quaternion.rsh"
61#include "rs_sampler.rsh"
62#include "rs_time.rsh"
63
64/**
65 * Send a message back to the client.  Will not block and returns true
66 * if the message was sendable and false if the fifo was full.
67 * A message ID is required.  Data payload is optional.
68 */
69extern bool __attribute__((overloadable))
70    rsSendToClient(int cmdID);
71/**
72 * \overload
73 */
74extern bool __attribute__((overloadable))
75    rsSendToClient(int cmdID, const void *data, uint len);
76/**
77 * Send a message back to the client, blocking until the message is queued.
78 * A message ID is required.  Data payload is optional.
79 */
80extern void __attribute__((overloadable))
81    rsSendToClientBlocking(int cmdID);
82/**
83 * \overload
84 */
85extern void __attribute__((overloadable))
86    rsSendToClientBlocking(int cmdID, const void *data, uint len);
87
88
89/**
90 * Launch order hint for rsForEach calls.  This provides a hint to the system to
91 * determine in which order the root function of the target is called with each
92 * cell of the allocation.
93 *
94 * This is a hint and implementations may not obey the order.
95 */
96enum rs_for_each_strategy {
97    RS_FOR_EACH_STRATEGY_SERIAL = 0,
98    RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
99    RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
100    RS_FOR_EACH_STRATEGY_TILE_SMALL= 3,
101    RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
102    RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
103};
104
105
106/**
107 * Structure to provide extra information to a rsForEach call.  Primarly used to
108 * restrict the call to a subset of cells in the allocation.
109 */
110typedef struct rs_script_call {
111    enum rs_for_each_strategy strategy;
112    uint32_t xStart;
113    uint32_t xEnd;
114    uint32_t yStart;
115    uint32_t yEnd;
116    uint32_t zStart;
117    uint32_t zEnd;
118    uint32_t arrayStart;
119    uint32_t arrayEnd;
120} rs_script_call_t;
121
122/**
123 * Make a script to script call to launch work. One of the input or output is
124 * required to be a valid object. The input and output must be of the same
125 * dimensions.
126 * API 10-13
127 *
128 * @param script The target script to call
129 * @param input The allocation to source data from
130 * @param output the allocation to write date into
131 * @param usrData The user definied params to pass to the root script.  May be
132 *                NULL.
133 * @param sc Extra control infomation used to select a sub-region of the
134 *           allocation to be processed or suggest a walking strategy.  May be
135 *           NULL.
136 *
137 *  */
138#if !defined(RS_VERSION) || (RS_VERSION < 14)
139extern void __attribute__((overloadable))
140    rsForEach(rs_script script, rs_allocation input,
141              rs_allocation output, const void * usrData,
142              const rs_script_call_t *sc);
143/**
144 * \overload
145 */
146extern void __attribute__((overloadable))
147    rsForEach(rs_script script, rs_allocation input,
148              rs_allocation output, const void * usrData);
149#else
150
151/**
152 * Make a script to script call to launch work. One of the input or output is
153 * required to be a valid object. The input and output must be of the same
154 * dimensions.
155 * API 14+
156 *
157 * @param script The target script to call
158 * @param input The allocation to source data from
159 * @param output the allocation to write date into
160 * @param usrData The user definied params to pass to the root script.  May be
161 *                NULL.
162 * @param usrDataLen The size of the userData structure.  This will be used to
163 *                   perform a shallow copy of the data if necessary.
164 * @param sc Extra control infomation used to select a sub-region of the
165 *           allocation to be processed or suggest a walking strategy.  May be
166 *           NULL.
167 *
168 */
169extern void __attribute__((overloadable))
170    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
171              const void * usrData, size_t usrDataLen, const rs_script_call_t *);
172/**
173 * \overload
174 */
175extern void __attribute__((overloadable))
176    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
177              const void * usrData, size_t usrDataLen);
178/**
179 * \overload
180 */
181extern void __attribute__((overloadable))
182    rsForEach(rs_script script, rs_allocation input, rs_allocation output);
183#endif
184
185
186
187#undef _RS_RUNTIME
188
189#endif
190