Blending is efficient on Mali GPUs because the dstColor is available on-chip, inside the tile buffer. However, it is important to remember that blending is more efficient for some formats than others.
You must have a foundational knowledge of the following key graphics development concepts:
- Tile buffers.
- Forward Pixel Kill (FPK) - https://community.arm.com/developer/tools-software/graphics/b/blog/posts/killing-pixels---a-new-optimization-for-shading-on-arm-mali-gpus.
- Early-zs testing.
How to optimize blending
Here are several optimizations that you can try to optimize your application on Mali GPUs when using blending:
- Prefer blending on unorm formats, rather than floating-point values.
- Always disable blending and alpha-to-coverage if an object is opaque.
- Monitor the number of blended layers that are being generated on a per-pixel basis. Even if the shaders are simple, high layer counts quickly consume cycles due to the number of fragments that must be processed.
- Consider splitting large UI elements into opaque and transparent portions. The opaque and transparent portions can then be drawn separately, allowing either early-zs, or FPK, to remove the overdraw beneath the opaque parts.
Avoiding suboptimal blending
Arm recommends that you:
- Do not use blending on floating-point frame buffers.
- Do not use blending on multisampled floating-point frame buffers.
- Do not generalize the user interface rendering code so that blending is always enabled.
- Do not just set alpha to 1.0 in the fragment shader to disable blending.
The negative impact of inefficient blending
Blending has a significant impact on performance since blending disables many of the important optimizations that remove fragment overdraw, such as early-zs testing and FPK. The negative impact is especially noticeable for user interfaces and 2D games that use multiple layers of sprites.
Debugging OpenGL ES issues for Mali GPUs
When the time comes to debugging any blending issues, use the Graphics Analyzer tool to step through the construction of a frame. You must also monitor which draws calls are being blended and the amount of overdraw that the blends create.