Skip to content

anv: Implement experimental support for Mesh Shading pipeline in XeHP

Caio Oliveira requested to merge cmarcelo/mesa:r/mesh-anv into main



Add support for Mesh Pipeline through the VK_NV_mesh_shader extension. Both Mesh and Task shaders are supported. Multiview will appear as a separate MR. The extension is only advertised when ANV_EXPERIMENTAL_NV_MESH_SHADER environment variable is set to 1 or true.

About the Mesh Pipeline

The existing variant of Graphics Pipeline, referred to as Primitive Pipeline, uses VS and optionally TCS/TES/GS, to produce the geometry. This MR adds a new variant, the Mesh pipeline, that uses Task and Mesh shaders. Fragment Shader is used by both variants. See and

Both new shader stages are similar to compute shaders with the addition of Input and Output that's "per workgroup", i.e. the entire workgroup produces a single set of outputs. The output can be written collaboratively by the various invocations in the workgroup.

A Task shader workgroup will define how many Mesh shader workgroups will be dispatched, the Task Output will become Mesh Input for all those dispatched meshes.

A Mesh shader workgroup will define a set of primitives, their vertices, and their (user defined) attributes. These attributes are arrayed and can be per-vertex or per-primitive (which corresponds to a "flat" attribute that doesn't need interpolation).

About VK_NV_mesh_shader

We are using the NV extension since is the one already published for Vulkan. When/if a cross-vendor extension appears the plan is to move the effort to support that. See

Future work

  • Multiview
  • I/O optimization
  • State handling optimization
  • Cross-vendor extension work (pending issue above)
Edited by Caio Oliveira

Merge request reports