• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2018-2020 NVIDIA Corporation
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5[[drawing-mesh-shading]]
6== Programmable Mesh Shading
7
8In this drawing approach, primitives are assembled by the mesh shader stage.
9<<mesh, Mesh shading>> operates similarly to <<dispatch, dispatching
10compute>> as the shaders make use of workgroups.
11
12
13[open,refpage='vkCmdDrawMeshTasksNV',desc='Draw mesh task work items',type='protos']
14--
15:refpage: vkCmdDrawMeshTasksNV
16
17To record a draw that uses the mesh pipeline, call:
18
19include::{generated}/api/protos/vkCmdDrawMeshTasksNV.txt[]
20
21  * pname:commandBuffer is the command buffer into which the command will be
22    recorded.
23  * pname:taskCount is the number of local workgroups to dispatch in the X
24    dimension.
25    Y and Z dimension are implicitly set to one.
26  * pname:firstTask is the X component of the first workgroup ID.
27
28When the command is executed, a global workgroup consisting of
29pname:taskCount local workgroups is assembled.
30
31.Valid Usage
32****
33include::{chapters}/commonvalidity/draw_common.txt[]
34include::{chapters}/commonvalidity/draw_mesh_common.txt[]
35  * [[VUID-vkCmdDrawMeshTasksNV-taskCount-02119]]
36    pname:taskCount must: be less than or equal to
37    sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxDrawMeshTasksCount
38****
39
40include::{generated}/validity/protos/vkCmdDrawMeshTasksNV.txt[]
41--
42
43[open,refpage='vkCmdDrawMeshTasksIndirectNV',desc='Issue an indirect mesh tasks draw into a command buffer',type='protos']
44--
45:refpage: vkCmdDrawMeshTasksIndirectNV
46
47To record an indirect mesh tasks draw, call:
48
49include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectNV.txt[]
50
51  * pname:commandBuffer is the command buffer into which the command is
52    recorded.
53  * pname:buffer is the buffer containing draw parameters.
54  * pname:offset is the byte offset into pname:buffer where parameters
55    begin.
56  * pname:drawCount is the number of draws to execute, and can: be zero.
57  * pname:stride is the byte stride between successive sets of draw
58    parameters.
59
60fname:vkCmdDrawMeshTasksIndirectNV behaves similarly to
61flink:vkCmdDrawMeshTasksNV except that the parameters are read by the device
62from a buffer during execution.
63pname:drawCount draws are executed by the command, with parameters taken
64from pname:buffer starting at pname:offset and increasing by pname:stride
65bytes for each successive draw.
66The parameters of each draw are encoded in an array of
67slink:VkDrawMeshTasksIndirectCommandNV structures.
68If pname:drawCount is less than or equal to one, pname:stride is ignored.
69
70.Valid Usage
71****
72include::{chapters}/commonvalidity/draw_common.txt[]
73include::{chapters}/commonvalidity/draw_mesh_common.txt[]
74include::{chapters}/commonvalidity/draw_dispatch_indirect_common.txt[]
75include::{chapters}/commonvalidity/draw_indirect_drawcount.txt[]
76  * [[VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02146]]
77    If pname:drawCount is greater than `1`, pname:stride must: be a multiple
78    of `4` and must: be greater than or equal to
79    code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV)
80  * [[VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02156]]
81    If pname:drawCount is equal to `1`, [eq]#(pname:offset {plus}
82    code:sizeof(slink:VkDrawMeshTasksIndirectCommandNV))# must: be less than
83    or equal to the size of pname:buffer
84  * [[VUID-vkCmdDrawMeshTasksIndirectNV-drawCount-02157]]
85    If pname:drawCount is greater than `1`, [eq]#(pname:stride {times}
86    (pname:drawCount - 1) {plus} pname:offset {plus}
87    code:sizeof(slink:VkDrawMeshTasksIndirectCommandNV))# must: be less than
88    or equal to the size of pname:buffer
89****
90
91include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectNV.txt[]
92--
93
94[open,refpage='VkDrawMeshTasksIndirectCommandNV',desc='Structure specifying a mesh tasks draw indirect command',type='structs',xrefs='vkCmdDrawMeshTasksIndirectNV']
95--
96The sname:VkDrawMeshTasksIndirectCommandNV structure is defined as:
97
98include::{generated}/api/structs/VkDrawMeshTasksIndirectCommandNV.txt[]
99
100  * pname:taskCount is the number of local workgroups to dispatch in the X
101    dimension.
102    Y and Z dimension are implicitly set to one.
103  * pname:firstTask is the X component of the first workgroup ID.
104
105The members of sname:VkDrawMeshTasksIndirectCommandNV have the same meaning
106as the similarly named parameters of flink:vkCmdDrawMeshTasksNV.
107
108.Valid Usage
109****
110  * [[VUID-VkDrawMeshTasksIndirectCommandNV-taskCount-02175]]
111    pname:taskCount must: be less than or equal to
112    sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxDrawMeshTasksCount
113****
114
115include::{generated}/validity/structs/VkDrawMeshTasksIndirectCommandNV.txt[]
116--
117
118[open,refpage='vkCmdDrawMeshTasksIndirectCountNV',desc='Perform an indirect mesh tasks draw with the draw count sourced from a buffer',type='protos']
119--
120:refpage: vkCmdDrawMeshTasksIndirectCountNV
121
122To record an indirect mesh tasks draw with the draw count sourced from a
123buffer, call:
124
125include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectCountNV.txt[]
126
127  * pname:commandBuffer is the command buffer into which the command is
128    recorded.
129  * pname:buffer is the buffer containing draw parameters.
130  * pname:offset is the byte offset into pname:buffer where parameters
131    begin.
132  * pname:countBuffer is the buffer containing the draw count.
133  * pname:countBufferOffset is the byte offset into pname:countBuffer where
134    the draw count begins.
135  * pname:maxDrawCount specifies the maximum number of draws that will be
136    executed.
137    The actual number of executed draw calls is the minimum of the count
138    specified in pname:countBuffer and pname:maxDrawCount.
139  * pname:stride is the byte stride between successive sets of draw
140    parameters.
141
142fname:vkCmdDrawMeshTasksIndirectCountNV behaves similarly to
143flink:vkCmdDrawMeshTasksIndirectNV except that the draw count is read by the
144device from a buffer during execution.
145The command will read an unsigned 32-bit integer from pname:countBuffer
146located at pname:countBufferOffset and use this as the draw count.
147
148.Valid Usage
149****
150include::{chapters}/commonvalidity/draw_common.txt[]
151include::{chapters}/commonvalidity/draw_mesh_common.txt[]
152include::{chapters}/commonvalidity/draw_dispatch_indirect_common.txt[]
153include::{chapters}/commonvalidity/draw_indirect_count_common.txt[]
154  * [[VUID-vkCmdDrawMeshTasksIndirectCountNV-stride-02182]]
155    pname:stride must: be a multiple of `4` and must: be greater than or
156    equal to code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV)
157  * [[VUID-vkCmdDrawMeshTasksIndirectCountNV-maxDrawCount-02183]]
158    If pname:maxDrawCount is greater than or equal to `1`,
159    [eq]#(pname:stride {times} (pname:maxDrawCount - 1) {plus} pname:offset
160    {plus} code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV))# must: be
161    less than or equal to the size of pname:buffer
162  * [[VUID-vkCmdDrawMeshTasksIndirectCountNV-countBuffer-02191]]
163    If the count stored in pname:countBuffer is equal to `1`,
164    [eq]#(pname:offset {plus}
165    code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV))# must: be less than
166    or equal to the size of pname:buffer
167  * [[VUID-vkCmdDrawMeshTasksIndirectCountNV-countBuffer-02192]]
168    If the count stored in pname:countBuffer is greater than `1`,
169    [eq]#(pname:stride {times} (pname:drawCount - 1) {plus} pname:offset
170    {plus} code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV))# must: be
171    less than or equal to the size of pname:buffer
172****
173
174include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectCountNV.txt[]
175
176--
177