Stage3D “standard” profile


Authored by Cheng Liao

The Stage3D “standard” profile is a high-level function set that contains a lot of advanced graphics features. We introduced it in Flash/AIR14 for desktop platforms, and extended its support to mobile platforms in Flash/AIR15. This is a huge leap for Stage3D and it keeps Flash gaming moving forward.

What’s new in “standard” profile

Half-precision floating-point texture

Half-precision floating-point texture is defined in Context3DTextureFormat.RGBA_HALF_FLOAT and can be used to create Texture, RectangleTexture, and CubeTexture. Compared to Context3DTextureFormat.BGRA texture, each channel in one pixel of this new texture is a 16-bit floating-point value rather than an 8-bit unsigned integer. Another difference is that its channel order is RGBA and not BGRA, which indicates that a ByteArray uploaded through the uploadFromByteArray function should also be of RGBA order. We usually use it as an intermediate: first we use it as a render texture to get the render output, and then we use it as an input texture to compose a complex scene. A typical use case is HDR rendering.

Currently, we don’t provide a full-precision floating-point texture (32-bit floating-point) in this profile. That’s because on mobile platforms, the calculation in pixel shader is still medium precision and it can only be used in pixel shader. So, it’s not useful to support it now (at least for the mobile platforms).

Multiple Render Texture (MRT)

Multiple Render Texture allows us to draw to multiple outputs (up to 4) simultaneously. To use it, you just need to do two things:

  1. In pixel shader, assign the output registers(“fo0”,”fo1”,”fo2”,”fo3”) with any value you want
  2. Call Context3D::setRenderToTexture with related colorOutputIndex parameter to bind the output to correct render texture

The following rules are applicable:

  • We can only use a few of them, for example using “fo0,fo1” or “fo0,fo1,fo2”, but we must use them continuously, for example using “fo0,fo3” is not allowed
  • All the render textures must have the same format and size
  • AntiAlias parameter will be ignored when using MRT
  • To improve the performance, reduce the total output bandwidth as far as possible, especially on mobile platforms where the bandwidth is very limited. For example, on apple A7 GPU, see this link ( search the key words “no more than 128 bits of total data written to the targets” ). Each half-precision floating-point texture takes up 64 bits. Hence, don’t use more than 2 half-precision floating-point textures in MRT if you target the iOS platform.

Increased Register

Type Old New
VC 128 250
VT 8 26
V 8 10
FC 28 64
FT 8 26
FS 8 16
Token 200 1024

See the above table. To assemble the new AGAL, update from

Conditional forward jump instructions

The new operational instructions are “ife”(==),”ine”(!=),”ifg”(>),”ifl”(<),”els”(else),”eif”(endif). They are used to implement the logic code branch in AGAL.

Fragment depth output

It’s a new register “fd” in pixel shader. Note that it’s write-only and used to re-write z-value (or depth value) written in vertex shader. Note that only its x component (fd.x) is available as it’s a scalar. Also, re-writing z-value is often considered as a costly operation. Hence, use it only if it’s really needed.

Partial derivative instructions

They are “ddx” and “ddy” in pixel shader. They give us the information of how a given variable changes in x or y axis. Please note that they conform to screen-space, so in x axis, its positional direction is from left to right, but in y axis, it’s from top to bottom, which is different from the 3D coordinate.

System and hardware requirement

The new “standard” profile depends on some advanced features provided by the underlying system. When requesting this profile on certain devices, Flash needs to check its capability. The following sections will provide an overview of this check on desktop and mobile platforms.

Desktop platform

This includes the Flash Player in all kinds of browsers on Windows and Mac OS, and also includes AIR on Windows and Mac OS. The hardware on desktop platform is very powerful nowadays. If the video card can support shader model 3.0 or above, it can use the “standard” profile. Currently, most of the hardware systems have met this requirement.

However, there’s an exception on Chrome browser. Unlike using graphics interface provided by the OS directly, Flash Player uses PPAPI provided by the Chrome browser. PPAPI wraps the underlying OS APIs and provides OpenGL ES2 interface to Flash Player. The “Standard” profile requires GL_EXT_draw_buffers feature to implement MRT. Chrome implements it on D3D11 renderer but not on D3D9 renderer on Windows. Visit chrome://gpu/ and search GL_RENDERER to see what the renderer is on your machine. Now, Chrome sets D3D11 as the default renderer. But many machines still can’t use D3D11 renderer because of driver bugs. In this case, you can try to switch the renderer through the command line when starting Chrome.

Mobile platform

This includes AIR on iOS and Android. The “Standard” profile requires OpenGL ES 3.0 on mobile platform. Nowadays, there are many high-end smartphones and tablets that have support for OpenGL ES3.0, (iPhone 5S, iPad Air, Samsung S5, Samsung Note3, etc.)


Many Flash3D engines are developing their new rendering system based on this powerful “standard” profile, which will make the rendering scene more dynamic and realistic. We can’t wait to show you two impressive demos, although they are still in beta stage:

These screenshots and demos are from the team at Flare3D:


Click to open the demo

They also provide a mobile version:

Flare3D Mobile

Click to open the demo


These two are from Away3D:

Away3D Lighting

Click to open the demo

Away3D Blur

Click to open the demo

2 Responses to Stage3D “standard” profile

  1. datee says:

    The AGAL and Stage3D improvements in v14/15 are great. Finally we can do some high quality rendering. Conditionals are great, but for certain posteffects looping in shaders would be very useful too. Any thoughts on why this was not included in AGAL2? Is it possible to implement in a later release?
    Thanks !

  2. Y.Boy says:

    It’s awesome.