views:

1309

answers:

6

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?

+1  A: 

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.

euge1979
+1  A: 

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.

artificialidiot
+4  A: 

Why not measure the time it takes to do something, and if it took too long, you disable some effects.

svinto
This seems the most reasonable suggestion: do performance testing and gracefully degrade features to keep frame rates up.
Godeke
A temporary stutter in the system could cause the effect to be disabled when the system is actually capable of handling it with GPU acceleration. Degradation of any kind would require a performance analysis that's immune to hiccups. If the effect is strictly on or off, then there's the problem that performance measurements used for deciding whether to apply or remove the effect would be strongly affected by the application and removal of the effect. If the effect is in fact degradable, then the timing would have to be well-adjusted to the effect in order for it to effectively self-adjust.
Triynko
+1  A: 

In ActionScript 3 there is the Capabilities class. Maybe you find there what you're looking for.

Luke
+2  A: 

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

+1  A: 

To detect GPU acceleration you can read the wmodeGPU stage property.

Luke