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