Fun with code (since 2006)

Bunnies on the GPU!

03.20.12 Posted in Actionscript 3, Molehill by

Pirate!We recently announced AIR 3.2 with Stage3D support for mobile. Some of you have asked about learning more about GPU programming, best practices and also some of you had questions regarding the BunnyMark test we had in the AIR 3.2 video.

The BunnyMark demo we showed, uses a tiny framework developed internally at Adobe (named GPUSprite). It makes use of support classes called GPUSprite/GPUSpriteLayer, which optimize rendering by allowing a large number of of sprites to be drawn in a single draw call (batching).

This means all those sprites must be able to sample their image from the same sprite sheet.  Performance is really nice.  You could extend it to multiple sprite sheets, but you will have to organize your content into layers with one layer per SpriteSheet.

All the objects on a higher layer will be rendered on top of objects on lower layers.  For a scrolling game with background, foreground, characters, effect layers and so on, it is a nice authoring solution. Of course this has way more restrictions than what Starling would allow, it actually has very limited features.

So do not consider this as a silver bullet, consider this as an example to learn how to program GPUs efficiently, or also tweak frameworks to achieve higher framerates.

You can download GPUSprite on the GraphicsCorelib github repo.
Download the BunnyMark code (using GPUSprite).

Special thanks to Iain Lobb for the original BunnyMark.
Special thanks to Philippe Elsass for the modified BunnyMark test.

Live demo of GPUSprite below :

Get Adobe Flash player

