GPU Rendering in Adobe AIR for Android

I recently started playing around with GPU rendering in AIR for Android, and I decided to do a quick video demonstrating the differences between CPU and GPU rendering modes.

The code for this example is available here on GitHub.

As you can see from the example application, the key to offloading rendering to the GPU is to do three things:

1. Set rendering mode to GPU in your application descriptor like this:


2. Make sure cacheAsBitmap is set to true on your DisplayObject like this:

square.cacheAsBitmap = true;

3. Make sure to assign a Matrix to the cacheAsBitmapMatrix property on your DisplayObject like this:

square.cacheAsBitmapMatrix = new Matrix();

That’s all you have to do to offload your rending to the GPU and to free your CPU up for more important tasks.

16 Responses to GPU Rendering in Adobe AIR for Android

  1. Bart says:

    Can you expand a bit more on the pros and cons of using this rendermode? I’m wondering about stuff like if this has an effect on the battery life, and what kind of applications will benefit.

    Also I wonder if you need to enable cacheAsBitmap on every DisplaybObject, and what will happen when you don’t? Will it use the normal renderer and blend the GPU rendered content back in? Also: what is rendering the content that is actually being cachedAsBitmap (like the nested contents of a Sprite)?

    And what exactly does the GPU do? Only compositing (blending) of bitmaps? Or also transformation? How does all this go with vector art? And are there usage situations that will seriously mess thing up if you enable GPU? (I imagine playing a video nested somewhere could become interesting, using a timeline Sound (messed up framerate and some magic stuff), or maybe using loads of BitmapFilters).

    Maybe this can be a feature article: GPU rendering sounds very cool and feels like a nice improvement, but i’m not really sure what we’re dealing with.

  2. Tony says:

    That’s an impressive difference in performance. Do you know if it’s possible to force GPU rendering in the 10.1 browser plugin version for Android? If so, I’d love to try it on my own personal work.

  3. Pingback: Air on Android CPU vs GPU Demo | Android Air Apps

  4. Pingback: Flex learner | Blog | GPU Rendering in Adobe AIR for Android « Christian Cantrell

  5. Mike Slinn says:

    Is there a way for Flex apps to offload processing to the GPU? I’m interested in desktops (perhaps using nVidia’s CUDA) and Android

  6. Pingback: @renaun posts: GPU renderMode for AIR mobile profile and caching confusion

  7. Take the GPU vs CPU renderMode a part from caching yields some interesting results.

  8. TK says:

    Awesome. Keep on posting these gems! …pretty pretty please 🙂

  9. Pingback: Adobe AIR Mobile: Application performance optimization on Android « New Movieclip()

  10. Chrisz says:


    Thanks for this Tutorial.
    Is the Performance for long xmllist (xml Array) also faster ?
    Ich have much entrys in a xmllist.

    Thanks, gerat posting!

  11. Pingback: » Mobile Development: Native vs. Adobe Air

  12. firos says:

    Hello Sir,

    Is it possible to make an AIR application to read ePub data?
    It seems Adobe Digital Editions are made by Air. is it?
    Very difficult to see its tutorial on net to make a ePub reader in Air/Flex/Flash using AS3.0

    It would great if you can give me a clue that whether it is possible or not?

    Thanks a lot


  13. Apollonas says:

    Great Tutorial!
    I just wanted to ask about Augmented reality on Adobe AIR (using papervision3d and Flartoolkit)? Because i altready triy it but “gpu” doesn’t helps at all.. It is very slow and it’s craches!! Any other advice?
    Thank you

  14. Hi Christian — I’ve been developing a test app to compare GPU performance when using various settings combinations: cacheAsBitmap, cacheAsBitmapMatrix, blitting, raster or vector graphics, translation, alpha and StageQuality. I’ve made the source available so others can run it on their mobile devices and make their own comparisons. Have a look:

  15. Pingback: GPU on android / air - Chris Underhill

  16. Dimon says:

    Good tutorial, thanks.
    When I use cacheAsBitmap=false and don’t use the cacheAsBitmapMatrix I have exactly the same performance on Galaxy4S. Seems these settings don’t change much at least on my device and I consistently get 50pfs on GPU mode and 15-20 in CPU mode with 15 squares. GPU mode is awesome, I had to spawn 50 squares before seeing fps to drop to 40 🙂