How to use renderscript support mode correctly

送分小仙女□ 提交于 2020-01-06 08:16:33

问题


I recently tested my renderscript code on a Huawei P10 with api28 and I noticed that the runtime of the renderscipt code is around 100ms. For older devices I tested (eg. S6 or Nexus4) the runtime is in the range of 20-30ms.

For the P10 I found two solutions to this problem:

  1. Forcing only cpu usage via adb
  2. got to renderscriptTargetApi 28 (any api < 28 is slow)

Since solution 1 cant be done programmatically, solution 2 seems the only valid way to overcome the issue.

My app is supposed to support min api of 17, so for that I need to enable rendersciptSupportMode. What bothers me is the android documentation which says:

renderscriptTargetApi - Specifies the bytecode version to be generated. We recommend you set this value to the lowest API level able to provide all the functionality you are using and set renderscriptSupportModeEnabled to true

From the features I use, I need no higher renderscript api than 19. So from the documentation point of view, solution 2 is not what they suggest you to configure it. So whats the drawback of setting a high api and support mode?

来源:https://stackoverflow.com/questions/57724788/how-to-use-renderscript-support-mode-correctly

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