30 Responses to “Bunnies on the GPU!”

  1. focus says:

    Hey, awesome performance, thanks for the opportunity to see it’s sources and know more about efficient Stage3D using! BTW, what does this key “CTResolveURLAgainstRootSWF” setted to true (from the application xml)? Can’t find it’s description.

  2. 12 says:

    Have you tried using two fixed vertex streams (one filled with redundant quad data plus another with constant indexes) and do instancing by uploading transform matrices for each quad, instead of reuploading the whole vertex buffer every frame ?

  3. Davor says:

    Hi Thibault..that’s great example, but I noticed that frame rate drops very low (10 frames) when I use pressed middle mouse for scrolling..any idea how to avoid that?

  4. Philippe says:

    Awesome performance, I’m glad AIR 3.2 finally brings Flash in good position in the mobile landscape.

    I know the license wasn’t restrictive but it isn’t very classy to not mention from which source this demo was actually adapted; line-by-line as far as the background animation is concerned.

  5. Haha, reached the limit, it wont add any more bunnies.

    16,250 @ 60fps.

    Well done sirs. Well done.

  6. Paolo says:

    Salut Thibault! C’est complètement dément! Dis-moi, est-ce qu’avec FP11.2 / AIR 3.2 / Starling, la performance des blendModes est meilleure? Sinon, quelle serait la meilleure avenue? PixelBender?

    Merci, et beau travail!

  7. Thibault Imbert says:

    Hi Philippe,

    Sorry about that! Completely forgot about the modified version of the test! This is fixed now, I included credits in blog post and source files.


  8. It’s great to see AIR catching up to NME’s performance.

    When you couldn’t use Stage3D in AIR, tests like this performed at least 9 times slower than NME.

    NME still seems to be performing a fair bit faster on mobile (like 3000 bunnies on the iPad 1 at 60 FPS, compared to 2500) and it’s nice to be able to blend NME’s drawTiles command with the standard display list, unlike Stage3D.

    However, this is all great for the browser, because we’re all using Flash Player, there :)

  9. Chris says:

    Hi, thank for these tests. I wondered what results people were achieving on mobile? I am getting about 1200 bunnies @ 60 fps on Galaxy Nexus. Cheers

  10. On Nexus One, Stage3D is significantly faster than NME, 1500 sprites vs 2500.

    On Galaxy Nexus, NME has a slight edge, 5500 to 5000.

    Pretty damned close!

    @Joshua – You can still mix display list content on top of Stage3D. It’s has performance penalties, but depending on the use case those might not apply (dialog’s, main menu, leaderboard, etc)

  11. Actually, worth pointing out that they actually are mixing the display list in this demo.

    The FPS Counter is just a regular old TextField.

  12. Renan Muniz says:

    i need more bunnies :D

  13. hayesmaker says:

    If this is running on the GPU, why does it kill my CPU?

  14. RetroModular says:

    @hayesmaker – Stage3D falls back to software rendering if your graphics card drivers aren’t modern enough, and that uses the CPU not the GPU.

    More information here:

  15. [...] is from All credits for this benchmark are on this page. [...]

  16. Thibault Imbert says:

    Hi hayesmaker,

    Yes, RetroModular is right. If Stage3D cannot leverage your graphics card (drivers too old, blacklisted, or GPU acceleration checkbox unchecked in the settings UI), then the CPU is used to emulate the GPU, this is very expensive for a CPU :)

    In 11.2 coming really soon, we relaxed the drivers gating to 2008 instead of 2009, and we will be even more aggressive in the next releases. Soon, most people should not experience software fallback anymore.


  17. Franck says:

    Ok, so if you love bunnies, i found the perfect introduction for that sequence :


  18. Great sample. I love the clever little GPUSprite framework. I modified the sample to be pure Stage3D (displays the FPS in a Stage3D layer and no DisplayList overlay). I was surprised to see almost no performance improvement.

    More info and source here:

  19. Caleb says:

    This is great!!

    I just wondered out of curiosity, if you ran this on an Ipad1, what kind of bunny mark would you be looking at?

    I am not familiar with mobile dev at this time so have long wondered.

  20. tomsamson says:

    Oh Adobe, will you ever learn before it is too late?

    Always these made up performance demos which are just very unrealistic for 99% of actual usage in a real indepth project..

    And then 2012 and still No hardware acceleration for anything besides video other than stuff made with the new api, so everything one could make inside the flash ide gets no hardware acceleration.
    Using the fladsh ide is for many designers the only reason to use flash instead of any other code only solution available (and better than flash for code only solutions)
    (the only proper reason to use flash is visually creating stuff in the flash ide).

    Will Adobe ever add proper hardware acceleration for everything flash no matter if made in IDE or using AS1 or 2 or 3?

    Like, you know, Scaleform is doing on consoles for so many years?

    If not, then don’t talk nonsense in the vein of taking anything flash (and gaming) serious.


  21. NAZ says:

    Thanks Thibault!,

    Is this demos meant to work out of the box with iOS?? .. i’m publishing it to my iPad2 and with 700 bunnies i get 10FPS.

    I’m using the merged SDK of AIR3.2 and Flex 4.6. and FDT4.5

    Can i have some light on this from anyone maybe Joshua, you got it running with good performance.

    Big thanks!.

  22. NAZ says:


    Nevermind, i was compiling as debug from FDT.. now i got the same results as Joshua.

  23. paha says:


    This issue has been explained by guys at Adobe countless of times. GPUs don’t just work the same way as traditional Flash display list which has features that would be impossible to do in the same way on a GPU. It would create more issues with old content than add any real speed improvements.

    In short: to take advantage of GPU rendering just use frameworks running on the Stage3D. They’re not so difficult but of course knowledge on GPU programming will help a lot.

  24. jack says:

    Yesterday I updated my flash player to version 11.2 from 11.1 and noticed that I can no longer get up to the max of 16,250 bunnies. The framerate starts to dip at around 8000, which is still very impressive!

    The other issue is that when I compile your source using FB4.6 with AIR3.2 and target FP11.2, I cannot get anywhere near what I’m seeing here. I imported the FB project and had to resolve the conflict of having two different playerglobal.swc. I also had to set wmode=direct in the html template. After those changes I was able to publish and the performance starts to drop at around 2750 bunnies. I’m running both swfs in the same browser (Safari) using the same Flash Player (11.2), so why are the results so drastically different?


  25. knarF says:

    This is just so weird… If I right-click, the animation runs A LOT smoother, going from 3 to 21FPS @ 500 bunnies!!

    Can someone explain that?

    hayesmaker: Same here, I read somewhere that Adobe had some problems with their code so they removed GPU acceleration in some cases in some version of Flash. I think it was in 10.0 but removed in 11 — Not sure which, but I’ve been considering to downgrade my Flash version as this seems to affect my setup — Or I may just wait and hope Adobe figures it out ;)

  26. NAZ says:

    Great that you are back! :D

    Performance it’s great, one little thing… i haven’t managed to find how to change the green color of the background …

    Does anyone know???


  27. [...] Currently, Backstage2D’s code base is mostly a playground for proof of concept of some API ideas. Some stuff in this post may not match the git repo (for example, I’m still using “layer” instead of “surface”). There’s a bunch left to do, but it is working enough to run a modified version of MoleHill_BunnMark that some folks from Adobe put together (I actually lifted most of my GPU code from that example code, heh). The BunnyMark example was adapted from Iain Lobb’s BunnyMark, with some additions from Phillipe Elsass. You can view the Backstage2D version of BunnyMark here (and check out the original BunnyMark MoleHill here). [...]

  28. Maliak says:


    way to be a dickhead when triple AAA game engines are already supporting flash. Keep at it, little wannabe html-is-the-never-reached-future shill. zing.

  29. James Almeida says:

    Whoa!! I hit the bunny limit 16250 bunnies! On a Windows 15 2.8Ghz with (32bit) 3Gig of Ram and an ATI 4550 with 512M of ram!! 60FPS!! This is ridiculous (in an AWESOME WAY)!!!

  30. Could someone clarify whether this example uses the display list or targets Stage3D? I assume the latter since in looking at the source I see “wmode” : “direct” and the source code seems to indicate this as well What’s needed for comparison is an identical demo coded using the display list, bitmap caching and using render mode =GPU to see if there is any performance difference. Targeting Stage3D either directly as in this example or thru use of a framework like Starling equals greater code complexity and production time. We need more real world examples of when it makes sense to do so!

Leave a Reply

Open Sort Options

Sort comments by:
  • * Applied after refresh
Fun with code since 2006.