Renderscript suddenly mysteriously gets a lot slower when handling Java for loop and C pointer memory access

岁酱吖の 提交于 2019-12-07 00:08:37

You are not measuring the actual execution time. Try adding rs.finish() or read the results back from your operation. RS is async, it queues up operations until the buffers fill up or a result is needed. Thus the loop of kernel launches just gets queued up.

Related, I would suggest using the return value from the kernel to write the output buffer or rsSetElementAt_uchar4 rather than binding a global pointer. RS does not make guarantees about the layout of 2D memory and in some cases this code will not generate the correct result due to the stride of the memory being different from the width.

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