Detecting GPU rendering in Flash Player 10
-
23-08-2019 - |
Question
Apparently, in Flash 10, you can use the GPU to calculate shaders, and if the user doesn't have a compatible gpu, it falls back to the cpu. The problem is that the cpu is very slow to calculate the filters, it would be nice to detect if it can't use the gpu, and use fewer effects. Is it possible to detect using actionscript if it's using gpu rendering?
Solution
To detect GPU acceleration you can read the wmodeGPU stage property.
OTHER TIPS
Why not measure the time it takes to do something, and if it took too long, you disable some effects.
If by shaders you mean things you compile with the pixel bender toolkit, they don't run on the GPU. See:
http://www.kaourantin.net/2008/05/adobe-pixel-bender-in-flash-player-10.html
As far as I know there is no API for this, I think that's why Adobe recommends limiting its use to 1 SWF per HTML page and discourages its use in banners, etc. since it can be very expensive for CPU / memory.
I guess a graceful workaround is to let your users choose.
Adobe relies on OpenGL in non-windows platforms to use hardware acceleration and there is no such distinction in OpenGL. To maintain consistency accross platforms (which is one of the strengths of Flash) it is desirable behaviour.
In ActionScript 3 there is the Capabilities class. Maybe you find there what you're looking for.