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