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