Mobile GPUs and improved algorithms
Updated: Aug 16, 2024
This article discusses algorithms that run faster on mobile GPUs (like those on Meta Quest devices) than on desktop/console GPUs. Developers are encouraged to use these algorithms.
Mobile GPUs have very small amounts of on-chip memory due to power constraints, but reading and writing this memory is much faster than on desktop GPUs, similar to how CPU’s L1 cache is much faster to access than its L3 cache.
This detail makes some algorithms, considered too expensive for desktop GPUs, very inexpensive on mobile GPUs.
Multi-sampled anti-aliasing (MSAA)
MSAA is a technique which reduces aliasing on the edges of objects, where aliasing is usually most noticeable. It creates a supersampled depth buffer. This buffer samples and records multiple screen-space positions corresponding to each individual output pixel. If a triangle covers all multisampled locations in an output pixel, its fragment shader only runs once, and there are no additional costs compared to rendering without any anti-aliasing. If different triangles cover different sampled locations in an output pixel, the fragment shader runs once per-triangle in the output pixel, and the results are blended.
Because the depth buffer is tiled and fits in the ~1mb of on-chip GPU memory, it is
extremely fast to access. A supersampled depth buffer requires more memory, resulting in your output frame being cut into more smaller tiles, but our internal tests show that 4x MSAA is extremely cheap on Quest devices. As such, we recommend this anti-aliasing algorithm. For more information about MSAA costs, see
Multisample Anti-Aliasing Analysis for Meta Quest.