If you ended up here you’re probably interested in mesh shaders. They are a relatively modern advancement in computer graphics and were thus not part of any university curriculum up until recently. That’s why I researched online anything I could find and compiled it into this collection of readaups, videos and projects that give a good view of the technology.
At a high level, mesh shaders are compute shaders applied to rendering, thus going from a segregated pipeline where each stage is its own shader (vertex, fragment etc…) to a unified one where only tessellation stages have to be programmed seperately, while the rest can be treated in one unified shader. The model came from the need of evolving beyond the previous graphics pipeline model, which inherited a lot of the fixed pipeline model from before the 2000s due to the need for retro compatibility. Now that the fixed pipeline is a thing of the past, going towards a more programmable approach was definitely the way to go. This is where Mesh Shaders came in. There is a great article by Timur, detailing what mesh shaders are and what they solve and a wonderful lecture from University of Utah on them:
Mesh shaders were also a great solution to one problem: geometry shaders. While they were extremely useful for contextual approaches to shading (e.g. vertex culling in a mesh for LOD), they were extremely slow. Tessellation shaders performed better but were not able to cover all the use cases offered by geometry shaders.
- Why Geometry Shaders Are Slow (VERY low level) Hardware wise, manufacturers were already leaving behind the fixed pipeline back in 2017. See the following post from a game engine forum benchmarking skipping the vertex buffer stage on both AMD and NVDIA GPU’s:
- Should we get rid of vertex buffers?
They were officially introduced by NVidia in 2018 but the support quickly spread to AMD and it became first part of the Direct3D API.
The NVidia team published some very useful articles on how to best apply the technology over the years:
- (2018)NVidia: Mesh Shaders Demo(Also displaying the foundation for Unreal Engine’s Nanite, smart culling of geometry)
- (2020)NVidia: Using Mesh Shaders for Professional Graphics
- (2021)NVidia: Advanced API Performance: Mesh Shaders
AMD also published videos on the technology, through their GPU Open initiative:
- AMD: RDNA 2 - Sampler Feedback and Mesh Shaders
- AMD: From Vertex to Mesh Shader Quite ironically, in 2022 an article from a game engine projects found that emulating the behavior of mesh shaders via compute shaders was faster than the official codepath provided by AMD( not always though):
- Mesh Shader Emulation
The DirectX team also published some very useful lower level talks around how the new Mesh Shader pipelines change things, how to approach the problem of getting rid of the Input Assembly and Primitive Assembly stages and the takeways from tackling these problems.
- Reinventing the Geometry Pipeline (An overview)
- Advanced Mesh Shaders (A more technical talk)
- DX12 API Specification
The Vulkan team added the new Mesh Shader based rasterization pipeline 2 years later (4 years after the Turing Mesh Shaders were introduced by NVidia).
They also published an article introducing the new technology.
Other useful links
For anyone interested into using the technology, here is a collection of other links useful to better understand mesh shaders.
- (2022) Meshlets and How to Shade Them Introduces the meshlet shading atlas to make texturing of meshlets (the byproduct of mesh shaders) more efficient.
- (2022)Replacing the geometry pipeline with mesh shaders
- (2020) Resources on GPU Architecture complete with Compute shader references, the base for mesh shaders.
Bonus Content: Moving away from pipelines
The issue of managing graphics pipelines and shader permutation has been one of the major bottleneck of graphics programming as of recently. In 2023 Vulkan introduced an extension that tried to move away from the pipeline model altogether, by hiding it behind the so called shader object: