问题
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:
- Forcing only cpu usage via adb
- 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