| page.title=RenderScript Kernel Launch Functions and Types |
| |
| @jd:body |
| |
| <div class='renderscript'> |
| <h2>Overview</h2> |
| <p> The <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a>() and <a href='rs_for_each.html#android_rs:rsForEachWithOptions'>rsForEachWithOptions</a>() functions are used to launch foreach kernels. |
| </p> |
| |
| <p> The other functions are used to get the characteristics of the invocation of |
| an executing kernel, like dimensions and current indices. These functions take |
| a <a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> as argument. |
| </p> |
| <h2>Summary</h2> |
| <table class='jd-sumtable'><tbody> |
| <tr><th colspan='2'>Types</th></tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rs_for_each_strategy_t'>rs_for_each_strategy_t</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Suggested cell processing order |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rs_kernel'>rs_kernel</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Handle to a kernel function |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Handle to a kernel invocation context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rs_script_call_t'>rs_script_call_t</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Cell iteration information |
| </td> |
| </tr> |
| </tbody></table> |
| <table class='jd-sumtable'><tbody> |
| <tr><th colspan='2'>Functions</th></tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Launches a kernel |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsForEachWithOptions'>rsForEachWithOptions</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Launches a kernel with options |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Index in the Array0 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetArray1'>rsGetArray1</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Index in the Array1 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetArray2'>rsGetArray2</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Index in the Array2 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetArray3'>rsGetArray3</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Index in the Array3 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimArray0'>rsGetDimArray0</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Array0 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimArray1'>rsGetDimArray1</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Array1 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimArray2'>rsGetDimArray2</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Array2 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimArray3'>rsGetDimArray3</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Array3 dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimHasFaces'>rsGetDimHasFaces</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Presence of more than one face for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimLod'>rsGetDimLod</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Number of levels of detail for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the X dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimY'>rsGetDimY</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Y dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetDimZ'>rsGetDimZ</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Size of the Z dimension for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetFace'>rsGetFace</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Coordinate of the Face for the specified kernel context |
| </td> |
| </tr> |
| <tr class='alt-color api apilevel-1'> |
| <td class='jd-linkcol'> |
| <a href='rs_for_each.html#android_rs:rsGetLod'>rsGetLod</a> |
| </td> |
| <td class='jd-descrcol' width='100%'> |
| Index in the Levels of Detail dimension for the specified kernel context |
| </td> |
| </tr> |
| </tbody></table> |
| <h2>Types</h2> |
| <a name='android_rs:rs_for_each_strategy_t'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rs_for_each_strategy_t</span> |
| <span class='normal'>: Suggested cell processing order</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <p>An enum with the following values: |
| </p> |
| <table class='jd-tagtable'><tbody> |
| <tr><th>RS_FOR_EACH_STRATEGY_SERIAL = 0</th><td>Prefer contiguous memory regions.</td></tr> |
| <tr><th>RS_FOR_EACH_STRATEGY_DONT_CARE = 1</th><td>No prefrences.</td></tr> |
| <tr><th>RS_FOR_EACH_STRATEGY_DST_LINEAR = 2</th><td>Prefer DST.</td></tr> |
| <tr><th>RS_FOR_EACH_STRATEGY_TILE_SMALL = 3</th><td>Prefer processing small rectangular regions.</td></tr> |
| <tr><th>RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4</th><td>Prefer processing medium rectangular regions.</td></tr> |
| <tr><th>RS_FOR_EACH_STRATEGY_TILE_LARGE = 5</th><td>Prefer processing large rectangular regions.</td></tr> |
| </tbody></table><br/> |
| <p> This type is used to suggest how the invoked kernel should iterate over the cells of the |
| allocations. This is a hint only. Implementations may not follow the suggestion. |
| </p> |
| |
| <p> This specification can help the caching behavior of the running kernel, e.g. the cache |
| locality when the processing is distributed over multiple cores. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rs_kernel'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rs_kernel</span> |
| <span class='normal'>: Handle to a kernel function</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <p>A typedef of: void* Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 24</a> |
| </p> |
| <p> An opaque type for a function that is defined with the kernel attribute. A value |
| of this type can be used in a <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a> call to launch a kernel. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rs_kernel_context'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rs_kernel_context</span> |
| <span class='normal'>: Handle to a kernel invocation context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <p>A typedef of: const struct rs_kernel_context_t * Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </p> |
| <p> The kernel context contains common characteristics of the allocations being iterated |
| over, like dimensions. It also contains rarely used indices of the currently processed |
| cell, like the Array0 index or the current level of detail. |
| </p> |
| |
| <p> You can access the kernel context by adding a special parameter named "context" of type |
| rs_kernel_context to your kernel function. See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() and <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for examples. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rs_script_call_t'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rs_script_call_t</span> |
| <span class='normal'>: Cell iteration information</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <p>A structure with the following fields: </p> |
| <table class='jd-tagtable'><tbody> |
| <tr><th>rs_for_each_strategy_t strategy</th><td>Currently ignored. In the future, will be suggested cell iteration strategy.</td></tr> |
| <tr><th>uint32_t xStart</th><td>Starting index in the X dimension.</td></tr> |
| <tr><th>uint32_t xEnd</th><td>Ending index (exclusive) in the X dimension.</td></tr> |
| <tr><th>uint32_t yStart</th><td>Starting index in the Y dimension.</td></tr> |
| <tr><th>uint32_t yEnd</th><td>Ending index (exclusive) in the Y dimension.</td></tr> |
| <tr><th>uint32_t zStart</th><td>Starting index in the Z dimension.</td></tr> |
| <tr><th>uint32_t zEnd</th><td>Ending index (exclusive) in the Z dimension.</td></tr> |
| <tr><th>uint32_t arrayStart</th><td>Starting index in the Array0 dimension.</td></tr> |
| <tr><th>uint32_t arrayEnd</th><td>Ending index (exclusive) in the Array0 dimension.</td></tr> |
| <tr><th>uint32_t array1Start</th><td>Starting index in the Array1 dimension.</td></tr> |
| <tr><th>uint32_t array1End</th><td>Ending index (exclusive) in the Array1 dimension.</td></tr> |
| <tr><th>uint32_t array2Start</th><td>Starting index in the Array2 dimension.</td></tr> |
| <tr><th>uint32_t array2End</th><td>Ending index (exclusive) in the Array2 dimension.</td></tr> |
| <tr><th>uint32_t array3Start</th><td>Starting index in the Array3 dimension.</td></tr> |
| <tr><th>uint32_t array3End</th><td>Ending index (exclusive) in the Array3 dimension.</td></tr> |
| </tbody></table><br/> |
| <p> This structure is used to provide iteration information to a rsForEach call. |
| It is currently used to restrict processing to a subset of cells. In future |
| versions, it will also be used to provide hint on how to best iterate over |
| the cells. |
| </p> |
| |
| <p> The Start fields are inclusive and the End fields are exclusive. For example, to iterate |
| over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8. |
| </p> |
| </div> |
| </div> |
| |
| <h2>Functions</h2> |
| <a name='android_rs:rsForEach'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsForEach</span> |
| <span class='normal'>: Launches a kernel</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td>void rsForEach(<a href='rs_for_each.html#android_rs:rs_kernel'>rs_kernel</a> kernel, ... ...); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 24</a> |
| </td> |
| </tr> |
| <tr> |
| <td>void rsForEach(<a href='rs_object_types.html#android_rs:rs_script'>rs_script</a> script, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> input, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> output); |
| </td> |
| <td> <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 - 23</a> |
| </td> |
| </tr> |
| <tr> |
| <td>void rsForEach(<a href='rs_object_types.html#android_rs:rs_script'>rs_script</a> script, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> input, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> output, const void* usrData); |
| </td> |
| <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> |
| </td> |
| </tr> |
| <tr> |
| <td>void rsForEach(<a href='rs_object_types.html#android_rs:rs_script'>rs_script</a> script, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> input, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> output, const void* usrData, const <a href='rs_for_each.html#android_rs:rs_script_call_t'>rs_script_call_t</a>* sc); |
| </td> |
| <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> |
| </td> |
| </tr> |
| <tr> |
| <td>void rsForEach(<a href='rs_object_types.html#android_rs:rs_script'>rs_script</a> script, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> input, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> output, const void* usrData, <a href='rs_value_types.html#android_rs:size_t'>size_t</a> usrDataLen); |
| </td> |
| <td> <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 - 20</a> |
| </td> |
| </tr> |
| <tr> |
| <td>void rsForEach(<a href='rs_object_types.html#android_rs:rs_script'>rs_script</a> script, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> input, <a href='rs_object_types.html#android_rs:rs_allocation'>rs_allocation</a> output, const void* usrData, <a href='rs_value_types.html#android_rs:size_t'>size_t</a> usrDataLen, const <a href='rs_for_each.html#android_rs:rs_script_call_t'>rs_script_call_t</a>* sc); |
| </td> |
| <td> <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 - 20</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> |
| <table class='jd-tagtable'><tbody> |
| <tr><th>script</th><td>Script to call.</td></tr> |
| <tr><th>input</th><td>Allocation to source data from.</td></tr> |
| <tr><th>output</th><td>Allocation to write data into.</td></tr> |
| <tr><th>usrData</th><td>User defined data to pass to the script. May be NULL.</td></tr> |
| <tr><th>sc</th><td>Extra control information used to select a sub-region of the allocation to be processed or suggest a walking strategy. May be NULL.</td></tr> |
| <tr><th>usrDataLen</th><td>Size of the userData structure. This will be used to perform a shallow copy of the data if necessary.</td></tr> |
| <tr><th>kernel</th><td>Function designator of the kernel function to call, which must be defined with the kernel attribute.</td></tr> |
| <tr><th>...</th><td>Input and output allocations</td></tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Runs the kernel over zero or more input allocations. They are passed after the |
| <a href='rs_for_each.html#android_rs:rs_kernel'>rs_kernel</a> argument. If the specified kernel returns a value, an output allocation |
| must be specified as the last argument. All input allocations, |
| and the output allocation if it exists, must have the same dimensions. |
| </p> |
| |
| <p> This is a synchronous function. A call to this function only returns after all |
| the work has completed. If the kernel |
| function returns any value, the call waits until all results have been written |
| to the output allocation. |
| </p> |
| |
| <p> Up to API level 23, the kernel is implicitly specified as the kernel named |
| "root" in the specified script, and only a single input allocation can be used. |
| Starting in API level 24, an arbitrary kernel function can be used, |
| as specified by the kernel argument. |
| The kernel must be defined in the current script. In addition, more than one |
| input can be used. |
| </p> |
| |
| <p> For example,<code><br/> |
| float __attribute__((kernel)) square(float a) {<br/> |
| return a * a;<br/> |
| }<br/> |
| <br/> |
| void compute(rs_allocation ain, rs_allocation aout) {<br/> |
| rsForEach(square, ain, aout);<br/> |
| }<br/> |
| <br/></code> |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsForEachWithOptions'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsForEachWithOptions</span> |
| <span class='normal'>: Launches a kernel with options</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td>void rsForEachWithOptions(<a href='rs_for_each.html#android_rs:rs_kernel'>rs_kernel</a> kernel, <a href='rs_for_each.html#android_rs:rs_script_call_t'>rs_script_call_t</a>* options, ... ...); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 24</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> |
| <table class='jd-tagtable'><tbody> |
| <tr><th>kernel</th><td>Function designator to a function that is defined with the kernel attribute.</td></tr> |
| <tr><th>options</th><td>Launch options</td></tr> |
| <tr><th>...</th><td>Input and output allocations</td></tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Launches kernel in a way similar to <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a>. However, instead of processing |
| all cells in the input, this function only processes cells in the subspace of |
| the index space specified in options. With the index space explicitly specified |
| by options, no input or output allocation is required for a kernel launch using |
| this API. If allocations are passed in, they must match the number of arguments |
| and return value expected by the kernel function. The output allocation is |
| present if and only if the kernel has a non-void return value. |
| </p> |
| |
| <p> For example,<code><br/> |
| rs_script_call_t opts = {0};<br/> |
| opts.xStart = 0;<br/> |
| opts.xEnd = dimX;<br/> |
| opts.yStart = 0;<br/> |
| opts.yEnd = dimY / 2;<br/> |
| rsForEachWithOptions(foo, &opts, out, out);<br/> |
| </code> |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetArray0'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetArray0</span> |
| <span class='normal'>: Index in the Array0 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetArray0(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the index in the Array0 dimension of the cell being processed, as specified |
| by the supplied kernel context. |
| </p> |
| |
| <p> The kernel context contains common characteristics of the allocations being iterated |
| over and rarely used indices, like the Array0 index. |
| </p> |
| |
| <p> You can access the kernel context by adding a special parameter named "context" of |
| type rs_kernel_context to your kernel function. For example,<br/> |
| <code>short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {<br/> |
| // The current index in the common x, y, z dimensions are accessed by<br/> |
| // adding these variables as arguments. For the more rarely used indices<br/> |
| // to the other dimensions, extract them from the kernel context:<br/> |
| uint32_t index_a0 = rsGetArray0(context);<br/> |
| //...<br/> |
| }<br/></code> |
| </p> |
| |
| <p> This function returns 0 if the Array0 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetArray1'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetArray1</span> |
| <span class='normal'>: Index in the Array1 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetArray1(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the index in the Array1 dimension of the cell being processed, as specified |
| by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array1 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetArray2'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetArray2</span> |
| <span class='normal'>: Index in the Array2 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetArray2(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the index in the Array2 dimension of the cell being processed, |
| as specified by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation |
| of the context. |
| </p> |
| |
| <p> Returns 0 if the Array2 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetArray3'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetArray3</span> |
| <span class='normal'>: Index in the Array3 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetArray3(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the index in the Array3 dimension of the cell being processed, as specified |
| by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array3 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimArray0'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimArray0</span> |
| <span class='normal'>: Size of the Array0 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimArray0(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the Array0 dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array0 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimArray1'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimArray1</span> |
| <span class='normal'>: Size of the Array1 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimArray1(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the Array1 dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array1 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimArray2'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimArray2</span> |
| <span class='normal'>: Size of the Array2 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimArray2(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the Array2 dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array2 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimArray3'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimArray3</span> |
| <span class='normal'>: Size of the Array3 dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimArray3(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the Array3 dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Array3 dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimHasFaces'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimHasFaces</span> |
| <span class='normal'>: Presence of more than one face for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td>bool rsGetDimHasFaces(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Returns</h5> |
| <table class='jd-tagtable'><tbody> |
| <tr><td>Returns true if more than one face is present, false otherwise.</td></tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> If the kernel is iterating over a cubemap, this function returns true if there's more |
| than one face present. In all other cases, it returns false. See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an |
| explanation of the context. |
| </p> |
| |
| <p> <a href='rs_object_info.html#android_rs:rsAllocationGetDimFaces'>rsAllocationGetDimFaces</a>() is similar but returns 0 or 1 instead of a bool. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimLod'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimLod</span> |
| <span class='normal'>: Number of levels of detail for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimLod(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the number of levels of detail for the specified kernel context. This is useful |
| for mipmaps. See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if Level of Detail is not used. |
| </p> |
| |
| <p> <a href='rs_object_info.html#android_rs:rsAllocationGetDimLOD'>rsAllocationGetDimLOD</a>() is similar but returns 0 or 1 instead the actual |
| number of levels. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimX'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimX</span> |
| <span class='normal'>: Size of the X dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimX(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the X dimension for the specified kernel context. |
| </p> |
| |
| <p> The kernel context contains common characteristics of the allocations being iterated |
| over and rarely used indices, like the Array0 index. |
| </p> |
| |
| <p> You can access it by adding a special parameter named "context" of |
| type rs_kernel_context to your kernel function. For example,<br/> |
| <code>int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {<br/> |
| uint32_t size = rsGetDimX(context); //...<br/></code> |
| </p> |
| |
| <p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimX'>rsAllocationGetDimX</a>(). |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimY'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimY</span> |
| <span class='normal'>: Size of the Y dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimY(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the X dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Y dimension is not present. |
| </p> |
| |
| <p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimY'>rsAllocationGetDimY</a>(). |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetDimZ'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetDimZ</span> |
| <span class='normal'>: Size of the Z dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetDimZ(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the size of the Z dimension for the specified kernel context. |
| See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns 0 if the Z dimension is not present. |
| </p> |
| |
| <p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimZ'>rsAllocationGetDimZ</a>(). |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetFace'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetFace</span> |
| <span class='normal'>: Coordinate of the Face for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_object_types.html#android_rs:rs_allocation_cubemap_face'>rs_allocation_cubemap_face</a> rsGetFace(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the face on which the cell being processed is found, as specified by the |
| supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. |
| </p> |
| |
| <p> Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not |
| present. |
| </p> |
| </div> |
| </div> |
| |
| <a name='android_rs:rsGetLod'></a> |
| <div class='jd-details'> |
| <h4 class='jd-details-title'> |
| <span class='sympad'>rsGetLod</span> |
| <span class='normal'>: Index in the Levels of Detail dimension for the specified kernel context</span> |
| </h4> |
| <div class='jd-details-descr'> |
| <table class='jd-tagtable'><tbody> |
| <tr> |
| <td><a href='rs_value_types.html#android_rs:uint32_t'>uint32_t</a> rsGetLod(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); |
| </td> |
| <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> |
| </td> |
| </tr> |
| </tbody></table> |
| </div> |
| <div class='jd-tagdata jd-tagdescr'> |
| <p> Returns the index in the Levels of Detail dimension of the cell being processed, |
| as specified by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of |
| the context. |
| </p> |
| |
| <p> Returns 0 if the Levels of Detail dimension is not present. |
| </p> |
| </div> |
| </div> |
| |
| </div> |