/ appendices / VK_NV_mesh_shader.txt
VK_NV_mesh_shader.txt
  1  include::meta/VK_NV_mesh_shader.txt[]
  2  
  3  *Last Modified Date*::
  4      2018-07-19
  5  
  6  *Contributors*::
  7    - Pat Brown, NVIDIA
  8    - Jeff Bolz, NVIDIA
  9    - Daniel Koch, NVIDIA
 10    - Piers Daniell, NVIDIA
 11    - Pierre Boudier, NVIDIA
 12  
 13  This extension provides a new mechanism allowing applications to generate
 14  collections of geometric primitives via programmable mesh shading.
 15  It is an alternative to the existing programmable primitive shading
 16  pipeline, which relied on generating input primitives by a fixed function
 17  assembler as well as fixed function vertex fetch.
 18  
 19  There are new programmable shader types -- the task and mesh shader -- to
 20  generate these collections to be processed by fixed-function primitive
 21  assembly and rasterization logic.
 22  When the task and mesh shaders are dispatched, they replace the standard
 23  programmable vertex processing pipeline, including vertex array attribute
 24  fetching, vertex shader processing, tessellation, and the geometry shader
 25  processing.
 26  
 27  This extension also adds support for the following SPIR-V extension in
 28  Vulkan:
 29   * SPV_NV_mesh_shader
 30  
 31  === New Object Types
 32  
 33  None.
 34  
 35  === New Enum Constants
 36  
 37    * Extending elink:VkStructureType:
 38  
 39    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV
 40    ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV
 41  
 42    * Extending elink:VkShaderStageFlagBits
 43  
 44    ** ename:VK_SHADER_STAGE_TASK_BIT_NV
 45    ** ename:VK_SHADER_STAGE_MESH_BIT_NV
 46  
 47    * Extending elink:VkPipelineStageFlagBits
 48  
 49    ** ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV
 50    ** ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV
 51  
 52  === New Enums
 53  
 54  None.
 55  
 56  === New Structures
 57  
 58    * slink:VkPhysicalDeviceMeshShaderFeaturesNV
 59    * slink:VkPhysicalDeviceMeshShaderPropertiesNV
 60    * slink:VkDrawMeshTasksIndirectCommandNV
 61  
 62  === New Functions
 63  
 64    * flink:vkCmdDrawMeshTasksNV
 65    * flink:vkCmdDrawMeshTasksIndirectNV
 66    * flink:vkCmdDrawMeshTasksIndirectCountNV
 67  
 68  === New or Modified Built-In Variables
 69  
 70    * <<interfaces-builtin-variables-taskcount,TaskCountNV>>
 71    * <<interfaces-builtin-variables-primitivecount,PrimitiveCountNV>>
 72    * <<interfaces-builtin-variables-primitiveindices,PrimitiveIndicesNV>>
 73    * <<interfaces-builtin-variables-clipdistancepv,ClipDistancePerViewNV>>
 74    * <<interfaces-builtin-variables-culldistancepv,CullDistancePerViewNV>>
 75    * <<interfaces-builtin-variables-layerpv,LayerPerViewNV>>
 76    * <<interfaces-builtin-variables-meshviewcount,MeshViewCountNV>>
 77    * <<interfaces-builtin-variables-meshviewindices,MeshViewIndicesNV>>
 78    * (modified)code:Position
 79    * (modified)code:PointSize
 80    * (modified)code:ClipDistance
 81    * (modified)code:CullDistance
 82    * (modified)code:PrimitiveId
 83    * (modified)code:Layer
 84    * (modified)code:ViewportIndex
 85    * (modified)code:WorkgroupSize
 86    * (modified)code:WorkgroupId
 87    * (modified)code:LocalInvocationId
 88    * (modified)code:GlobalInvocationId
 89    * (modified)code:LocalInvocationIndex
 90    * (modified)code:DrawIndex
 91    * (modified)code:ViewportMaskNV
 92    * (modified)code:PositionPerViewNV
 93    * (modified)code:ViewportMaskPerViewNV
 94  
 95  === New SPIR-V Capability
 96  
 97    * <<spirvenv-capabilities-table-meshshading,MeshShadingNV>>
 98  
 99  === Issues
100  
101  . How to name this extension?
102  +
103  --
104  RESOLVED: VK_NV_mesh_shader
105  
106  Other options considered:
107  
108    * VK_NV_mesh_shading
109    * VK_NV_programmable_mesh_shading
110    * VK_NV_primitive_group_shading
111    * VK_NV_grouped_drawing
112  --
113  
114  . Do we need a new VkPrimitiveTopology?
115  +
116  --
117  RESOLVED: NO, we skip the InputAssembler stage
118  --
119  
120  . Should we allow Instancing?
121  +
122  --
123  RESOLVED: NO, there is no fixed function input, other than the IDs.
124  However, allow offsetting with a "first" value.
125  --
126  
127  . Should we use existing vkCmdDraw or introduce new functions?
128  +
129  --
130  RESOLVED: Introduce new functions.
131  
132  New functions make it easier to separate from "programmable primitive
133  shading" chapter, less "dual use" language about existing functions having
134  alternative behavior.
135  The text around the existing "draws" is heavily based around emitting
136  vertices.
137  --
138  
139  . If new functions, how to name?
140  +
141  --
142  RESOLVED: CmdDrawMeshTasks*
143  
144  Other options considered:
145  
146    * CmdDrawMeshed
147    * CmdDrawTasked
148    * CmdDrawGrouped
149  --
150  
151  . Should VK_SHADER_STAGE_ALL_GRAPHICS be updated to include the new stages?
152  +
153  --
154  RESOLVED: No.
155  If an application were to be recompiled with headers that include additional
156  shader stage bits in VK_SHADER_STAGE_ALL_GRAPHICS, then the previously valid
157  application would no longer be valid on implementations that don't support
158  mesh or task shaders.
159  This means the change would not be backwards compatible.
160  It's too bad VkShaderStageFlagBits doesn't have a dedicated "all supported
161  graphics stages" bit like VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, which would
162  have avoided this problem.
163  --
164  
165  === Version History
166  
167    * Revision 1, 2018-07-19 (Christoph Kubisch, Daniel Koch)
168      - Internal revisions