1page.title=RenderScript Kernel Invocation Functions and Types 2 3@jd:body 4 5<div class='renderscript'> 6<h2>Overview</h2> 7<p> The <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a>() function can be used to invoke the root kernel of a script. 8</p> 9 10<p> The other functions are used to get the characteristics of the invocation of 11an executing kernel, like dimensions and current indices. These functions take 12a <a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> as argument. 13</p> 14<h2>Summary</h2> 15<table class='jd-sumtable'><tbody> 16 <tr><th colspan='2'>Types</th></tr> 17 <tr class='alt-color api apilevel-1'> 18 <td class='jd-linkcol'> 19 <a href='rs_for_each.html#android_rs:rs_for_each_strategy_t'>rs_for_each_strategy_t</a> 20 </td> 21 <td class='jd-descrcol' width='100%'> 22 Suggested cell processing order 23 </td> 24 </tr> 25 <tr class='alt-color api apilevel-1'> 26 <td class='jd-linkcol'> 27 <a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> 28 </td> 29 <td class='jd-descrcol' width='100%'> 30 Handle to a kernel invocation context 31 </td> 32 </tr> 33 <tr class='alt-color api apilevel-1'> 34 <td class='jd-linkcol'> 35 <a href='rs_for_each.html#android_rs:rs_script_call_t'>rs_script_call_t</a> 36 </td> 37 <td class='jd-descrcol' width='100%'> 38 Cell iteration information 39 </td> 40 </tr> 41</tbody></table> 42<table class='jd-sumtable'><tbody> 43 <tr><th colspan='2'>Functions</th></tr> 44 <tr class='alt-color api apilevel-1'> 45 <td class='jd-linkcol'> 46 <a href='rs_for_each.html#android_rs:rsForEach'>rsForEach</a> 47 </td> 48 <td class='jd-descrcol' width='100%'> 49 Invoke the root kernel of a script 50 </td> 51 </tr> 52 <tr class='alt-color api apilevel-1'> 53 <td class='jd-linkcol'> 54 <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a> 55 </td> 56 <td class='jd-descrcol' width='100%'> 57 Index in the Array0 dimension for the specified kernel context 58 </td> 59 </tr> 60 <tr class='alt-color api apilevel-1'> 61 <td class='jd-linkcol'> 62 <a href='rs_for_each.html#android_rs:rsGetArray1'>rsGetArray1</a> 63 </td> 64 <td class='jd-descrcol' width='100%'> 65 Index in the Array1 dimension for the specified kernel context 66 </td> 67 </tr> 68 <tr class='alt-color api apilevel-1'> 69 <td class='jd-linkcol'> 70 <a href='rs_for_each.html#android_rs:rsGetArray2'>rsGetArray2</a> 71 </td> 72 <td class='jd-descrcol' width='100%'> 73 Index in the Array2 dimension for the specified kernel context 74 </td> 75 </tr> 76 <tr class='alt-color api apilevel-1'> 77 <td class='jd-linkcol'> 78 <a href='rs_for_each.html#android_rs:rsGetArray3'>rsGetArray3</a> 79 </td> 80 <td class='jd-descrcol' width='100%'> 81 Index in the Array3 dimension for the specified kernel context 82 </td> 83 </tr> 84 <tr class='alt-color api apilevel-1'> 85 <td class='jd-linkcol'> 86 <a href='rs_for_each.html#android_rs:rsGetDimArray0'>rsGetDimArray0</a> 87 </td> 88 <td class='jd-descrcol' width='100%'> 89 Size of the Array0 dimension for the specified kernel context 90 </td> 91 </tr> 92 <tr class='alt-color api apilevel-1'> 93 <td class='jd-linkcol'> 94 <a href='rs_for_each.html#android_rs:rsGetDimArray1'>rsGetDimArray1</a> 95 </td> 96 <td class='jd-descrcol' width='100%'> 97 Size of the Array1 dimension for the specified kernel context 98 </td> 99 </tr> 100 <tr class='alt-color api apilevel-1'> 101 <td class='jd-linkcol'> 102 <a href='rs_for_each.html#android_rs:rsGetDimArray2'>rsGetDimArray2</a> 103 </td> 104 <td class='jd-descrcol' width='100%'> 105 Size of the Array2 dimension for the specified kernel context 106 </td> 107 </tr> 108 <tr class='alt-color api apilevel-1'> 109 <td class='jd-linkcol'> 110 <a href='rs_for_each.html#android_rs:rsGetDimArray3'>rsGetDimArray3</a> 111 </td> 112 <td class='jd-descrcol' width='100%'> 113 Size of the Array3 dimension for the specified kernel context 114 </td> 115 </tr> 116 <tr class='alt-color api apilevel-1'> 117 <td class='jd-linkcol'> 118 <a href='rs_for_each.html#android_rs:rsGetDimHasFaces'>rsGetDimHasFaces</a> 119 </td> 120 <td class='jd-descrcol' width='100%'> 121 Presence of more than one face for the specified kernel context 122 </td> 123 </tr> 124 <tr class='alt-color api apilevel-1'> 125 <td class='jd-linkcol'> 126 <a href='rs_for_each.html#android_rs:rsGetDimLod'>rsGetDimLod</a> 127 </td> 128 <td class='jd-descrcol' width='100%'> 129 Number of levels of detail for the specified kernel context 130 </td> 131 </tr> 132 <tr class='alt-color api apilevel-1'> 133 <td class='jd-linkcol'> 134 <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a> 135 </td> 136 <td class='jd-descrcol' width='100%'> 137 Size of the X dimension for the specified kernel context 138 </td> 139 </tr> 140 <tr class='alt-color api apilevel-1'> 141 <td class='jd-linkcol'> 142 <a href='rs_for_each.html#android_rs:rsGetDimY'>rsGetDimY</a> 143 </td> 144 <td class='jd-descrcol' width='100%'> 145 Size of the Y dimension for the specified kernel context 146 </td> 147 </tr> 148 <tr class='alt-color api apilevel-1'> 149 <td class='jd-linkcol'> 150 <a href='rs_for_each.html#android_rs:rsGetDimZ'>rsGetDimZ</a> 151 </td> 152 <td class='jd-descrcol' width='100%'> 153 Size of the Z dimension for the specified kernel context 154 </td> 155 </tr> 156 <tr class='alt-color api apilevel-1'> 157 <td class='jd-linkcol'> 158 <a href='rs_for_each.html#android_rs:rsGetFace'>rsGetFace</a> 159 </td> 160 <td class='jd-descrcol' width='100%'> 161 Coordinate of the Face for the specified kernel context 162 </td> 163 </tr> 164 <tr class='alt-color api apilevel-1'> 165 <td class='jd-linkcol'> 166 <a href='rs_for_each.html#android_rs:rsGetLod'>rsGetLod</a> 167 </td> 168 <td class='jd-descrcol' width='100%'> 169 Index in the Levels of Detail dimension for the specified kernel context 170 </td> 171 </tr> 172</tbody></table> 173<h2>Types</h2> 174<a name='android_rs:rs_for_each_strategy_t'></a> 175<div class='jd-details'> 176 <h4 class='jd-details-title'> 177 <span class='sympad'>rs_for_each_strategy_t</span> 178 <span class='normal'>: Suggested cell processing order</span> 179 </h4> 180 <div class='jd-details-descr'> 181<p>An enum with the following values: 182</p> 183 <table class='jd-tagtable'><tbody> 184 <tr><th>RS_FOR_EACH_STRATEGY_SERIAL = 0</th><td>Prefer contiguous memory regions.</td></tr> 185 <tr><th>RS_FOR_EACH_STRATEGY_DONT_CARE = 1</th><td>No prefrences.</td></tr> 186 <tr><th>RS_FOR_EACH_STRATEGY_DST_LINEAR = 2</th><td>Prefer DST.</td></tr> 187 <tr><th>RS_FOR_EACH_STRATEGY_TILE_SMALL = 3</th><td>Prefer processing small rectangular regions.</td></tr> 188 <tr><th>RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4</th><td>Prefer processing medium rectangular regions.</td></tr> 189 <tr><th>RS_FOR_EACH_STRATEGY_TILE_LARGE = 5</th><td>Prefer processing large rectangular regions.</td></tr> 190 </tbody></table><br/> 191<p> This type is used to suggest how the invoked kernel should iterate over the cells of the 192allocations. This is a hint only. Implementations may not follow the suggestion. 193</p> 194 195<p> This specification can help the caching behavior of the running kernel, e.g. the cache 196locality when the processing is distributed over multiple cores. 197</p> 198 </div> 199</div> 200 201<a name='android_rs:rs_kernel_context'></a> 202<div class='jd-details'> 203 <h4 class='jd-details-title'> 204 <span class='sympad'>rs_kernel_context</span> 205 <span class='normal'>: Handle to a kernel invocation context</span> 206 </h4> 207 <div class='jd-details-descr'> 208<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> 209</p> 210<p> The kernel context contains common characteristics of the allocations being iterated 211over, like dimensions. It also contains rarely used indices of the currently processed 212cell, like the Array0 index or the current level of detail. 213</p> 214 215<p> You can access the kernel context by adding a special parameter named "context" of type 216rs_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. 217</p> 218 </div> 219</div> 220 221<a name='android_rs:rs_script_call_t'></a> 222<div class='jd-details'> 223 <h4 class='jd-details-title'> 224 <span class='sympad'>rs_script_call_t</span> 225 <span class='normal'>: Cell iteration information</span> 226 </h4> 227 <div class='jd-details-descr'> 228<p>A structure with the following fields: </p> 229 <table class='jd-tagtable'><tbody> 230 <tr><th>rs_for_each_strategy_t strategy</th><td>Currently ignored. In the future, will be suggested cell iteration strategy.</td></tr> 231 <tr><th>uint32_t xStart</th><td>Starting index in the X dimension.</td></tr> 232 <tr><th>uint32_t xEnd</th><td>Ending index (exclusive) in the X dimension.</td></tr> 233 <tr><th>uint32_t yStart</th><td>Starting index in the Y dimension.</td></tr> 234 <tr><th>uint32_t yEnd</th><td>Ending index (exclusive) in the Y dimension.</td></tr> 235 <tr><th>uint32_t zStart</th><td>Starting index in the Z dimension.</td></tr> 236 <tr><th>uint32_t zEnd</th><td>Ending index (exclusive) in the Z dimension.</td></tr> 237 <tr><th>uint32_t arrayStart</th><td>Starting index in the Array0 dimension.</td></tr> 238 <tr><th>uint32_t arrayEnd</th><td>Ending index (exclusive) in the Array0 dimension.</td></tr> 239 <tr><th>uint32_t array1Start</th><td>Starting index in the Array1 dimension.</td></tr> 240 <tr><th>uint32_t array1End</th><td>Ending index (exclusive) in the Array1 dimension.</td></tr> 241 <tr><th>uint32_t array2Start</th><td>Starting index in the Array2 dimension.</td></tr> 242 <tr><th>uint32_t array2End</th><td>Ending index (exclusive) in the Array2 dimension.</td></tr> 243 <tr><th>uint32_t array3Start</th><td>Starting index in the Array3 dimension.</td></tr> 244 <tr><th>uint32_t array3End</th><td>Ending index (exclusive) in the Array3 dimension.</td></tr> 245 </tbody></table><br/> 246<p> This structure is used to provide iteration information to a rsForEach call. 247It is currently used to restrict processing to a subset of cells. In future 248versions, it will also be used to provide hint on how to best iterate over 249the cells. 250</p> 251 252<p> The Start fields are inclusive and the End fields are exclusive. E.g. to iterate 253over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8. 254</p> 255 </div> 256</div> 257 258<h2>Functions</h2> 259<a name='android_rs:rsForEach'></a> 260<div class='jd-details'> 261 <h4 class='jd-details-title'> 262 <span class='sympad'>rsForEach</span> 263 <span class='normal'>: Invoke the root kernel of a script</span> 264 </h4> 265 <div class='jd-details-descr'> 266 <table class='jd-tagtable'><tbody> 267 <tr> 268 <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); 269</td> 270 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14</a> 271 </td> 272 </tr> 273 <tr> 274 <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); 275</td> 276 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 277 </td> 278 </tr> 279 <tr> 280 <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); 281</td> 282 <td> Removed from <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 and higher</a> 283 </td> 284 </tr> 285 <tr> 286 <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); 287</td> 288 <td> <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 - 20</a> 289 </td> 290 </tr> 291 <tr> 292 <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); 293</td> 294 <td> <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 14 - 20</a> 295 </td> 296 </tr> 297 </tbody></table> 298 </div> 299 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Parameters</h5> 300 <table class='jd-tagtable'><tbody> 301 <tr><th>script</th><td>Script to call.</td></tr> 302 <tr><th>input</th><td>Allocation to source data from.</td></tr> 303 <tr><th>output</th><td>Allocation to write date into.</td></tr> 304 <tr><th>usrData</th><td>User defined data to pass to the script. May be NULL.</td></tr> 305 <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> 306 <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> 307 </tbody></table> 308 </div> 309 <div class='jd-tagdata jd-tagdescr'> 310<p> Invoke the kernel named "root" of the specified script. Like other kernels, this root() 311function will be invoked repeatedly over the cells of the specificed allocation, filling 312the output allocation with the results. 313</p> 314 315<p> When rsForEach is called, the root script is launched immediately. rsForEach returns 316only when the script has completed and the output allocation is ready to use. 317</p> 318 319<p> The rs_script argument is typically initialized using a global variable set from Java. 320</p> 321 322<p> The kernel can be invoked with just an input allocation or just an output allocation. 323This can be done by defining an rs_allocation variable and not initializing it. E.g.<code><br/> 324rs_script gCustomScript;<br/> 325void specializedProcessing(rs_allocation in) {<br/> 326 rs_allocation ignoredOut;<br/> 327 rsForEach(gCustomScript, in, ignoredOut);<br/> 328}<br/></code> 329</p> 330 331<p> If both input and output allocations are specified, they must have the same dimensions. 332</p> 333 </div> 334</div> 335 336<a name='android_rs:rsGetArray0'></a> 337<div class='jd-details'> 338 <h4 class='jd-details-title'> 339 <span class='sympad'>rsGetArray0</span> 340 <span class='normal'>: Index in the Array0 dimension for the specified kernel context</span> 341 </h4> 342 <div class='jd-details-descr'> 343 <table class='jd-tagtable'><tbody> 344 <tr> 345 <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); 346</td> 347 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 348 </td> 349 </tr> 350 </tbody></table> 351 </div> 352 <div class='jd-tagdata jd-tagdescr'> 353<p> Returns the index in the Array0 dimension of the cell being processed, as specified 354by the supplied kernel context. 355</p> 356 357<p> The kernel context contains common characteristics of the allocations being iterated 358over and rarely used indices, like the Array0 index. 359</p> 360 361<p> You can access the kernel context by adding a special parameter named "context" of 362type rs_kernel_context to your kernel function. E.g.<br/> 363<code>short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {<br/> 364 // The current index in the common x, y, z dimensions are accessed by<br/> 365 // adding these variables as arguments. For the more rarely used indices<br/> 366 // to the other dimensions, extract them from the kernel context:<br/> 367 uint32_t index_a0 = rsGetArray0(context);<br/> 368 //...<br/> 369}<br/></code> 370</p> 371 372<p> This function returns 0 if the Array0 dimension is not present. 373</p> 374 </div> 375</div> 376 377<a name='android_rs:rsGetArray1'></a> 378<div class='jd-details'> 379 <h4 class='jd-details-title'> 380 <span class='sympad'>rsGetArray1</span> 381 <span class='normal'>: Index in the Array1 dimension for the specified kernel context</span> 382 </h4> 383 <div class='jd-details-descr'> 384 <table class='jd-tagtable'><tbody> 385 <tr> 386 <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); 387</td> 388 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 389 </td> 390 </tr> 391 </tbody></table> 392 </div> 393 <div class='jd-tagdata jd-tagdescr'> 394<p> Returns the index in the Array1 dimension of the cell being processed, as specified 395by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. 396</p> 397 398<p> Returns 0 if the Array1 dimension is not present. 399</p> 400 </div> 401</div> 402 403<a name='android_rs:rsGetArray2'></a> 404<div class='jd-details'> 405 <h4 class='jd-details-title'> 406 <span class='sympad'>rsGetArray2</span> 407 <span class='normal'>: Index in the Array2 dimension for the specified kernel context</span> 408 </h4> 409 <div class='jd-details-descr'> 410 <table class='jd-tagtable'><tbody> 411 <tr> 412 <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); 413</td> 414 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 415 </td> 416 </tr> 417 </tbody></table> 418 </div> 419 <div class='jd-tagdata jd-tagdescr'> 420<p> Returns the index in the Array2 dimension of the cell being processed, 421as specified by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation 422of the context. 423</p> 424 425<p> Returns 0 if the Array2 dimension is not present. 426</p> 427 </div> 428</div> 429 430<a name='android_rs:rsGetArray3'></a> 431<div class='jd-details'> 432 <h4 class='jd-details-title'> 433 <span class='sympad'>rsGetArray3</span> 434 <span class='normal'>: Index in the Array3 dimension for the specified kernel context</span> 435 </h4> 436 <div class='jd-details-descr'> 437 <table class='jd-tagtable'><tbody> 438 <tr> 439 <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); 440</td> 441 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 442 </td> 443 </tr> 444 </tbody></table> 445 </div> 446 <div class='jd-tagdata jd-tagdescr'> 447<p> Returns the index in the Array3 dimension of the cell being processed, as specified 448by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. 449</p> 450 451<p> Returns 0 if the Array3 dimension is not present. 452</p> 453 </div> 454</div> 455 456<a name='android_rs:rsGetDimArray0'></a> 457<div class='jd-details'> 458 <h4 class='jd-details-title'> 459 <span class='sympad'>rsGetDimArray0</span> 460 <span class='normal'>: Size of the Array0 dimension for the specified kernel context</span> 461 </h4> 462 <div class='jd-details-descr'> 463 <table class='jd-tagtable'><tbody> 464 <tr> 465 <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); 466</td> 467 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 468 </td> 469 </tr> 470 </tbody></table> 471 </div> 472 <div class='jd-tagdata jd-tagdescr'> 473<p> Returns the size of the Array0 dimension for the specified kernel context. 474See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 475</p> 476 477<p> Returns 0 if the Array0 dimension is not present. 478</p> 479 </div> 480</div> 481 482<a name='android_rs:rsGetDimArray1'></a> 483<div class='jd-details'> 484 <h4 class='jd-details-title'> 485 <span class='sympad'>rsGetDimArray1</span> 486 <span class='normal'>: Size of the Array1 dimension for the specified kernel context</span> 487 </h4> 488 <div class='jd-details-descr'> 489 <table class='jd-tagtable'><tbody> 490 <tr> 491 <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); 492</td> 493 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 494 </td> 495 </tr> 496 </tbody></table> 497 </div> 498 <div class='jd-tagdata jd-tagdescr'> 499<p> Returns the size of the Array1 dimension for the specified kernel context. 500See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 501</p> 502 503<p> Returns 0 if the Array1 dimension is not present. 504</p> 505 </div> 506</div> 507 508<a name='android_rs:rsGetDimArray2'></a> 509<div class='jd-details'> 510 <h4 class='jd-details-title'> 511 <span class='sympad'>rsGetDimArray2</span> 512 <span class='normal'>: Size of the Array2 dimension for the specified kernel context</span> 513 </h4> 514 <div class='jd-details-descr'> 515 <table class='jd-tagtable'><tbody> 516 <tr> 517 <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); 518</td> 519 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 520 </td> 521 </tr> 522 </tbody></table> 523 </div> 524 <div class='jd-tagdata jd-tagdescr'> 525<p> Returns the size of the Array2 dimension for the specified kernel context. 526See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 527</p> 528 529<p> Returns 0 if the Array2 dimension is not present. 530</p> 531 </div> 532</div> 533 534<a name='android_rs:rsGetDimArray3'></a> 535<div class='jd-details'> 536 <h4 class='jd-details-title'> 537 <span class='sympad'>rsGetDimArray3</span> 538 <span class='normal'>: Size of the Array3 dimension for the specified kernel context</span> 539 </h4> 540 <div class='jd-details-descr'> 541 <table class='jd-tagtable'><tbody> 542 <tr> 543 <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); 544</td> 545 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 546 </td> 547 </tr> 548 </tbody></table> 549 </div> 550 <div class='jd-tagdata jd-tagdescr'> 551<p> Returns the size of the Array3 dimension for the specified kernel context. 552See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 553</p> 554 555<p> Returns 0 if the Array3 dimension is not present. 556</p> 557 </div> 558</div> 559 560<a name='android_rs:rsGetDimHasFaces'></a> 561<div class='jd-details'> 562 <h4 class='jd-details-title'> 563 <span class='sympad'>rsGetDimHasFaces</span> 564 <span class='normal'>: Presence of more than one face for the specified kernel context</span> 565 </h4> 566 <div class='jd-details-descr'> 567 <table class='jd-tagtable'><tbody> 568 <tr> 569 <td>bool rsGetDimHasFaces(<a href='rs_for_each.html#android_rs:rs_kernel_context'>rs_kernel_context</a> context); 570</td> 571 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 572 </td> 573 </tr> 574 </tbody></table> 575 </div> 576 <div class='jd-tagdata'> <h5 class='jd-tagtitle'>Returns</h5> 577 <table class='jd-tagtable'><tbody> 578 <tr><td>Returns true if more than one face is present, false otherwise.</td></tr> 579 </tbody></table> 580 </div> 581 <div class='jd-tagdata jd-tagdescr'> 582<p> If the kernel is iterating over a cubemap, this function returns true if there's more 583than one face present. In all other cases, it returns false. See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an 584explanation of the context. 585</p> 586 587<p> <a href='rs_object_info.html#android_rs:rsAllocationGetDimFaces'>rsAllocationGetDimFaces</a>() is similar but returns 0 or 1 instead of a bool. 588</p> 589 </div> 590</div> 591 592<a name='android_rs:rsGetDimLod'></a> 593<div class='jd-details'> 594 <h4 class='jd-details-title'> 595 <span class='sympad'>rsGetDimLod</span> 596 <span class='normal'>: Number of levels of detail for the specified kernel context</span> 597 </h4> 598 <div class='jd-details-descr'> 599 <table class='jd-tagtable'><tbody> 600 <tr> 601 <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); 602</td> 603 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 604 </td> 605 </tr> 606 </tbody></table> 607 </div> 608 <div class='jd-tagdata jd-tagdescr'> 609<p> Returns the number of levels of detail for the specified kernel context. This is useful 610for mipmaps. See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 611</p> 612 613<p> Returns 0 if Level of Detail is not used. 614</p> 615 616<p> <a href='rs_object_info.html#android_rs:rsAllocationGetDimLOD'>rsAllocationGetDimLOD</a>() is similar but returns 0 or 1 instead the actual 617number of levels. 618</p> 619 </div> 620</div> 621 622<a name='android_rs:rsGetDimX'></a> 623<div class='jd-details'> 624 <h4 class='jd-details-title'> 625 <span class='sympad'>rsGetDimX</span> 626 <span class='normal'>: Size of the X dimension for the specified kernel context</span> 627 </h4> 628 <div class='jd-details-descr'> 629 <table class='jd-tagtable'><tbody> 630 <tr> 631 <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); 632</td> 633 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 634 </td> 635 </tr> 636 </tbody></table> 637 </div> 638 <div class='jd-tagdata jd-tagdescr'> 639<p> Returns the size of the X dimension for the specified kernel context. 640</p> 641 642<p> The kernel context contains common characteristics of the allocations being iterated 643over and rarely used indices, like the Array0 index. 644</p> 645 646<p> You can access it by adding a special parameter named "context" of 647type rs_kernel_context to your kernel function. E.g.<br/> 648<code>int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {<br/> 649 uint32_t size = rsGetDimX(context); //...<br/></code> 650</p> 651 652<p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimX'>rsAllocationGetDimX</a>(). 653</p> 654 </div> 655</div> 656 657<a name='android_rs:rsGetDimY'></a> 658<div class='jd-details'> 659 <h4 class='jd-details-title'> 660 <span class='sympad'>rsGetDimY</span> 661 <span class='normal'>: Size of the Y dimension for the specified kernel context</span> 662 </h4> 663 <div class='jd-details-descr'> 664 <table class='jd-tagtable'><tbody> 665 <tr> 666 <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); 667</td> 668 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 669 </td> 670 </tr> 671 </tbody></table> 672 </div> 673 <div class='jd-tagdata jd-tagdescr'> 674<p> Returns the size of the X dimension for the specified kernel context. 675See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 676</p> 677 678<p> Returns 0 if the Y dimension is not present. 679</p> 680 681<p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimY'>rsAllocationGetDimY</a>(). 682</p> 683 </div> 684</div> 685 686<a name='android_rs:rsGetDimZ'></a> 687<div class='jd-details'> 688 <h4 class='jd-details-title'> 689 <span class='sympad'>rsGetDimZ</span> 690 <span class='normal'>: Size of the Z dimension for the specified kernel context</span> 691 </h4> 692 <div class='jd-details-descr'> 693 <table class='jd-tagtable'><tbody> 694 <tr> 695 <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); 696</td> 697 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 698 </td> 699 </tr> 700 </tbody></table> 701 </div> 702 <div class='jd-tagdata jd-tagdescr'> 703<p> Returns the size of the Z dimension for the specified kernel context. 704See <a href='rs_for_each.html#android_rs:rsGetDimX'>rsGetDimX</a>() for an explanation of the context. 705</p> 706 707<p> Returns 0 if the Z dimension is not present. 708</p> 709 710<p> To get the dimension of specific allocation, use <a href='rs_object_info.html#android_rs:rsAllocationGetDimZ'>rsAllocationGetDimZ</a>(). 711</p> 712 </div> 713</div> 714 715<a name='android_rs:rsGetFace'></a> 716<div class='jd-details'> 717 <h4 class='jd-details-title'> 718 <span class='sympad'>rsGetFace</span> 719 <span class='normal'>: Coordinate of the Face for the specified kernel context</span> 720 </h4> 721 <div class='jd-details-descr'> 722 <table class='jd-tagtable'><tbody> 723 <tr> 724 <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); 725</td> 726 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 727 </td> 728 </tr> 729 </tbody></table> 730 </div> 731 <div class='jd-tagdata jd-tagdescr'> 732<p> Returns the face on which the cell being processed is found, as specified by the 733supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of the context. 734</p> 735 736<p> Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not 737present. 738</p> 739 </div> 740</div> 741 742<a name='android_rs:rsGetLod'></a> 743<div class='jd-details'> 744 <h4 class='jd-details-title'> 745 <span class='sympad'>rsGetLod</span> 746 <span class='normal'>: Index in the Levels of Detail dimension for the specified kernel context</span> 747 </h4> 748 <div class='jd-details-descr'> 749 <table class='jd-tagtable'><tbody> 750 <tr> 751 <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); 752</td> 753 <td> Added in <a href='http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels'>API level 23</a> 754 </td> 755 </tr> 756 </tbody></table> 757 </div> 758 <div class='jd-tagdata jd-tagdescr'> 759<p> Returns the index in the Levels of Detail dimension of the cell being processed, 760as specified by the supplied kernel context. See <a href='rs_for_each.html#android_rs:rsGetArray0'>rsGetArray0</a>() for an explanation of 761the context. 762</p> 763 764<p> Returns 0 if the Levels of Detail dimension is not present. 765</p> 766 </div> 767</div> 768 769</div> 770