# VK_NV_mesh_shader(3) Manual Page

## Name

VK_NV_mesh_shader - device extension

Loading… please wait.

## Registered Extension Number

203

## Revision

1

## Ratification Status

Not ratified

## Extension and Version Dependencies

VK_KHR_get_physical_device_properties2
or
Vulkan Version 1.1

## API Interactions

- Interacts with VK_EXT_device_generated_commands

## SPIR-V Dependencies

- SPV_NV_mesh_shader

## Contact

- Christoph Kubisch [GitHub]pixeljetstream

## Other Extension Metadata

Last Modified Date

  2018-07-19

Interactions and External Dependencies

  - This extension provides API support for `GLSL_NV_mesh_shader`

Contributors

  - Pat Brown, NVIDIA

  - Jeff Bolz, NVIDIA

  - Daniel Koch, NVIDIA

  - Piers Daniell, NVIDIA

  - Pierre Boudier, NVIDIA

## Description

This extension provides a new mechanism allowing applications to generate collections of geometric primitives via programmable mesh shading. It is an alternative to the existing programmable primitive shading pipeline, which relied on generating input primitives by a fixed function assembler as well as fixed function vertex fetch.

There are new programmable shader types — the task and mesh shader — to generate these collections to be processed by fixed-function primitive assembly and rasterization logic. When task and mesh shaders are dispatched, they replace the core pre-rasterization stages, including vertex array attribute fetching, vertex shader processing, tessellation, and geometry shader processing.

This extension also adds support for the following SPIR-V extension in Vulkan:

- `SPV_NV_mesh_shader`

## New Commands

- vkCmdDrawMeshTasksIndirectCountNV

- vkCmdDrawMeshTasksIndirectNV

- vkCmdDrawMeshTasksNV

## New Structures

- VkDrawMeshTasksIndirectCommandNV

- Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo:

  - VkPhysicalDeviceMeshShaderFeaturesNV

- Extending VkPhysicalDeviceProperties2:

  - VkPhysicalDeviceMeshShaderPropertiesNV

## New Enum Constants

- `VK_NV_MESH_SHADER_EXTENSION_NAME`

- `VK_NV_MESH_SHADER_SPEC_VERSION`

- Extending VkPipelineStageFlagBits:

  - `VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV`

  - `VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV`

- Extending VkShaderStageFlagBits:

  - `VK_SHADER_STAGE_MESH_BIT_NV`

  - `VK_SHADER_STAGE_TASK_BIT_NV`

- Extending VkStructureType:

  - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV`

  - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV`

If VK_EXT_device_generated_commands is supported:

- Extending VkIndirectCommandsTokenTypeEXT:

  - `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_COUNT_NV_EXT`

  - `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV_EXT`

## New or Modified Built-In Variables

- TaskCountNV

- PrimitiveCountNV

- PrimitiveIndicesNV

- ClipDistancePerViewNV

- CullDistancePerViewNV

- LayerPerViewNV

- MeshViewCountNV

- MeshViewIndicesNV

- (modified)`Position`

- (modified)`PointSize`

- (modified)`ClipDistance`

- (modified)`CullDistance`

- (modified)`PrimitiveId`

- (modified)`Layer`

- (modified)`ViewportIndex`

- (modified)`WorkgroupSize`

- (modified)`WorkgroupId`

- (modified)`LocalInvocationId`

- (modified)`GlobalInvocationId`

- (modified)`LocalInvocationIndex`

- (modified)`DrawIndex`

- (modified)`ViewportMaskNV`

- (modified)`PositionPerViewNV`

- (modified)`ViewportMaskPerViewNV`

## New SPIR-V Capability

- `MeshShadingNV`

## Issues

1. How to name this extension?

   RESOLVED: VK_NV_mesh_shader

   Other options considered:

   - VK_NV_mesh_shading

   - VK_NV_programmable_mesh_shading

   - VK_NV_primitive_group_shading

   - VK_NV_grouped_drawing

2. Do we need a new VkPrimitiveTopology?

   RESOLVED: No. We skip the InputAssembler stage.

3. Should we allow Instancing?

   RESOLVED: No. There is no fixed function input, other than the IDs. However, allow offsetting with a “first” value.

4. Should we use existing vkCmdDraw or introduce new functions?

   RESOLVED: Introduce new functions.

   New functions make it easier to separate from “programmable primitive shading” chapter, less “dual use” language about existing functions having alternative behavior. The text around the existing “draws” is heavily based around emitting vertices.

5. If new functions, how to name?

   RESOLVED: CmdDrawMeshTasks*

   Other options considered:

   - CmdDrawMeshed

   - CmdDrawTasked

   - CmdDrawGrouped

6. Should VK_SHADER_STAGE_ALL_GRAPHICS be updated to include the new stages?

   RESOLVED: No. If an application were to be recompiled with headers that include additional shader stage bits in VK_SHADER_STAGE_ALL_GRAPHICS, then the previously valid application would no longer be valid on implementations that do not support mesh or task shaders. This means the change would not be backwards compatible. It is too bad VkShaderStageFlagBits does not have a dedicated “all supported graphics stages” bit like VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, which would have avoided this problem.

## Version History

- Revision 1, 2018-07-19 (Christoph Kubisch, Daniel Koch)

  - Internal revisions

## See Also

No cross-references are available

## Document Notes

For more information, see the Vulkan Specification

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.

## Copyright

Copyright 2014-2024 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0