Documentation for Androids Renderscript advanced rsForEach call

无人久伴 提交于 2019-12-10 15:30:54

问题


I've a question about how Androids Renderscript rsForEach function with the rs_script_call_t* argument works. In the examples only the other (simple) rsForEach function is used, so that doesn't help me. I'd like to change the xStart and xEnd of my array and experiment with the different RS_FOR_EACH_STRATEGYs. I understand that I've to construct a rs_script_call_t struct and set the fields to the proper values. However, any attempt to use this rsForEach call result in a SIGSEGV and a coredump.

In the rs_script_call struct (in rs_math.rsh):

  • What are the xStart, xEnd, yStart, yEnd, zStart, zEnd values referring to? Indices or pointers?
  • What are the arrayStart and arrayEnd values referring to? Indices or pointers?
  • What are the default values of these?

Is there any more documentation (or examples) that explain how to properly use the rsForEach function with the rs_script_call_t* argument?


回答1:


The x/y/z/start/end values are indices to the memory allocation that the compute script is working on. The struct can limit a rsForEach call to a subregion of an allocation.

For example, for an allocation that is 640x480, you could define xStart = 100; xEnd = 200; yStart = 100; yEnd = 200. Then the foreach call would launch on a 100x100 region of the allocation.

The arrayStart and arrayEnd right now are not used currently, but are defined for a future release that will support array dimensions in allocations.

Default values are undefined, you need to define your own values in the struct. If you do not use the struct, the rsForEach call will work on the entire memory allocation.

There is a known bug that causes crashes when using this in Honeycomb, so this might be your issue. It has been fixed in ICS.



来源:https://stackoverflow.com/questions/7191471/documentation-for-androids-renderscript-advanced-rsforeach-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!