Is it possible to program GPU for Android

耗尽温柔 提交于 2019-11-30 17:48:12

Actually Renderscript Compute doesn't use the GPU at this time, but is designed for it.

From Romain Guy who works on the Android platform:

  • Renderscript Compute is currently CPU bound but with the for_each construct it will take advantage of multiple cores immediately
  • Renderscript Compute was designed to run on the GPU and/or the CPU
  • Renderscript Compute avoids having to write JNI code and gives you architecture independent, high performance results
  • Renderscript Compute can, as of Android 4.1, benefit from SIMD optimizations (NEON on ARM)

https://groups.google.com/d/msg/android-developers/m194NFf_ZqA/Whq4qWisv5MJ

yes , it is possible .

you can use either renderscript or opengGL ES 2.0 .

renderscript is available on android 3.0 and above , and openGL ES 2.0 is available on about 95% of the devices.

As of Android 4.2, Renderscript can involve GPU in computations (in certain cases). More information here: http://android-developers.blogspot.com/2013/01/evolution-of-renderscript-performance.html

As I understand, ScriptIntrinsic subclasses are well-optimized to run on GPU on compatible hardware (for example, Nexus10 with Mali T604). Documentation: http://developer.android.com/reference/android/renderscript/ScriptIntrinsic.html

Of course you can decide to use OpenCL, but Renderscript is guaranteed (by Google, being a part of Android itself) to be running even on hardware which doesn't support GPGPU computation and will use any other available acceleration means supported by hardware it is running on.

There are several options: You can use OpenGL ES 2.0, which is supported by almost all devices but has limited functionality for GPGPU. You can use OpenGL ES 3.0, with which you can do much more in terms of GPU processing. Or you can use RenderScript, but this is platform-specific and furthermore does not give you any influence on whether your algorithms run on the GPU or the CPU. A summary about this topic can be found in this master's thesis: Parallel Computing for Digital Signal Processing on Mobile Device GPUs.

You should also check out ogles_gpgpu, which allows GPGPU via OpenGL ES 2.0 on Android and iOS.

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