Progressive Enhancements

As mentioned previously, when GPU acceleration cannot be leveraged, Stage3D will fall back to software and internally will use a software fallback engine, called SwiftShader (Transgaming). To make sure that your content runs well in such a scenario, you need to detect when you are running in software and remove potential effects that would be slow in software.

In the context of 2D content, software fallback should be able to handle many objects and provide good performance, but still, to detect this, you can access the Context3D object from the Starling object by using the static property context:

// are we running hardware or software ?
var isHW:Boolean = 
   Starling.context.driverInfo.toLowerCase().indexOf("software") == 1;

It is a good practice to always design your content with software fallback in mind, as it will ensure the best experience possible on all configurations. Some developers develop their Stage3D games by switching on and off hardware acceleration constantly, to make sure that the experience is always good when running on software.

Now let’s have a look at a pretty exciting topic: the display list in Starling!

Get Introducing Starling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.