95 changes: 95 additions & 0 deletions appendices/VK_EXT_mesh_shader.adoc
@@ -0,0 +1,95 @@
// Copyright (c) 2018-2020 NVIDIA Corporation
//
// SPDX-License-Identifier: CC-BY-4.0

include::{generated}/meta/{refprefix}VK_EXT_mesh_shader.adoc[]

=== Other Extension Metadata

*Last Modified Date*::
2022-01-20
*Interactions and External Dependencies*::
- This extension requires
{spirv}/EXT/SPV_EXT_mesh_shader.html[`SPV_EXT_mesh_shader`]
- This extension provides API support for
https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_mesh_shader.txt[`GLSL_EXT_mesh_shader`]
- Interacts with Vulkan 1.1
- Interacts with `apiext:VK_KHR_multiview`
- Interacts with `apiext:VK_KHR_fragment_shading_rate`
*Contributors*::
- Christoph Kubisch, NVIDIA
- Pat Brown, NVIDIA
- Jeff Bolz, NVIDIA
- Daniel Koch, NVIDIA
- Piers Daniell, NVIDIA
- Pierre Boudier, NVIDIA
- Patrick Mours, NVIDIA
- David Zhao Akeley, NVIDIA
- Kedarnath Thangudu, NVIDIA
- Timur Kristóf, Valve
- Hans-Kristian Arntzen, Valve
- Philip Rebohle, Valve
- Mike Blumenkrantz, Valve
- Slawomir Grajewski, Intel
- Michal Pietrasiuk, Intel
- Mariusz Merecki, Intel
- Tom Olson, ARM
- Jan-Harald Fredriksen, ARM
- Sandeep Kakarlapudi, ARM
- Ruihao Zhang, QUALCOMM
- Ricardo Garcia, Igalia, S.L.
- Tobias Hector, AMD
- Stu Smith, AMD


=== 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.

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

* {spirv}/EXT/SPV_EXT_mesh_shader.html[`SPV_EXT_mesh_shader`]

include::{generated}/interfaces/VK_EXT_mesh_shader.adoc[]


=== New or Modified Built-In Variables

* <<interfaces-builtin-variables-cullprimitive,CullPrimitiveEXT>>
* <<interfaces-builtin-variables-primitivepointindices,PrimitivePointIndicesEXT>>
* <<interfaces-builtin-variables-primitivelineindices,PrimitiveLineIndicesEXT>>
* <<interfaces-builtin-variables-primitivetriangleindices,PrimitiveTriangleIndicesEXT>>
* (modified)code:Position
* (modified)code:PointSize
* (modified)code:ClipDistance
* (modified)code:CullDistance
* (modified)code:PrimitiveId
* (modified)code:Layer
* (modified)code:ViewportIndex
* (modified)code:NumWorkgroups
* (modified)code:WorkgroupSize
* (modified)code:WorkgroupId
* (modified)code:LocalInvocationId
* (modified)code:GlobalInvocationId
* (modified)code:LocalInvocationIndex
* (modified)code:NumSubgroups
* (modified)code:SubgroupId
* (modified)code:DrawIndex
* (modified)code:PrimitiveShadingRateKHR
* (modified)code:ViewIndex


=== New SPIR-V Capability

* <<spirvenv-capabilities-table-meshshading,MeshShadingEXT>>


=== Version History

* Revision 1, 2022-03-08 (Christoph Kubisch, Daniel Koch, Patrick Mours)
** Initial revision
37 changes: 29 additions & 8 deletions appendices/glossary.adoc
Expand Up @@ -463,6 +463,9 @@ endif::VK_EXT_multi_draw[]
ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
flink:vkCmdDrawMeshTasksEXT,
endif::VK_EXT_mesh_shader[]
flink:vkCmdDraw, and flink:vkCmdDrawIndexed.

ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
Expand Down Expand Up @@ -505,6 +508,10 @@ ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksNV, flink:vkCmdDrawMeshTasksIndirectNV,
flink:vkCmdDrawMeshTasksIndirectCountNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
flink:vkCmdDrawMeshTasksEXT, flink:vkCmdDrawMeshTasksIndirectEXT,
flink:vkCmdDrawMeshTasksIndirectCountEXT,
endif::VK_EXT_mesh_shader[]
flink:vkCmdDrawIndirect, and flink:vkCmdDrawIndexedIndirect.

Duration (Command)::
Expand Down Expand Up @@ -706,7 +713,7 @@ Global Command::

Global Workgroup::
A collection of local workgroups dispatched by a single dispatching
ifdef::VK_NV_mesh_shader[or single mesh task drawing]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[or single mesh task drawing]
command.

Handle::
Expand Down Expand Up @@ -860,6 +867,10 @@ ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksIndirectNV,
flink:vkCmdDrawMeshTasksIndirectCountNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
flink:vkCmdDrawMeshTasksIndirectEXT,
flink:vkCmdDrawMeshTasksIndirectCountEXT,
endif::VK_EXT_mesh_shader[]
and flink:vkCmdDispatchIndirect.

ifdef::VK_NV_device_generated_commands[]
Expand Down Expand Up @@ -890,6 +901,10 @@ ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksIndirectNV,
flink:vkCmdDrawMeshTasksIndirectCountNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
flink:vkCmdDrawMeshTasksIndirectEXT,
flink:vkCmdDrawMeshTasksIndirectCountEXT,
endif::VK_EXT_mesh_shader[]
and flink:vkCmdDrawIndexedIndirect.

Initial State (Command Buffer)::
Expand Down Expand Up @@ -1073,21 +1088,27 @@ Memory Type::
An index used to select a set of memory properties (e.g. mappable,
cached) for a device memory allocation.

ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
Mesh Shading Pipeline::
A graphics pipeline where the primitives are assembled explicitly in the
shader stages.
In contrast to the primitive shading pipeline where input primitives are
assembled by fixed function processing.
endif::VK_NV_mesh_shader[]

ifdef::VK_NV_mesh_shader[]
Mesh Tasks Drawing Commands::
_Drawing commands_ which create shader invocations organized in
workgroups for drawing mesh tasks.
Includes flink:vkCmdDrawMeshTasksNV, flink:vkCmdDrawMeshTasksIndirectNV,
and flink:vkCmdDrawMeshTasksIndirectCountNV.
Includes
ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksNV, flink:vkCmdDrawMeshTasksIndirectNV, and
flink:vkCmdDrawMeshTasksIndirectCountNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
flink:vkCmdDrawMeshTasksEXT, flink:vkCmdDrawMeshTasksIndirectEXT, and
flink:vkCmdDrawMeshTasksIndirectCountEXT
endif::VK_EXT_mesh_shader[]
.
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

Minimum Miplevel Size::
The smallest size that is permitted for a miplevel.
Expand Down Expand Up @@ -1317,12 +1338,12 @@ Primary Command Buffer::
A command buffer that can: execute secondary command buffers, and can:
be submitted directly to a queue.

ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
Primitive Shading Pipeline::
A graphics pipeline where input primitives are assembled by fixed
function processing.
It is the counterpart to mesh shading.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

Primitive Topology::
State controlling how vertices are assembled into primitives, e.g. as
Expand Down
87 changes: 83 additions & 4 deletions appendices/spirvenv.adoc
Expand Up @@ -425,10 +425,18 @@ endif::VK_VERSION_1_1[]
* [[VUID-{refpage}-OpGroupNonUniformBallotBitCount-04685]]
If code:OpGroupNonUniformBallotBitCount is used, the group operation
must: be limited to *Reduce*, *InclusiveScan*, or *ExclusiveScan*
ifndef::VK_EXT_mesh_shader[]
* [[VUID-{refpage}-None-04686]]
The _Pointer_ operand of all atomic instructions must: have a *Storage
Class* limited to *Uniform*, *Workgroup*, *Image*, *StorageBuffer*, or
*PhysicalStorageBuffer*
endif::VK_EXT_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
* [[VUID-{refpage}-None-07101]]
The _Pointer_ operand of all atomic instructions must: have a *Storage
Class* limited to *Uniform*, *Workgroup*, *Image*, *StorageBuffer*,
*PhysicalStorageBuffer*, or *TaskPayloadWorkgroupEXT*
endif::VK_EXT_mesh_shader[]
* [[VUID-{refpage}-Offset-04687]]
Output variables or block members decorated with code:Offset that have a
64-bit type, or a composite type containing a 64-bit type, must: specify
Expand Down Expand Up @@ -564,6 +572,46 @@ endif::VK_VERSION_1_1[]
* [[VUID-{refpage}-Input-06778]]
Variables with a storage class of code:Input in a fragment shader stage
that are decorated with code:PerVertexKHR must: be declared as arrays
ifdef::VK_NV_mesh_shader+VK_EXT_mesh_shader[]
* [[VUID-{refpage}-MeshEXT-07102]]
The module must: not contain both an entry point that uses the code:
TaskEXT or code:MeshEXT {ExecutionModel} and an entry point that uses
the code:TaskNV or code:MeshNV {ExecutionModel}
endif::VK_NV_mesh_shader+VK_EXT_mesh_shader[]
* [[VUID-{refpage}-PrimitivePointIndicesEXT-07103]]
If a variable decorated with code:PrimitivePointIndicesEXT is used, the
code:OutputPoints code:OpExecutionMode must: be set
* [[VUID-{refpage}-PrimitiveLineIndicesEXT-07104]]
If a variable decorated with code:PrimitiveLineIndicesEXT is used, the
code:OutputLinesEXT code:OpExecutionMode must: be set
* [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07105]]
If a variable decorated with code:PrimitiveTriangleIndicesEXT is used,
the code:OutputTrianglesEXT code:OpExecutionMode must: be set
* [[VUID-{refpage}-MeshEXT-07106]]
In mesh shaders using the code:MeshEXT {ExecutionModel}
code:OpSetMeshOutputsEXT must: be called before any outputs are written
* [[VUID-{refpage}-MeshEXT-07107]]
In mesh shaders using the code:MeshEXT {ExecutionModel} all variables
declared as output must: not be read from
* [[VUID-{refpage}-MeshEXT-07108]]
In mesh shaders using the code:MeshEXT {ExecutionModel} for
code:OpSetMeshOutputsEXT instructions, the "`Vertex Count`" and
"`Primitive Count`" operands must: not depend on code:ViewIndex
* [[VUID-{refpage}-MeshEXT-07109]]
In mesh shaders using the code:MeshEXT {ExecutionModel} variables
decorated with code:PrimitivePointIndicesEXT,
code:PrimitiveLineIndicesEXT or code:PrimitiveTriangleIndicesEXT
declared as an array must: not be accessed by indices that depend on
code:ViewIndex
* [[VUID-{refpage}-MeshEXT-07110]]
In mesh shaders using the code:MeshEXT {ExecutionModel} any values
stored in variables decorated with code:PrimitivePointIndicesEXT,
code:PrimitiveLineIndicesEXT or code:PrimitiveTriangleIndicesEXT must:
not depend on code:ViewIndex
* [[VUID-{refpage}-MeshEXT-07111]]
In mesh shaders using the code:MeshEXT {ExecutionModel} variables in
workgroup or private storage class declared as or containing a composite
type must: not be accessed by indices that depend on code:ViewIndex
****
--

Expand Down Expand Up @@ -616,9 +664,10 @@ ifndef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
operand of 2 and an "`Image Format`" operand of code:Unknown must: be
decorated with code:NonReadable.
endif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[]
* code:OpImageWrite to any code:Image whose code:Image code:Format is not
code:Unknown must: have the code:Texel operand contain at least
as many components as the corresponding elink:VkFormat as given in the
* [[VUID-{refpage}-OpImageWrite-07112]]
code:OpImageWrite to any code:Image whose code:Image code:Format is not
code:Unknown must: have the code:Texel operand contain at least as many
components as the corresponding elink:VkFormat as given in the
<<spirvenv-image-formats,SPIR-V Image Format compatibility table>>
* [[VUID-{refpage}-Location-06272]]
The sum of code:Location and the number of locations the variable it
Expand Down Expand Up @@ -958,6 +1007,36 @@ ifdef::VK_NV_cooperative_matrix[]
alignment is the number of columns/rows multiplied by the component
size).
endif::VK_NV_cooperative_matrix[]
ifdef::VK_NV_mesh_shader[]
* [[VUID-{refpage}-MeshNV-07113]]
For mesh shaders using the code:MeshNV {ExecutionModel} the
code:OutputVertices code:OpExecutionMode must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxMeshOutputVertices.
* [[VUID-{refpage}-MeshNV-07114]]
For mesh shaders using the code:MeshNV {ExecutionModel} the
code:OutputPrimitivesNV code:OpExecutionMode must: be less than or equal
to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxMeshOutputPrimitives.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
* [[VUID-{refpage}-MeshEXT-07115]]
For mesh shaders using the code:MeshEXT {ExecutionModel} the
code:OutputVertices code:OpExecutionMode must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshOutputVertices.
* [[VUID-{refpage}-MeshEXT-07116]]
For mesh shaders using the code:MeshEXT {ExecutionModel} the
code:OutputPrimitivesEXT code:OpExecutionMode must: be less than or
equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshOutputPrimitives.
* [[VUID-{refpage}-TaskEXT-07117]]
In task shaders using the code:TaskEXT {ExecutionModel}
code:OpEmitMeshTasksEXT must: be called exactly once under dynamically
uniform conditions
* [[VUID-{refpage}-MeshEXT-07118]]
In mesh shaders using the code:MeshEXT {ExecutionModel}
code:OpSetMeshOutputsEXT must: be called at most once under dynamically
uniform conditions
endif::VK_EXT_mesh_shader[]
ifdef::VK_KHR_portability_subset[]
* [[VUID-{refpage}-shaderSampleRateInterpolationFunctions-06325]]
If the `apiext:VK_KHR_portability_subset` extension is enabled, and
Expand Down Expand Up @@ -1935,5 +2014,5 @@ values as defined below:
[cols="2*", options="header"]
|====
|SPIR-V Image Format |Compatible Vulkan Format
include::{generated}/formats/spirvimageformat.txt[]
include::{generated}/formats/spirvimageformat.adoc[]
|====
14 changes: 14 additions & 0 deletions chapters/VK_NV_device_generated_commands/generation.adoc
Expand Up @@ -228,6 +228,20 @@ include::{generated}/api/structs/VkGeneratedCommandsInfoNV.adoc[]
If pname:sequencesIndexBuffer is not dlink:VK_NULL_HANDLE and is
non-sparse then it must: be bound completely and contiguously to a
single sname:VkDeviceMemory object
ifdef::VK_NV_mesh_shader[]
* [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-07078]]
If the pname:indirectCommandsLayout uses a token of
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV, then the
pname:pipeline must: contain a shader stage using the code:MeshNV
{ExecutionModel}.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
* [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-07079]]
If the pname:indirectCommandsLayout uses a token of
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV, then the
pname:pipeline must: contain a shader stage using the code:MeshEXT
{ExecutionModel}.
endif::VK_EXT_mesh_shader[]
****

include::{generated}/validity/structs/VkGeneratedCommandsInfoNV.adoc[]
Expand Down
19 changes: 16 additions & 3 deletions chapters/VK_NV_device_generated_commands/indirectcommands.adoc
Expand Up @@ -126,10 +126,11 @@ This enables direct compatibility with D3D12 command signature layouts.
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV there must: be only
a single element of such token type
* [[VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02934]]
All state tokens in pname:pTokens must: occur prior work provoking
All state tokens in pname:pTokens must: occur before any work provoking
tokens (ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV,
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV,
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV)
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV,
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV)
* [[VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02935]]
The content of pname:pTokens must: include one single work provoking
token that is compatible with the pname:pipelineBindPoint
Expand Down Expand Up @@ -250,6 +251,9 @@ commands such as:
ifdef::VK_NV_mesh_shader[]
* slink:VkDrawMeshTasksIndirectCommandNV
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
* slink:VkDrawMeshTasksIndirectCommandEXT
endif::VK_EXT_mesh_shader[]

or additional commands as listed below.
How the data is used is described in the next section.
Expand Down Expand Up @@ -445,6 +449,9 @@ include::{generated}/api/enums/VkIndirectCommandsTokenTypeNV.adoc[]
ifdef::VK_NV_mesh_shader[]
|ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV | flink:vkCmdDrawMeshTasksIndirectNV
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
|ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV | flink:vkCmdDrawMeshTasksIndirectEXT
endif::VK_EXT_mesh_shader[]
|====
--

Expand Down Expand Up @@ -631,10 +638,16 @@ void cmdProcessSequence(cmd, pipeline, indirectCommandsLayout, pIndirectCommands
break;
// only available if VK_NV_mesh_shader is supported
VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NV:
VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV:
vkCmdDrawMeshTasksIndirectNV(cmd,
stream.buffer, offset, 1, 0);
break;
// only available if VK_EXT_mesh_shader is supported
VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV:
vkCmdDrawMeshTasksIndirectEXT(cmd,
stream.buffer, offset, 1, 0);
break;
}
}
}
Expand Down
218 changes: 213 additions & 5 deletions chapters/VK_NV_mesh_shader/drawing.adoc
Expand Up @@ -9,12 +9,12 @@ In this drawing approach, primitives are assembled by the mesh shader stage.
<<mesh, Mesh shading>> operates similarly to <<dispatch, dispatching
compute>> as the shaders make use of workgroups.


ifdef::VK_NV_mesh_shader[]
[open,refpage='vkCmdDrawMeshTasksNV',desc='Draw mesh task work items',type='protos']
--
:refpage: vkCmdDrawMeshTasksNV

To record a draw that uses the mesh pipeline, call:
To record a mesh tasks drawing command, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksNV.adoc[]

Expand All @@ -35,6 +35,9 @@ include::{chapters}/commonvalidity/draw_mesh_common.adoc[]
* [[VUID-vkCmdDrawMeshTasksNV-taskCount-02119]]
pname:taskCount must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxDrawMeshTasksCount
* [[VUID-vkCmdDrawMeshTasksNV-MeshNV-07080]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshNV {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksNV.adoc[]
Expand All @@ -44,7 +47,7 @@ include::{generated}/validity/protos/vkCmdDrawMeshTasksNV.adoc[]
--
:refpage: vkCmdDrawMeshTasksIndirectNV

To record an indirect mesh tasks draw, call:
To record an indirect mesh tasks drawing command, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectNV.adoc[]

Expand Down Expand Up @@ -86,6 +89,9 @@ include::{chapters}/commonvalidity/draw_indirect_drawcount.adoc[]
(pname:drawCount - 1) {plus} pname:offset {plus}
code:sizeof(slink:VkDrawMeshTasksIndirectCommandNV))# must: be less than
or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectNV-MeshNV-07081]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshNV {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectNV.adoc[]
Expand Down Expand Up @@ -119,8 +125,8 @@ include::{generated}/validity/structs/VkDrawMeshTasksIndirectCommandNV.adoc[]
--
:refpage: vkCmdDrawMeshTasksIndirectCountNV

To record an indirect mesh tasks draw with the draw count sourced from a
buffer, call:
To record an indirect mesh tasks drawing command with the draw count sourced
from a buffer, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectCountNV.adoc[]

Expand Down Expand Up @@ -169,8 +175,210 @@ include::{chapters}/commonvalidity/draw_indirect_count_common.adoc[]
[eq]#(pname:stride {times} (pname:drawCount - 1) {plus} pname:offset
{plus} code:sizeof(sname:VkDrawMeshTasksIndirectCommandNV))# must: be
less than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectCountNV-MeshNV-07082]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshNV {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectCountNV.adoc[]

--
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
[open,refpage='vkCmdDrawMeshTasksEXT',desc='Draw mesh task work items',type='protos']
--
:refpage: vkCmdDrawMeshTasksEXT

To record a mesh tasks drawing command, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksEXT.adoc[]

* pname:commandBuffer is the command buffer into which the command will be
recorded.
* pname:groupCountX is the number of local workgroups to dispatch in the X
dimension.
* pname:groupCountY is the number of local workgroups to dispatch in the Y
dimension.
* pname:groupCountZ is the number of local workgroups to dispatch in the Z
dimension.

When the command is executed, a global workgroup consisting of
[eq]#pname:groupCountX {times} pname:groupCountY {times} pname:groupCountZ#
local workgroups is assembled.

.Valid Usage
****
include::{chapters}/commonvalidity/draw_common.adoc[]
* [[VUID-vkCmdDrawMeshTasksEXT-groupCountX-07083]]
pname:groupCountX must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[0]
* [[VUID-vkCmdDrawMeshTasksEXT-groupCountY-07084]]
pname:groupCountY must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[1]
* [[VUID-vkCmdDrawMeshTasksEXT-groupCountZ-07085]]
pname:groupCountZ must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[2]
* [[VUID-vkCmdDrawMeshTasksEXT-groupCountX-07086]]
The product of pname:groupCountX, pname:groupCountY and
pname:groupCountZ must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupTotalCount
* [[VUID-vkCmdDrawMeshTasksEXT-MeshEXT-07087]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshEXT {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksEXT.adoc[]
--

[open,refpage='vkCmdDrawMeshTasksIndirectEXT',desc='Issue an indirect mesh tasks draw into a command buffer',type='protos']
--
:refpage: vkCmdDrawMeshTasksIndirectEXT

To record an indirect mesh tasks drawing command, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectEXT.adoc[]

* pname:commandBuffer is the command buffer into which the command is
recorded.
* pname:buffer is the buffer containing draw parameters.
* pname:offset is the byte offset into pname:buffer where parameters
begin.
* pname:drawCount is the number of draws to execute, and can: be zero.
* pname:stride is the byte stride between successive sets of draw
parameters.

fname:vkCmdDrawMeshTasksIndirectEXT behaves similarly to
flink:vkCmdDrawMeshTasksEXT except that the parameters are read by the
device from a buffer during execution.
pname:drawCount draws are executed by the command, with parameters taken
from pname:buffer starting at pname:offset and increasing by pname:stride
bytes for each successive draw.
The parameters of each draw are encoded in an array of
slink:VkDrawMeshTasksIndirectCommandEXT structures.
If pname:drawCount is less than or equal to one, pname:stride is ignored.

.Valid Usage
****
include::{chapters}/commonvalidity/draw_common.adoc[]
include::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
include::{chapters}/commonvalidity/draw_indirect_drawcount.adoc[]
* [[VUID-vkCmdDrawMeshTasksIndirectEXT-drawCount-07088]]
If pname:drawCount is greater than `1`, pname:stride must: be a multiple
of `4` and must: be greater than or equal to
code:sizeof(sname:VkDrawMeshTasksIndirectCommandEXT)
* [[VUID-vkCmdDrawMeshTasksIndirectEXT-drawCount-07089]]
If pname:drawCount is equal to `1`, [eq]#(pname:offset {plus}
code:sizeof(slink:VkDrawMeshTasksIndirectCommandEXT))# must: be less
than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectEXT-drawCount-07090]]
If pname:drawCount is greater than `1`, [eq]#(pname:stride {times}
(pname:drawCount - 1) {plus} pname:offset {plus}
code:sizeof(slink:VkDrawMeshTasksIndirectCommandEXT))# must: be less
than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectEXT-MeshEXT-07091]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshEXT {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectEXT.adoc[]
--

[open,refpage='VkDrawMeshTasksIndirectCommandEXT',desc='Structure specifying a mesh tasks draw indirect command',type='structs',xrefs='vkCmdDrawMeshTasksIndirectEXT']
--

The sname:VkDrawMeshTasksIndirectCommandEXT structure is defined as:

include::{generated}/api/structs/VkDrawMeshTasksIndirectCommandEXT.adoc[]

* pname:groupCountX is the number of local workgroups to dispatch in the X
dimension.
* pname:groupCountY is the number of local workgroups to dispatch in the Y
dimension.
* pname:groupCountZ is the number of local workgroups to dispatch in the Z
dimension.

The members of sname:VkDrawMeshTasksIndirectCommandEXT have the same meaning
as the similarly named parameters of flink:vkCmdDrawMeshTasksEXT.

.Valid Usage
****
* [[VUID-VkDrawMeshTasksIndirectCommandEXT-groupCountX-07092]]
pname:groupCountX must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[0]
* [[VUID-VkDrawMeshTasksIndirectCommandEXT-groupCountY-07093]]
pname:groupCountY must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[1]
* [[VUID-VkDrawMeshTasksIndirectCommandEXT-groupCountZ-07094]]
pname:groupCountZ must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupCount[2]
* [[VUID-VkDrawMeshTasksIndirectCommandEXT-groupCountX-07095]]
The product of pname:groupCountX, pname:groupCountY and
pname:groupCountZ must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxTaskWorkGroupTotalCount
****

include::{generated}/validity/structs/VkDrawMeshTasksIndirectCommandEXT.adoc[]
--

[open,refpage='vkCmdDrawMeshTasksIndirectCountEXT',desc='Perform an indirect mesh tasks draw with the draw count sourced from a buffer',type='protos']
--
:refpage: vkCmdDrawMeshTasksIndirectCountEXT

To record an indirect mesh tasks drawing command with the draw count sourced
from a buffer, call:

include::{generated}/api/protos/vkCmdDrawMeshTasksIndirectCountEXT.adoc[]

* pname:commandBuffer is the command buffer into which the command is
recorded.
* pname:buffer is the buffer containing draw parameters.
* pname:offset is the byte offset into pname:buffer where parameters
begin.
* pname:countBuffer is the buffer containing the draw count.
* pname:countBufferOffset is the byte offset into pname:countBuffer where
the draw count begins.
* pname:maxDrawCount specifies the maximum number of draws that will be
executed.
The actual number of executed draw calls is the minimum of the count
specified in pname:countBuffer and pname:maxDrawCount.
* pname:stride is the byte stride between successive sets of draw
parameters.

fname:vkCmdDrawMeshTasksIndirectCountEXT behaves similarly to
flink:vkCmdDrawMeshTasksIndirectEXT except that the draw count is read by
the device from a buffer during execution.
The command will read an unsigned 32-bit integer from pname:countBuffer
located at pname:countBufferOffset and use this as the draw count.

.Valid Usage
****
include::{chapters}/commonvalidity/draw_common.adoc[]
include::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
include::{chapters}/commonvalidity/draw_indirect_count_common.adoc[]
* [[VUID-vkCmdDrawMeshTasksIndirectCountEXT-stride-07096]]
pname:stride must: be a multiple of `4` and must: be greater than or
equal to code:sizeof(sname:VkDrawMeshTasksIndirectCommandEXT)
* [[VUID-vkCmdDrawMeshTasksIndirectCountEXT-maxDrawCount-07097]]
If pname:maxDrawCount is greater than or equal to `1`,
[eq]#(pname:stride {times} (pname:maxDrawCount - 1) {plus} pname:offset
{plus} code:sizeof(sname:VkDrawMeshTasksIndirectCommandEXT))# must: be
less than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-07098]]
If the count stored in pname:countBuffer is equal to `1`,
[eq]#(pname:offset {plus}
code:sizeof(sname:VkDrawMeshTasksIndirectCommandEXT))# must: be less
than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-07099]]
If the count stored in pname:countBuffer is greater than `1`,
[eq]#(pname:stride {times} (pname:drawCount - 1) {plus} pname:offset
{plus} code:sizeof(sname:VkDrawMeshTasksIndirectCommandEXT))# must: be
less than or equal to the size of pname:buffer
* [[VUID-vkCmdDrawMeshTasksIndirectCountEXT-MeshEXT-07100]]
The current pipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS
must: contain a shader stage using the code:MeshEXT {ExecutionModel}.
****

include::{generated}/validity/protos/vkCmdDrawMeshTasksIndirectCountEXT.adoc[]

--
endif::VK_EXT_mesh_shader[]
164 changes: 140 additions & 24 deletions chapters/VK_NV_mesh_shader/mesh.adoc
Expand Up @@ -32,14 +32,36 @@ There are no inputs other than the builtin workgroup identifiers.

[[mesh-task-output]]
== Task Shader Output
The task shader can emit zero or more mesh workgroups to be generated using
the <<interfaces-builtin-variables,built-in variable>> code:TaskCountNV.
The task shader can emit zero or more mesh workgroups to be generated.
ifdef::VK_NV_mesh_shader[]
Shaders using the code:TaskNV {ExecutionModel} can do so using the
<<interfaces-builtin-variables,built-in variable>> code:TaskCountNV.
This value must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxTaskOutputCount.

It can also output user-defined data that is passed as input to all mesh
shader invocations that the task creates.
These outputs are decorated as code:PerTaskNV.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
Shaders using the code:TaskEXT {ExecutionModel} can do so using the
code:OpEmitMeshTasksEXT instruction.
The code:groupCountX, code:groupCountY and code:groupCountZ arguments passed
to this instruction must: be less than or equal to the respective dimension
within
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshWorkGroupCount.
The product of these arguments must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshWorkGroupTotalCount.
endif::VK_EXT_mesh_shader[]

The task shader can also pass user-defined data to all mesh shader
invocations that it creates.
ifdef::VK_NV_mesh_shader[]
Shaders using the code:TaskNV {ExecutionModel} can do so by writing to
output variables that are decorated with code:PerTaskNV.
They are available as inputs in mesh shaders.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
Shaders using the code:TaskEXT {ExecutionModel} can do so by writing to a
payload variable with code:TaskPayloadWorkgroupEXT storage class that is
passed to the code:OpEmitMeshTasksEXT instruction.
endif::VK_EXT_mesh_shader[]


[[mesh-generation]]
Expand All @@ -53,42 +75,129 @@ invocations directly.
[[mesh-input]]
== Mesh Shader Input
The only inputs available to the mesh shader are variables identifying the
specific workgroup and invocation and, if applicable, any outputs written as
code:PerTaskNV by the task shader that spawned the mesh shader's workgroup.
specific workgroup and invocation and, if applicable,
ifdef::VK_NV_mesh_shader[]
any outputs written as code:PerTaskNV
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader+VK_EXT_mesh_shader[or]
ifdef::VK_EXT_mesh_shader[]
the payload variable passed to the code:OpEmitMeshTasksEXT instruction
endif::VK_EXT_mesh_shader[]
by the task shader that spawned the mesh shader's workgroup.
The mesh shader can operate without a task shader as well.


[[mesh-output]]
== Mesh Shader Output Primitives
== Mesh Shader Output

A mesh shader generates primitives in one of three output modes: points,
lines, or triangles.
The primitive mode is specified in the shader using an code:OpExecutionMode
instruction with the code:OutputPoints, code:OutputLinesNV, or
code:OutputTrianglesNV modes, respectively.
ifdef::VK_NV_mesh_shader[]
For shaders using the code:MeshNV {ExecutionModel} the primitive mode is
specified in the shader using an code:OpExecutionMode instruction with the
code:OutputPoints, code:OutputLinesNV, or code:OutputTrianglesNV modes,
respectively.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
For shaders using the code:MeshEXT {ExecutionModel} the primitive mode is
specified in the shader using an code:OpExecutionMode instruction with the
code:OutputPoints, code:OutputLinesEXT, or code:OutputTrianglesEXT modes,
respectively.
endif::VK_EXT_mesh_shader[]
Each mesh shader must: include exactly one output primitive mode.

The maximum output vertex count is specified as a literal in the shader
using an code:OpExecutionMode instruction with the mode set to
code:OutputVertices and must: be less than or equal to
ifdef::VK_NV_mesh_shader[]
For shaders using the code:MeshNV {ExecutionModel} the maximum output vertex
count is specified as a literal in the shader using an code:OpExecutionMode
instruction with the mode set to code:OutputVertices and must: be less than
or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxMeshOutputVertices.

The maximum output primitive count is specified as a literal in the shader
using an code:OpExecutionMode instruction with the mode set to
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
For shaders using the code:MeshEXT {ExecutionModel} the maximum output
vertex count is specified as a literal in the shader using an
code:OpExecutionMode instruction with the mode set to code:OutputVertices
and must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshOutputVertices.
endif::VK_EXT_mesh_shader[]

ifdef::VK_NV_mesh_shader[]
For shaders using the code:MeshNV {ExecutionModel} the maximum output
primitive count is specified as a literal in the shader using an
code:OpExecutionMode instruction with the mode set to
code:OutputPrimitivesNV and must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesNV::pname:maxMeshOutputPrimitives.

The number of primitives output by the mesh shader is provided via writing
to the <<interfaces-builtin-variables,built-in variable>>
code:PrimitiveCountNV and must: be less than or equal to the maximum output
primitive count specified in the shader.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
For shaders using the code:MeshEXT {ExecutionModel} the maximum output
primitive count is specified as a literal in the shader using an
code:OpExecutionMode instruction with the mode set to
code:OutputPrimitivesEXT, and must: be less than or equal to
sname:VkPhysicalDeviceMeshShaderPropertiesEXT::pname:maxMeshOutputPrimitives.
endif::VK_EXT_mesh_shader[]

ifdef::VK_NV_mesh_shader[]
For shaders using the code:MeshNV {ExecutionModel} the number of primitives
output by the mesh shader is provided via writing to the
<<interfaces-builtin-variables,built-in variable>> code:PrimitiveCountNV and
must: be less than or equal to the maximum output primitive count specified
in the shader.
A variable decorated with code:PrimitiveIndicesNV is an output array of
local index values into the vertex output arrays from which primitives are
assembled according to the output primitive type.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
For shaders using the code:MeshEXT {ExecutionModel} the number of vertices
and primitives output by the mesh shader is provided via calling the
code:OpSetMeshOutputsEXT instruction.
The code:vertexCount argument must: be less than or equal to the maximum
output vertex count specified in the shader.
The code:primitiveCount argument must: be less than or equal to the maximum
output primitive count specified in the shader.

Depending on the output primitive mode an appropriately-decorated variable
is the output array of local index values into the vertex output arrays from
which primitives are assembled according to the output primitive type:

* code:OutputPoints uses the code:PrimitivePointIndicesEXT decoration.
* code:OutputLinesEXT uses the code:PrimitiveLineIndicesEXT decoration.
* code:OutputTrianglesEXT uses the code:PrimitiveTriangleIndicesEXT
decoration.
endif::VK_EXT_mesh_shader[]

These resulting primitives are then further processed as described in
<<primsrast>>.


ifdef::VK_EXT_mesh_shader[]
With the exception of primitive indices, all output built-ins and custom
attributes count towards the total storage size occupied by output variables
in mesh shaders.
This size can be calculated as follows, taking into account the fact that
the number of effective scalar attributes is 4 times the number of effective
locations used according to the <<interfaces-iointerfaces-locations,location
assignment rules>>.
Let latexmath:[v] be the number of views, latexmath:[n_v] be the number of
effective scalar per-vertex attributes not dependent on code:ViewIndex,
latexmath:[n_{vpv}] be the number of effective scalar per-vertex attributes
dependent on code:ViewIndex, latexmath:[m_v] be the maximum number of
vertices specified by the code:OutputVertices {ExecutionMode},
latexmath:[g_v] be pname:meshOutputPerVertexGranularity, latexmath:[n_p] be
the number of effective scalar per-primitive attributes not dependent on
code:ViewIndex, latexmath:[n_{ppv}] be the number of effective scalar
per-primitive attributes dependent on code:ViewIndex, latexmath:[m_p] be the
maximum number of primitives specified by the code:OutputPrimitivesEXT
{ExecutionMode} and latexmath:[g_p] be
pname:meshOutputPerPrimitiveGranularity:

[latexmath]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(n_v + (n_{vpv} \times v)) \times 4 \times \mathrm{align}(m_v, g_v) +
(n_p + (n_{ppv} \times v)) \times 4 \times \mathrm{align}(m_p, g_p)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

endif::VK_EXT_mesh_shader[]

ifdef::VK_NV_mesh_shader[]
[[mesh-output-perview]]
== Mesh Shader Per-View Outputs

Expand All @@ -114,6 +223,13 @@ input is taken from the element of the per-view output array that
corresponds to the view that is currently being processed by the fragment
shader.

ifdef::VK_EXT_mesh_shader[]
These _per-view_ outputs are available only in shaders using the code:MeshNV
{ExecutionModel}.
They are not available in shaders using the code:MeshEXT {ExecutionModel}.
endif::VK_EXT_mesh_shader[]

endif::VK_NV_mesh_shader[]

[[mesh-ordering]]
== Mesh Shader Primitive Ordering
Expand Down
11 changes: 11 additions & 0 deletions chapters/commonvalidity/draw_common.adoc
Expand Up @@ -415,4 +415,15 @@ ifdef::VK_EXT_transform_feedback[]
sname:VkPipelineRasterizationStateStreamCreateInfoEXT::pname:rasterizationStream.
endif::VK_EXT_transform_feedback[]
endif::VK_EXT_primitives_generated_query[]
ifdef::VK_EXT_mesh_shader[]
* [[VUID-{refpage}-stage-07073]]
If the currently bound pipeline was created with the
slink:VkPipelineShaderStageCreateInfo::pname:stage member of an element
of slink:VkGraphicsPipelineCreateInfo::pname:pStages set to
ename:VK_SHADER_STAGE_VERTEX_BIT,
ename:VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
ename:VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT or
ename:VK_SHADER_STAGE_GEOMETRY_BIT, then <<queries-mesh-shader, Mesh
Shader Queries>> must not be active
endif::VK_EXT_mesh_shader[]
// Common Valid Usage
27 changes: 25 additions & 2 deletions chapters/commonvalidity/draw_mesh_common.adoc
Expand Up @@ -4,7 +4,7 @@

// Common Valid Usage
// Common to drawing commands for mesh shading
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* [[VUID-{refpage}-stage-06480]]
The bound graphics pipeline must: not have been created with the
slink:VkPipelineShaderStageCreateInfo::pname:stage member of an element
Expand All @@ -13,5 +13,28 @@ ifdef::VK_NV_mesh_shader[]
ename:VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
ename:VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT or
ename:VK_SHADER_STAGE_GEOMETRY_BIT
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_transform_feedback[]
* [[VUID-{refpage}-None-07074]]
<<queries-transform-feedback, Transform Feedback Queries>> must: not be
active
endif::VK_EXT_transform_feedback[]
ifdef::VK_EXT_primitives_generated_query[]
* [[VUID-{refpage}-None-07075]]
<<queries-primitives-generated, Primitives Generated Queries>> must: not
be active
endif::VK_EXT_primitives_generated_query[]
* [[VUID-{refpage}-pipelineStatistics-07076]]
The pname:pipelineStatistics member used to create any active
<<queries-pipestats, Pipeline Statistics Query>> must: not contain
ename:VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT,
ename:VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT,
or
ename:VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
// Common Valid Usage
6 changes: 3 additions & 3 deletions chapters/commonvalidity/draw_vertex_binding.adoc
Expand Up @@ -72,11 +72,11 @@ ifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[]
enabled then flink:vkCmdSetPrimitiveRestartEnableEXT must: have been
called in the current command buffer prior to this drawing command
endif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[]
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* [[VUID-{refpage}-stage-06481]]
The bound graphics pipeline must: not have been created with the
slink:VkPipelineShaderStageCreateInfo::pname:stage member of an element
of slink:VkGraphicsPipelineCreateInfo::pname:pStages set to
ename:VK_SHADER_STAGE_TASK_BIT_NV or ename:VK_SHADER_STAGE_MESH_BIT_NV
endif::VK_NV_mesh_shader[]
ename:VK_SHADER_STAGE_TASK_BIT_EXT or ename:VK_SHADER_STAGE_MESH_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
// Common Valid Usage
11 changes: 7 additions & 4 deletions chapters/commonvalidity/pipeline_stage_common.adoc
Expand Up @@ -36,13 +36,16 @@ ifdef::VK_EXT_transform_feedback[]
is not enabled, pname:pipelineStage must: not be
ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT
endif::VK_EXT_transform_feedback[]
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* [[VUID-{refpage}-pipelineStage-04080]]
If the <<features-meshShader, pname:meshShader>> feature is not enabled,
pname:pipelineStage must: not be
ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV or
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
* [[VUID-{refpage}-pipelineStage-07077]]
If the <<features-taskShader,task shaders>> feature is not enabled,
pname:pipelineStage must: not be
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_shading_rate_image[]
* [[VUID-{refpage}-pipelineStage-04081]]
If the <<features-shadingRateImage, pname:shadingRateImage>> feature is
Expand Down
8 changes: 4 additions & 4 deletions chapters/commonvalidity/stage_mask_2_common.adoc
Expand Up @@ -32,16 +32,16 @@ ifdef::VK_EXT_transform_feedback[]
is not enabled, pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT
endif::VK_EXT_transform_feedback[]
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* [[VUID-{refpage}-{stageMaskName}-03934]]
If the <<features-meshShader, pname:meshShader>> feature is not enabled,
pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV
ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT
* [[VUID-{refpage}-{stageMaskName}-03935]]
If the <<features-taskShader, pname:taskShader>> feature is not enabled,
pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_shading_rate_image[]
* [[VUID-{refpage}-{stageMaskName}-04956]]
If the <<features-shadingRateImage, pname:shadingRateImage>> feature is
Expand Down
8 changes: 4 additions & 4 deletions chapters/commonvalidity/stage_mask_common.adoc
Expand Up @@ -32,16 +32,16 @@ ifdef::VK_EXT_transform_feedback[]
is not enabled, pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT
endif::VK_EXT_transform_feedback[]
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* [[VUID-{refpage}-{stageMaskName}-04095]]
If the <<features-meshShader, pname:meshShader>> feature is not enabled,
pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV
ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
* [[VUID-{refpage}-{stageMaskName}-04096]]
If the <<features-taskShader, pname:taskShader>> feature is not enabled,
pname:{stageMaskName} must: not contain
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_shading_rate_image[]
* [[VUID-{refpage}-{stageMaskName}-04097]]
If the <<features-shadingRateImage, pname:shadingRateImage>> feature is
Expand Down
30 changes: 1 addition & 29 deletions chapters/copies.adoc
Expand Up @@ -6,35 +6,7 @@
= Copy Commands

An application can: copy buffer and image data using several methods
depending on the type of data transfer.
Data can: be copied between buffer objects with
ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyBuffer2 and
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyBuffer and a portion of an image can: be copied to another
image with
ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyImage2 and
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyImage.
Image data can: also be copied to and from buffer memory using
ifndef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyImageToBuffer and fname:vkCmdCopyBufferToImage.
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdCopyImageToBuffer2, fname:vkCmdCopyImageToBuffer,
fname:vkCmdCopyBufferToImage2, and fname:vkCmdCopyBufferToImage.
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
Image data can: be blitted (with or without scaling and filtering) with
ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdBlitImage2 and
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdBlitImage.
Multisampled images can: be resolved to a non-multisampled image with
ifdef::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdResolveImage2 and
endif::VK_VERSION_1_3,VK_KHR_copy_commands2[]
fname:vkCmdResolveImage.
described in this chapter, depending on the type of data transfer.

All copy commands are treated as "`transfer`" operations for the purposes of
synchronization barriers.
Expand Down
34 changes: 22 additions & 12 deletions chapters/descriptorsets.adoc
Expand Up @@ -55,13 +55,16 @@ Storage image loads are supported in all shader stages for image views whose
<<resources-image-view-format-features,format features>> contain
<<formats-properties,ename:VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT>>.

Stores to storage images are supported in compute shaders for image views
whose <<resources-image-view-format-features,format features>> contain
Stores to storage images are supported in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh and]
compute shaders for image views whose
<<resources-image-view-format-features,format features>> contain
<<formats-properties,ename:VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT>>.

Atomic operations on storage images are supported in compute shaders for
image views whose <<resources-image-view-format-features,format features>>
contain
Atomic operations on storage images are supported in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh and]
compute shaders for image views whose
<<resources-image-view-format-features,format features>> contain
<<formats-properties,ename:VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT>>.

When the <<features-fragmentStoresAndAtomics,
Expand Down Expand Up @@ -239,14 +242,16 @@ buffer formats which report support for the
feature bit via flink:vkGetPhysicalDeviceFormatProperties in
slink:VkFormatProperties::pname:bufferFeatures.

Stores to storage texel buffers are supported in compute shaders for texel
buffer formats which report support for the
Stores to storage texel buffers are supported in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh and]
compute shaders for texel buffer formats which report support for the
ename:VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT feature via
flink:vkGetPhysicalDeviceFormatProperties in
slink:VkFormatProperties::pname:bufferFeatures.

Atomic operations on storage texel buffers are supported in compute shaders
for texel buffer formats which report support for the
Atomic operations on storage texel buffers are supported in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh and]
compute shaders for texel buffer formats which report support for the
<<formats-properties,ename:VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT>>
feature via flink:vkGetPhysicalDeviceFormatProperties in
slink:VkFormatProperties::pname:bufferFeatures.
Expand Down Expand Up @@ -619,11 +624,12 @@ ifdef::VK_VALVE_mutable_descriptor_type[]
endif::VK_VALVE_mutable_descriptor_type[]
endif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[]
ifdef::VK_VALVE_mutable_descriptor_type[]
* [[VUID-VkDescriptorSetLayoutCreateInfo-descriptorType-04593]]
If any binding has a pname:descriptorType of
* [[VUID-VkDescriptorSetLayoutCreateInfo-pBindings-07031]]
If any element pname:pBindings[i] has a pname:descriptorType of
ename:VK_DESCRIPTOR_TYPE_MUTABLE_VALVE, then a
slink:VkMutableDescriptorTypeCreateInfoVALVE must: be present in the
pname:pNext chain
pname:pNext chain, and pname:mutableDescriptorTypeCount must: be greater
than i.
* [[VUID-VkDescriptorSetLayoutCreateInfo-descriptorType-04594]]
If a binding has a pname:descriptorType value of
ename:VK_DESCRIPTOR_TYPE_MUTABLE_VALVE, then sname:pImmutableSamplers
Expand Down Expand Up @@ -5059,6 +5065,10 @@ slink:VkBufferDeviceAddressCreateInfoEXT::pname:deviceAddress,
endif::VK_EXT_buffer_device_address[]
the return value will be the same address that was returned at capture time.

The returned address must: satisfy the alignment requirement specified by
slink:VkMemoryRequirements::pname:alignment for the buffer in
slink:VkBufferDeviceAddressInfo::pname:buffer.

.Valid Usage
****
ifdef::VK_EXT_buffer_device_address[]
Expand Down
20 changes: 10 additions & 10 deletions chapters/drawing.adoc
Expand Up @@ -15,16 +15,16 @@ commands are recorded in that command buffer.

[open,refpage='VkPipelineInputAssemblyStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline input assembly state',type='structs']
--
ifdef::VK_NV_mesh_shader[]

ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
Drawing can be achieved in two modes:

* <<drawing-mesh-shading,Programmable Mesh Shading>>, the mesh shader
assembles primitives, or
* <<drawing-primitive-shading,Programmable Primitive Shading>>, the input
primitives are assembled
primitives are assembled as follows.

as follows.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

Each draw is made up of zero or more vertices and zero or more instances,
which are processed by the device and result in the assembly of primitives.
Expand Down Expand Up @@ -186,10 +186,10 @@ beginning of the graphics pipeline.
The effective topology for later stages of the pipeline is altered by
tessellation or geometry shading (if either is in use) and depends on the
execution modes of those shaders.
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
In the case of mesh shading the only effective topology is defined by the
execution mode of the mesh shader.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

[open,refpage='VkPrimitiveTopology',desc='Supported primitive topologies',type='enums']
--
Expand Down Expand Up @@ -751,10 +751,10 @@ Primitive order is initially determined in the following way:
code:vertexIndex to a higher numbered code:vertexIndex.
** For indexed draws, vertices sourced from a lower index buffer addresses
to higher addresses.
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** For draws using mesh shaders, the order is provided by <<mesh-ordering,
mesh shading>>.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

Within this order implementations further sort primitives:

Expand Down Expand Up @@ -1714,6 +1714,6 @@ include::{generated}/validity/protos/vkCmdEndConditionalRenderingEXT.adoc[]
--
endif::VK_EXT_conditional_rendering[]

ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
include::{chapters}/VK_NV_mesh_shader/drawing.adoc[]
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
205 changes: 187 additions & 18 deletions chapters/features.adoc
Expand Up @@ -1036,17 +1036,23 @@ include::{chapters}/features.adoc[tag=VK_KHR_vulkan_memory_model-features]
* [[features-shaderOutputViewportIndex]] pname:shaderOutputViewportIndex
indicates whether the implementation supports the
code:ShaderViewportIndex SPIR-V capability enabling variables decorated
with the code:ViewportIndex built-in to be exported from vertex or
tessellation evaluation shaders.
with the code:ViewportIndex built-in to be exported from
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,]
vertex or tessellation evaluation shaders.
If this feature is not enabled, the code:ViewportIndex built-in
decoration must: not be used on outputs in vertex or tessellation
evaluation shaders.
decoration must: not be used on outputs in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,]
vertex or tessellation evaluation shaders.
* [[features-shaderOutputLayer]] pname:shaderOutputLayer indicates whether
the implementation supports the code:ShaderLayer SPIR-V capability
enabling variables decorated with the code:Layer built-in to be exported
from vertex or tessellation evaluation shaders.
from
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,]
vertex or tessellation evaluation shaders.
If this feature is not enabled, the code:Layer built-in decoration must:
not be used on outputs in vertex or tessellation evaluation shaders.
not be used on outputs in
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,]
vertex or tessellation evaluation shaders.
* [[features-subgroupBroadcastDynamicId]] If
pname:subgroupBroadcastDynamicId is ename:VK_TRUE, the "`Id`" operand of
code:OpGroupNonUniformBroadcast can: be dynamically uniform within a
Expand Down Expand Up @@ -1240,16 +1246,32 @@ This structure describes the following features:
perform 64-bit floating-point add atomic operations on storage buffers.
* [[features-shaderSharedFloat32Atomics]] pname:shaderSharedFloat32Atomics
indicates whether shaders can: perform 32-bit floating-point load, store
and exchange atomic operations on shared memory.
and exchange atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat32AtomicAdd]]
pname:shaderSharedFloat32AtomicAdd indicates whether shaders can:
perform 32-bit floating-point add atomic operations on shared memory.
perform 32-bit floating-point add atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat64Atomics]] pname:shaderSharedFloat64Atomics
indicates whether shaders can: perform 64-bit floating-point load, store
and exchange atomic operations on shared memory.
and exchange atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat64AtomicAdd]]
pname:shaderSharedFloat64AtomicAdd indicates whether shaders can:
perform 64-bit floating-point add atomic operations on shared memory.
perform 64-bit floating-point add atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderImageFloat32Atomics]] pname:shaderImageFloat32Atomics
indicates whether shaders can: perform 32-bit floating-point load, store
and exchange atomic image operations.
Expand Down Expand Up @@ -1306,21 +1328,38 @@ This structure describes the following features:
buffers.
* [[features-shaderSharedFloat16Atomics]] pname:shaderSharedFloat16Atomics
indicates whether shaders can: perform 16-bit floating-point load, store
and exchange atomic operations on shared memory.
and exchange atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat16AtomicAdd]]
pname:shaderSharedFloat16AtomicAdd indicates whether shaders can:
perform 16-bit floating-point add atomic operations on shared memory.
perform 16-bit floating-point add atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat16AtomicMinMax]]
pname:shaderSharedFloat16AtomicMinMax indicates whether shaders can:
perform 16-bit floating-point min and max atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat32AtomicMinMax]]
pname:shaderSharedFloat32AtomicMinMax indicates whether shaders can:
perform 32-bit floating-point min and max atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderSharedFloat64AtomicMinMax]]
pname:shaderSharedFloat64AtomicMinMax indicates whether shaders can:
perform 64-bit floating-point min and max atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
* [[features-shaderImageFloat32AtomicMinMax]]
pname:shaderImageFloat32AtomicMinMax indicates whether shaders can:
Expand Down Expand Up @@ -1366,7 +1405,11 @@ ifndef::VK_VERSION_1_2[:anchor-prefix:]
64-bit unsigned and signed integer atomic operations on buffers.
* [[{anchor-prefix}features-shaderSharedInt64Atomics]]
pname:shaderSharedInt64Atomics indicates whether shaders can: perform
64-bit unsigned and signed integer atomic operations on shared memory.
64-bit unsigned and signed integer atomic operations on shared
ifdef::VK_EXT_mesh_shader[]
and payload
endif::VK_EXT_mesh_shader[]
memory.
// end::VK_KHR_shader_atomic_int64-features[]

:refpage: VkPhysicalDeviceShaderAtomicInt64Features
Expand Down Expand Up @@ -1799,10 +1842,26 @@ This structure describes the following features:
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* [[features-taskShader]] pname:taskShader indicates whether the task
shader stage is supported.
* [[features-meshShader]] pname:meshShader indicates whether the mesh
shader stage is supported.
ifdef::VK_EXT_mesh_shader[]
* pname:taskShader specifies whether task shaders are supported.
endif::VK_EXT_mesh_shader[]
ifndef::VK_EXT_mesh_shader[]
* [[features-taskShader]] pname:taskShader specifies whether task shaders
are supported.
endif::VK_EXT_mesh_shader[]
If this feature is not enabled, the ename:VK_SHADER_STAGE_TASK_BIT_NV
and ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV enum values must: not be
used.
ifdef::VK_EXT_mesh_shader[]
* pname:meshShader specifies whether mesh shaders are supported.
endif::VK_EXT_mesh_shader[]
ifndef::VK_EXT_mesh_shader[]
* [[features-meshShader]] pname:meshShader specifies whether mesh shaders
are supported.
endif::VK_EXT_mesh_shader[]
If this feature is not enabled, the ename:VK_SHADER_STAGE_MESH_BIT_NV
and ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV enum values must: not be
used.

:refpage: VkPhysicalDeviceMeshShaderFeaturesNV
include::{chapters}/features.adoc[tag=features]
Expand All @@ -1811,6 +1870,74 @@ include::{generated}/validity/structs/VkPhysicalDeviceMeshShaderFeaturesNV.adoc[
--
endif::VK_NV_mesh_shader[]

ifdef::VK_EXT_mesh_shader[]
[open,refpage='VkPhysicalDeviceMeshShaderFeaturesEXT',desc='Structure describing mesh shading features that can be supported by an implementation',type='structs']
--
The sname:VkPhysicalDeviceMeshShaderFeaturesEXT structure is defined as:

include::{generated}/api/structs/VkPhysicalDeviceMeshShaderFeaturesEXT.adoc[]

* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.
* [[features-taskShader]] pname:taskShader specifies whether task shaders
are supported.
If this feature is not enabled, the ename:VK_SHADER_STAGE_TASK_BIT_EXT
and ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT enum values must: not be
used.
* [[features-meshShader]] pname:meshShader specifies whether mesh shaders
are supported.
If this feature is not enabled, the ename:VK_SHADER_STAGE_MESH_BIT_EXT
and ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT enum values must: not be
used.
ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
* [[features-multiview-mesh]] pname:multiviewMeshShader specifies whether
the implementation supports <<features-multiview, multiview>> rendering
within a render pass, with mesh shaders.
If this feature is not enabled, then a pipeline compiled against a
subpass with a non-zero view mask must: not include a mesh shader.
endif::VK_VERSION_1_1,VK_KHR_multiview[]
ifdef::VK_KHR_fragment_shading_rate[]
* [[features-primitiveFragmentShadingRate-mesh]]
pname:primitiveFragmentShadingRateMeshShader indicates that the
implementation supports the <<primsrast-fragment-shading-rate-primitive,
primitive fragment shading rate>> in mesh shaders.
endif::VK_KHR_fragment_shading_rate[]
* [[features-meshShaderQueries]] pname:meshShaderQueries indicates that
the implementation supports creating query pools using the
ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT query type and
statistic queries containing the
ename:VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT and
ename:VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT flags

:refpage: VkPhysicalDeviceMeshShaderFeaturesEXT
include::{chapters}/features.adoc[tag=features]

ifdef::VK_NV_mesh_shader[]
The corresponding features of the sname:VkPhysicalDeviceMeshShaderFeaturesNV
structure must: match those in sname:VkPhysicalDeviceMeshShaderFeaturesEXT.
endif::VK_NV_mesh_shader[]

.Valid Usage
****
ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
* [[VUID-VkPhysicalDeviceMeshShaderFeaturesEXT-multiviewMeshShader-07032]]
If pname:multiviewMeshShader is enabled then
sname:VkPhysicalDeviceMultiviewFeaturesKHR::pname:multiview must: also
be enabled
endif::VK_VERSION_1_1,VK_KHR_multiview[]
ifdef::VK_KHR_fragment_shading_rate[]
* [[VUID-VkPhysicalDeviceMeshShaderFeaturesEXT-primitiveFragmentShadingRateMeshShader-07033]]
If pname:primitiveFragmentShadingRateMeshShader is enabled then
sname:VkPhysicalDeviceFragmentShadingRateFeaturesKHR::pname:primitiveFragmentShadingRate
must: also be enabled
endif::VK_KHR_fragment_shading_rate[]
****

include::{generated}/validity/structs/VkPhysicalDeviceMeshShaderFeaturesEXT.adoc[]
--
endif::VK_EXT_mesh_shader[]

ifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[]
[open,refpage='VkPhysicalDeviceDescriptorIndexingFeatures',desc='Structure describing descriptor indexing features that can be supported by an implementation',type='structs',alias='VkPhysicalDeviceDescriptorIndexingFeaturesEXT']
--
Expand Down Expand Up @@ -3410,7 +3537,11 @@ ifndef::VK_VERSION_1_3[:anchor-prefix:]
structure.
* [[{anchor-prefix}features-computeFullSubgroups]]
pname:computeFullSubgroups indicates whether the implementation supports
requiring full subgroups in compute shaders via the
requiring full subgroups in compute
ifdef::VK_NV_mesh_shader[]
, mesh, or task
endif::VK_NV_mesh_shader[]
shaders via the
ename:VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT flag.
// end::VK_EXT_subgroup_size_control-features[]

Expand Down Expand Up @@ -5460,6 +5591,29 @@ include::{generated}/validity/structs/VkPhysicalDeviceImageProcessingFeaturesQCO
--
endif::VK_QCOM_image_processing[]

ifdef::VK_EXT_depth_clamp_zero_one[]
[open,refpage='VkPhysicalDeviceDepthClampZeroOneFeaturesEXT',desc='Structure describing feature to control zero to one depth clamping',type='structs']
--
The sname:VkPhysicalDeviceDepthClampZeroOneFeaturesEXT structure is defined
as:

include::{generated}/api/structs/VkPhysicalDeviceDepthClampZeroOneFeaturesEXT.adoc[]

This structure describes the following feature:

* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to a structure extending this
structure.

* [[features-depthClampZeroOne]] pname:depthClampZeroOne indicates that
the implementation supports clamping the depth to a range of `0` to `1`.

:refpage: VkPhysicalDeviceDepthClampZeroOneFeaturesEXT
include::{chapters}/features.adoc[tag=features]

include::{generated}/validity/structs/VkPhysicalDeviceDepthClampZeroOneFeaturesEXT.adoc[]
--
endif::VK_EXT_depth_clamp_zero_one[]

[[features-requirements]]
== Feature Requirements
Expand Down Expand Up @@ -5916,6 +6070,17 @@ ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[]
* <<features-dynamicRendering, pname:dynamicRendering>>, if Vulkan 1.3 or
the `apiext:VK_KHR_dynamic_rendering` extension is supported.
endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[]
ifdef::VK_EXT_mesh_shader[]
* <<features-taskShader, pname:taskShader>> and <<features-meshShader,
pname:meshShader>>, if the `apiext:VK_EXT_mesh_shader` extension is
supported.
endif::VK_EXT_mesh_shader[]
ifdef::VK_EXT_mesh_shader+VK_KHR_fragment_shading_rate[]
* <<features-primitiveFragmentShadingRate,
pname:primitiveFragmentShadingRate>> if
<<features-primitiveFragmentShadingRate-mesh,
pname:primitiveFragmentShadingRateMeshShader>> feature is supported.
endif::VK_EXT_mesh_shader+VK_KHR_fragment_shading_rate[]
ifdef::VK_EXT_subpass_merge_feedback[]
* <<features-subpassMergeFeedback, pname:subpassMergeFeedback>>, if the
`apiext:VK_EXT_subpass_merge_feedback` extension is supported.
Expand Down Expand Up @@ -5977,6 +6142,10 @@ ifdef::VK_EXT_attachment_feedback_loop_layout[]
pname:attachmentFeedbackLoopLayout>>, if the
`apiext:VK_EXT_attachment_feedback_loop_layout` extension is supported.
endif::VK_EXT_attachment_feedback_loop_layout[]
ifdef::VK_EXT_depth_clamp_zero_one[]
* <<features-depthClampZeroOne, pname:depthClampZeroOne>>, if the
`<<VK_EXT_depth_clamp_zero_one>>` extension is supported.
endif::VK_EXT_depth_clamp_zero_one[]

All other features defined in the Specification are optional:.

Expand Down
2 changes: 1 addition & 1 deletion chapters/formats.adoc
Expand Up @@ -1301,7 +1301,7 @@ Classes>>.
[width="95%",cols="1,6,3,3",options="header"]
|====
^| Plane ^| Compatible format for plane ^| Width relative to the width _w_ of the plane with the largest dimensions ^| Height relative to the height _h_ of the plane with the largest dimensions
include::{generated}/formats/planeformat.txt[]
include::{generated}/formats/planeformat.adoc[]
|====

endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[]
Expand Down
40 changes: 31 additions & 9 deletions chapters/fragops.adoc
Expand Up @@ -853,6 +853,8 @@ include::{generated}/validity/structs/VkPipelineDepthStencilStateCreateInfo.adoc

[open,refpage='VkPipelineDepthStencilStateCreateFlags',desc='Bitmask of VkPipelineDepthStencilStateCreateFlagBits',type='flags']
--
include::{generated}/api/flags/VkPipelineDepthStencilStateCreateFlags.adoc[]

ifndef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[]
tname:VkPipelineDepthStencilStateCreateFlags is a bitmask type for setting a
mask, but is currently reserved for future use.
Expand Down Expand Up @@ -1337,18 +1339,38 @@ sections.
=== Depth Clamping and Range Adjustment

If slink:VkPipelineRasterizationStateCreateInfo::pname:depthClampEnable is
enabled, before the sample's [eq]#z~f~# is compared to [eq]#z~a~#,
[eq]#z~f~# is clamped to [eq]#[min(n,f),max(n,f)]#, where [eq]#n# and
[eq]#f# are the pname:minDepth and pname:maxDepth depth range values of the
viewport used by this fragment, respectively.
enabled, [eq]#z~f~# is clamped to [eq]#[z~min~, z~max~]#, where [eq]#z~min~
= min(n,f)#, [eq]#z~max~ = max(n,f)]#, and [eq]#n# and [eq]#f# are the
pname:minDepth and pname:maxDepth depth range values of the viewport used by
this fragment, respectively.

ifdef::VK_EXT_depth_clamp_zero_one[]
If
slink:VkPhysicalDeviceDepthClampZeroOneFeaturesEXT::pname:depthClampZeroOne
is enabled:

ifdef::VK_EXT_depth_range_unrestricted[]
* If the depth attachment has a floating-point format and
VK_EXT_depth_range_unrestricted is enabled then [eq]#z~f~# is unchanged.
* Otherwise, [eq]#z~f~# is clamped to the range [eq]#[0, 1]#.
endif::VK_EXT_depth_range_unrestricted[]
ifndef::VK_EXT_depth_range_unrestricted[]
* [eq]#z~f~# is clamped to the range [eq]#[0, 1]#.
endif::VK_EXT_depth_range_unrestricted[]

Otherwise:
endif::VK_EXT_depth_clamp_zero_one[]
ifndef::VK_EXT_depth_clamp_zero_one[]
Following depth clamping:
endif::VK_EXT_depth_clamp_zero_one[]

If depth clamping is not enabled and [eq]#z~f~# is not in the range [eq]#[0,
1]#
* If [eq]#z~f~# is not in the range [eq]#[z~min~, z~max~]#, then
[eq]#z~f~# is undefined: following this step.
ifdef::VK_EXT_depth_range_unrestricted[]
and either `apiext:VK_EXT_depth_range_unrestricted` is not enabled, or the
depth attachment has a fixed-point format,
* If the depth attachment has a fixed-point format and [eq]#z~f~# is not
in the range [eq]#[0, 1]#, then [eq]#z~f~# is undefined: following this
step.
endif::VK_EXT_depth_range_unrestricted[]
then [eq]#z~f~# is undefined: following this step.


[[fragops-depth-comparison]]
Expand Down
4 changes: 2 additions & 2 deletions chapters/initialization.adoc
Expand Up @@ -505,8 +505,8 @@ physical device that supports Vulkan 1.2.
====

Implicit layers must: be disabled if they do not support a version at least
as high as pname:apiVersion and their version is less than the highest version
of the drivers on the system.
as high as pname:apiVersion and their version is less than the highest
version of the drivers on the system.
See the <<LoaderInterfaceArchitecture, "`Architecture of the Vulkan Loader
Interfaces`">> document for additional information.

Expand Down
328 changes: 252 additions & 76 deletions chapters/interfaces.adoc

Large diffs are not rendered by default.

292 changes: 264 additions & 28 deletions chapters/limits.adoc

Large diffs are not rendered by default.

278 changes: 222 additions & 56 deletions chapters/pipelines.adoc

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions chapters/primsrast.adoc
Expand Up @@ -1113,8 +1113,16 @@ The _primitive fragment shading rate_ can: be set via the
code:PrimitiveShadingRateKHR>> built-in in the last active
<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
stage>>.
The rate associated with a given primitive is sourced from the value written
to code:PrimitiveShadingRateKHR by that primitive's
ifdef::VK_EXT_mesh_shader[]
If the last <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization
shader stage>> is using the code:MeshEXT {ExecutionModel}, the rate
associated with a given primitive is sourced from the value written to the
per-primitive code:PrimitiveShadingRateKHR.
Otherwise the
endif::VK_EXT_mesh_shader[]
ifndef::VK_EXT_mesh_shader[The]
rate associated with a given primitive is sourced from the value written to
code:PrimitiveShadingRateKHR by that primitive's
<<vertexpostproc-flatshading,provoking vertex>>.


Expand Down Expand Up @@ -2212,13 +2220,13 @@ This means that the per-vertex values of indices 1 and 2 for point
primitives will be equal to those of index 0, and the per-vertex values of
index 2 for line primitives will be equal to those of index 1.

ifndef::VK_NV_mesh_shader[]
ifndef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
When <<tessellation, tessellation>> and <<geometry, geometry shading>>
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
When <<tessellation, tessellation>>, <<geometry, geometry shading>>, and
<<mesh,mesh shading>>
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
are not active, fragment shader inputs decorated with code:PerVertexKHR will
take values from one of the vertices of the primitive that produced the
fragment, identified by the extra index provided in SPIR-V code accessing
Expand Down Expand Up @@ -2279,14 +2287,10 @@ endif::VK_KHR_fragment_shader_barycentric[]
endif::VK_EXT_provoking_vertex[]

When geometry
ifdef::VK_NV_mesh_shader[]
or mesh
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[or mesh]
shading is active, primitives processed by fragment shaders are assembled
from the vertices emitted by the geometry
ifdef::VK_NV_mesh_shader[]
or mesh
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[or mesh]
shader.
In this case, the vertices used for fragment shader inputs decorated with
code:PerVertexKHR are derived by treating the primitives produced by the
Expand Down
80 changes: 78 additions & 2 deletions chapters/queries.adoc
Expand Up @@ -36,6 +36,10 @@ ifdef::VK_INTEL_performance_query[]
<<queries-performance-intel>> are supported if the associated extension is
available.
endif::VK_INTEL_performance_query[]
ifdef::VK_EXT_mesh_shader[]
<<queries-mesh-shader, Mesh Shader Queries>> are supported if the associated
extension is available.
endif::VK_EXT_mesh_shader[]

ifdef::VK_KHR_acceleration_structure,VK_NV_ray_tracing[]
Several additional queries with specific purposes associated with ray
Expand Down Expand Up @@ -103,6 +107,19 @@ ename:VK_QUERY_TYPE_PIPELINE_STATISTICS.
If the <<features-pipelineStatisticsQuery,
pname:pipelineStatisticsQuery>> feature is not enabled, pname:queryType
must: not be ename:VK_QUERY_TYPE_PIPELINE_STATISTICS
ifdef::VK_EXT_mesh_shader[]
* [[VUID-VkQueryPoolCreateInfo-meshShaderQueries-07068]]
If the <<features-meshShaderQueries,pname:meshShaderQueries>> feature is
not enabled, pname:queryType must: not be
ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT
* [[VUID-VkQueryPoolCreateInfo-meshShaderQueries-07069]]
If the <<features-meshShaderQueries,pname:meshShaderQueries>> feature is
not enabled, and pname:queryType is
ename:VK_QUERY_TYPE_PIPELINE_STATISTICS, pname:pipelineStatistics must:
not contain
ename:VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT or
ename:VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT
endif::VK_EXT_mesh_shader[]
* [[VUID-VkQueryPoolCreateInfo-queryType-00792]]
If pname:queryType is ename:VK_QUERY_TYPE_PIPELINE_STATISTICS,
pname:pipelineStatistics must: be a valid combination of
Expand Down Expand Up @@ -229,6 +246,10 @@ ifdef::VK_KHR_video_encode_queue[]
<<queries-video-encode-bitstream-buffer-range, video encode bitstream
range query>>.
endif::VK_KHR_video_encode_queue[]
ifdef::VK_EXT_mesh_shader[]
* ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT specifies a
<<queries-mesh-shader, generated mesh primitives query>>.
endif::VK_EXT_mesh_shader[]
--


Expand Down Expand Up @@ -517,6 +538,13 @@ include::{chapters}/commonvalidity/query_begin_common.adoc[]
pname:queryPool must: have been created with a pname:queryType that
differs from that of any queries that are
<<queries-operation-active,active>> within pname:commandBuffer
ifdef::VK_EXT_mesh_shader[]
* [[VUID-vkCmdBeginQuery-queryType-07070]]
If the pname:queryType used to create pname:queryPool was
ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT the
sname:VkCommandPool that pname:commandBuffer was allocated from must:
support graphics operations
endif::VK_EXT_mesh_shader[]
ifdef::VK_EXT_transform_feedback[]
* [[VUID-vkCmdBeginQuery-queryType-02327]]
If the pname:queryType used to create pname:queryPool was
Expand Down Expand Up @@ -648,6 +676,11 @@ endif::VK_EXT_primitives_generated_query[]
ename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT then
sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackQueries
must: be supported
ifdef::VK_EXT_mesh_shader[]
* [[VUID-vkCmdBeginQueryIndexedEXT-queryType-07071]]
The pname:queryType used to create pname:queryPool must: not be
ename:VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT
endif::VK_EXT_mesh_shader[]
include::{chapters}/commonvalidity/performance_query_begin_common.adoc[]
****

Expand Down Expand Up @@ -855,6 +888,9 @@ endif::VK_EXT_transform_feedback[]
ifdef::VK_EXT_primitives_generated_query[]
primitives generated queries,
endif::VK_EXT_primitives_generated_query[]
ifdef::VK_EXT_mesh_shader[]
mesh shader queries,
endif::VK_EXT_mesh_shader[]
and timestamp queries store results in a tightly packed array of
unsigned integers, either 32- or 64-bits as requested by the command,
storing the numerical results and, if requested, the availability
Expand Down Expand Up @@ -908,6 +944,9 @@ ifdef::VK_EXT_primitives_generated_query[]
This is identical to the second integer of the transform feedback
queries if transform feedback is active.
endif::VK_EXT_primitives_generated_query[]
ifdef::VK_EXT_mesh_shader[]
Mesh shader queries write a single integer.
endif::VK_EXT_mesh_shader[]
* If more than one query is retrieved and pname:stride is not at least as
large as the size of the array of values corresponding to a single
query, the values written to memory are undefined:.
Expand Down Expand Up @@ -935,8 +974,11 @@ include::{generated}/api/protos/vkGetQueryPoolResults.adoc[]
Any results written for a query are written according to
<<queries-operation-memorylayout,a layout dependent on the query type>>.

Results for any query in pname:queryPool identified by pname:firstQuery and
pname:queryCount that is available are copied to pname:pData.
If no bits are set in pname:flags, and all requested queries are in the
available state, results are written as an array of 32-bit unsigned integer
values.
The behavior when not all queries are available, is described
<<queries-wait-bit-not-set, below>>.

If ename:VK_QUERY_RESULT_WITH_AVAILABILITY_BIT is set, results for all
queries in pname:queryPool identified by pname:firstQuery and
Expand Down Expand Up @@ -1521,13 +1563,30 @@ include::{generated}/api/enums/VkQueryPipelineStatisticFlagBits.adoc[]
invocations or execute additional compute shader invocations for
implementation-dependent reasons as long as the results of rendering
otherwise remain unchanged.
ifdef::VK_EXT_mesh_shader[]
* ename:VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT
specifies that queries managed by the pool will count the number of task
shader invocations.
The counter's value is incremented every time the task shader is
invoked.
* ename:VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT
specifies that queries managed by the pool will count the number of mesh
shader invocations.
The counter's value is incremented every time the mesh shader is
invoked.
endif::VK_EXT_mesh_shader[]

These values are intended to measure relative statistics on one
implementation.
Various device architectures will count these values differently.
Any or all counters may: be affected by the issues described in
<<queries-operation-undefined,Query Operation>>.

ifdef::VK_EXT_mesh_shader,VK_NV_mesh_shader[]
This counting difference is especially true if the pipeline contains mesh or
task shaders, which may affect several of the counters in unexpected ways.
endif::VK_EXT_mesh_shader,VK_NV_mesh_shader[]

[NOTE]
.Note
====
Expand Down Expand Up @@ -1895,6 +1954,23 @@ multiple times for purposes of clipping.

endif::VK_EXT_primitives_generated_query[]

ifdef::VK_EXT_mesh_shader[]

[[queries-mesh-shader]]
== Mesh Shader Queries

When a generated mesh primitives query is active, the
mesh-primitives-generated count is incremented every time a primitive
emitted from the mesh shader stage reaches the fragment shader stage.
When a generated mesh primitives query begins, the mesh-primitives-generated
count starts from zero.

Mesh and task shader pipeline statistics queries function the same way that
invocation queries work for other shader stages, counting the number of
times the respective shader stage has been run.
When the statistics query begins, the invocation counters start from zero.
endif::VK_EXT_mesh_shader[]

ifdef::VK_INTEL_performance_query[]
include::{chapters}/VK_INTEL_performance_query/queries.adoc[]
endif::VK_INTEL_performance_query[]
Expand Down
1 change: 1 addition & 0 deletions chapters/renderpass.adoc
Expand Up @@ -1393,6 +1393,7 @@ disabled and all drawing commands execute normally, without this additional
broadcasting.

Some implementations may: not support multiview in conjunction with
ifdef::VK_EXT_mesh_shader[<<features-multiview-mesh,mesh shaders>>,]
<<features-multiview-gs,geometry shaders>> or
<<features-multiview-tess,tessellation shaders>>.

Expand Down
25 changes: 13 additions & 12 deletions chapters/resources.adoc
Expand Up @@ -265,6 +265,10 @@ ifdef::VK_NV_mesh_shader[]
flink:vkCmdDrawMeshTasksIndirectNV,
flink:vkCmdDrawMeshTasksIndirectCountNV,
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
fname:vkCmdDrawMeshTasksIndirectEXT,
fname:vkCmdDrawMeshTasksIndirectCountEXT,
endif::VK_EXT_mesh_shader[]
or flink:vkCmdDispatchIndirect.
ifdef::VK_NV_device_generated_commands[]
It is also suitable for passing as the pname:buffer member of
Expand Down Expand Up @@ -4127,16 +4131,11 @@ ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[]
ename:VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, pname:format
must: be compatible with, or must: be an uncompressed format that is
size-compatible with, the pname:format used to create pname:image
* [[VUID-VkImageViewCreateInfo-image-01584]]
If pname:image was created with the
ename:VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag, the
pname:levelCount and pname:layerCount members of pname:subresourceRange
must: both be `1`
* [[VUID-VkImageViewCreateInfo-image-04739]]
* [[VUID-VkImageViewCreateInfo-image-07072]]
If pname:image was created with the
ename:VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT flag and
pname:format is a non-compressed format, pname:viewType must: not be
ename:VK_IMAGE_VIEW_TYPE_3D
pname:format is a non-compressed format, the pname:levelCount and
pname:layerCount members of pname:subresourceRange must: both be `1`
endif::VK_VERSION_1_1,VK_KHR_maintenance2[]
ifdef::VK_VERSION_1_2,VK_KHR_image_format_list[]
* [[VUID-VkImageViewCreateInfo-pNext-01585]]
Expand Down Expand Up @@ -5450,8 +5449,8 @@ ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR.
[NOTE]
.Note
====
ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR is intended to be used
by API translation layers.
ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR is intended to be used by
API translation layers.
This can be used at acceleration structure creation time in cases where the
actual acceleration structure type (top or bottom) is not yet known.
The actual acceleration structure type must be specified as
Expand Down Expand Up @@ -5702,8 +5701,8 @@ endif::VK_NV_ray_tracing[]
* ename:VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR is an acceleration
structure whose type is determined at build time used for special
circumstances.
In these cases, the acceleration structure type is not known at creation time,
but must: be specified at build time as either top or bottom.
In these cases, the acceleration structure type is not known at creation
time, but must: be specified at build time as either top or bottom.
--

ifdef::VK_KHR_acceleration_structure[]
Expand Down Expand Up @@ -6341,6 +6340,8 @@ That is, the difference in returned addresses between the two must: be the
same as the difference in offsets provided at acceleration structure
creation.

The returned address must: be aligned to 256 bytes.

[NOTE]
.Note
====
Expand Down
58 changes: 44 additions & 14 deletions chapters/shaders.adoc
Expand Up @@ -492,8 +492,7 @@ shader stages with similar meaning.
The specific behavior of variables decorated as code:BuiltIn is documented
in the following sections.


ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
[[shaders-task]]
== Task Shaders

Expand All @@ -508,8 +507,15 @@ Task shaders are invoked via the execution of the

The task shader has no fixed-function inputs other than variables
identifying the specific workgroup and invocation.
The only fixed output of the task shader is a task count, identifying the
number of mesh shader workgroups to create.
ifdef::VK_NV_mesh_shader[]
In the code:TaskNV {ExecutionModel} the number of mesh shader workgroups to
create is specified via a code:TaskCountNV decorated output variable.
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
In the code:TaskEXT {ExecutionModel} the number of mesh shader workgroups to
create is specified via the code:OpEmitMeshTasksEXT instruction.
endif::VK_EXT_mesh_shader[]

The task shader can write additional outputs to task memory, which can be
read by all of the mesh shader workgroups it created.

Expand All @@ -529,7 +535,12 @@ decoration.
An invocation within a local workgroup can: share data with other members of
the local workgroup through shared variables and issue memory and control
flow barriers to synchronize with other members of the local workgroup.

ifdef::VK_EXT_mesh_shader[]
ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
If the subpass includes multiple views in its view mask, a Task shader using
code:TaskEXT {ExecutionModel} may: be invoked separately for each view.
endif::VK_VERSION_1_1,VK_KHR_multiview[]
endif::VK_EXT_mesh_shader[]

[[shaders-mesh]]
== Mesh Shaders
Expand Down Expand Up @@ -572,26 +583,31 @@ An invocation within a local workgroup can: share data with other members of
the local workgroup through shared variables and issue memory and control
flow barriers to synchronize with other members of the local workgroup.

The _global workgroups_ may be generated explcitly via the API, or
The _global workgroups_ may be generated explicitly via the API, or
implicitly through the task shader's work creation mechanism.
endif::VK_NV_mesh_shader[]

endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
ifdef::VK_VERSION_1_1,VK_KHR_multiview[]
If the subpass includes multiple views in its view mask, a Mesh shader using
code:MeshEXT {ExecutionModel} may: be invoked separately for each view.
endif::VK_VERSION_1_1,VK_KHR_multiview[]
endif::VK_EXT_mesh_shader[]

[[shaders-vertex]]
== Vertex Shaders

Each vertex shader invocation operates on one vertex and its associated
<<fxvertex-attrib,vertex attribute>> data, and outputs one vertex and
associated data.
ifndef::VK_NV_mesh_shader[]
ifndef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
Graphics pipelines must: include a vertex shader, and the vertex shader
stage is always the first shader stage in the graphics pipeline.
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
Graphics pipelines using primitive shading must: include a vertex shader,
and the vertex shader stage is always the first shader stage in the graphics
pipeline.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]


[[shaders-vertex-execution]]
Expand Down Expand Up @@ -923,6 +939,20 @@ Variables in the code:Input storage class in a fragment shader's interface
are interpolated from the values specified by the primitive being
rasterized.

[NOTE]
.Note
====
Interpolation decorations can be present on input and output variables in
pre-rasterization shaders but have no effect on the interpolation performed.
ifdef::VK_EXT_graphics_pipeline_libraries[]
However, when linking graphics pipeline libraries, if the
<<limits-graphicsPipelineLibraryIndependentInterpolationDecoration,
pname:graphicsPipelineLibraryIndependentInterpolationDecoration>> limit is
not supported, interpolation qualifiers do need to match between the
fragment shader input and the last pre-rasterization shader output.
endif::VK_EXT_graphics_pipeline_libraries[]
====

An undecorated input variable will be interpolated with perspective-correct
interpolation according to the primitive type being rasterized.
<<line_perspective_interpolation,Lines>> and
Expand Down Expand Up @@ -1166,9 +1196,9 @@ Each invocation in a local workgroup must: be in the same
<<shaders-scope-command, command scope instance>>.

Only
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
task, mesh, and
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
compute shaders have defined workgroups - other shader types cannot: use
workgroup functionality.
For shaders that have defined workgroups, this set of invocations forms an
Expand Down
86 changes: 43 additions & 43 deletions chapters/synchronization.adoc
Expand Up @@ -345,12 +345,12 @@ ifdef::VK_NV_device_generated_commands[]
This stage also includes reading commands written by
flink:vkCmdPreprocessGeneratedCommandsNV.
endif::VK_NV_device_generated_commands[]
ifdef::VK_NV_mesh_shader[]
* ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV specifies the task shader
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT specifies the task shader
stage.
* ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV specifies the mesh shader
* ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT specifies the mesh shader
stage.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* ename:VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT specifies the stage of the
pipeline where index buffers are consumed.
* ename:VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT specifies the stage
Expand All @@ -375,10 +375,10 @@ endif::VK_NV_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT
** ename:VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT
** ename:VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT
ifdef::VK_NV_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV
** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT
** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* ename:VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT specifies the fragment
shader stage.
* ename:VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT specifies the stage
Expand Down Expand Up @@ -441,10 +441,10 @@ endif::VK_KHR_acceleration_structure,VK_NV_ray_tracing[]
* ename:VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT specifies the execution of
all graphics pipeline stages, and is equivalent to the logical OR of:
** ename:VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT
ifdef::VK_NV_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV
** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT
** ename:VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** ename:VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT
** ename:VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT
** ename:VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT
Expand Down Expand Up @@ -588,12 +588,12 @@ ifdef::VK_NV_device_generated_commands[]
This stage also includes reading commands written by
flink:vkCmdExecuteGeneratedCommandsNV.
endif::VK_NV_device_generated_commands[]
ifdef::VK_NV_mesh_shader[]
* ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV specifies the task shader
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT specifies the task shader
stage.
* ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV specifies the mesh shader
* ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT specifies the mesh shader
stage.
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
* ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT specifies the stage of the
pipeline where vertex and index buffers are consumed.
* ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT specifies the vertex shader
Expand Down Expand Up @@ -672,10 +672,10 @@ endif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
* ename:VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT specifies the execution of all
graphics pipeline stages, and is equivalent to the logical OR of:
** ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT
ifdef::VK_NV_mesh_shader[]
** ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV
** ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
** ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
** ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT
** ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT
** ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT
Expand Down Expand Up @@ -828,10 +828,10 @@ endif::VK_NV_device_generated_commands[]
ifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
|ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR | ename:VK_QUEUE_GRAPHICS_BIT
endif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
ifdef::VK_NV_mesh_shader[]
|ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV | ename:VK_QUEUE_GRAPHICS_BIT
|ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV | ename:VK_QUEUE_GRAPHICS_BIT
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
|ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT | ename:VK_QUEUE_GRAPHICS_BIT
|ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT | ename:VK_QUEUE_GRAPHICS_BIT
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[]
|ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR | ename:VK_QUEUE_COMPUTE_BIT
endif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[]
Expand Down Expand Up @@ -889,9 +889,9 @@ Stages executed by graphics pipelines can: only be specified in commands
recorded for queues supporting ename:VK_QUEUE_GRAPHICS_BIT.

The graphics
ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
primitive
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
pipeline executes the following stages, with the logical ordering of the
stages matching the order specified here:

Expand All @@ -918,21 +918,21 @@ endif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
* ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
* ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT

ifdef::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
The graphics mesh pipeline executes the following stages, with the logical
ordering of the stages matching the order specified here:

* ename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT
* ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV
* ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV
* ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
* ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
ifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
* ename:VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR
endif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate_image[]
* ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
* ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT
* ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
* ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
endif::VK_NV_mesh_shader[]
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]

For the compute pipeline, the following stages occur in this order:

Expand Down Expand Up @@ -1565,9 +1565,9 @@ endif::VK_KHR_acceleration_structure[]
|ename:VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | ename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT

|ename:VK_ACCESS_UNIFORM_READ_BIT |
ifdef::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV,
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
endif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
Expand All @@ -1577,18 +1577,18 @@ endif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
ifdef::VK_KHR_acceleration_structure[]
ename:VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
endif::VK_KHR_acceleration_structure[]
ifdef::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV,
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
endif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, or ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT

|ename:VK_ACCESS_SHADER_WRITE_BIT |
ifdef::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV,
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
ename:VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
endif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[]
Expand Down Expand Up @@ -1635,9 +1635,9 @@ endif::VK_EXT_transform_feedback[]
ifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[]
|ename:VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR |
ifdef::VK_KHR_ray_query[]
ifdef::VK_NV_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV,
endif::VK_NV_mesh_shader[]
ifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ename:VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT, ename:VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT,
endif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
ename:VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT, ename:VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT, ename:VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT, ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, ename:VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
endif::VK_KHR_ray_query[]
ifdef::VK_KHR_ray_tracing_pipeline[]
Expand Down Expand Up @@ -3128,7 +3128,7 @@ will have a default elink:VkSemaphoreType of ename:VK_SEMAPHORE_TYPE_BINARY.
include::{generated}/validity/structs/VkSemaphoreTypeCreateInfo.adoc[]
--

[open,refpage='VkSemaphoreType',desc='Sepcifies the type of a semaphore object',type='enums',alias='VkSemaphoreTypeKHR']
[open,refpage='VkSemaphoreType',desc='Specifies the type of a semaphore object',type='enums',alias='VkSemaphoreTypeKHR']
--
Possible values of slink:VkSemaphoreTypeCreateInfo::pname:semaphoreType,
specifying the type of a semaphore, are:
Expand Down
26 changes: 23 additions & 3 deletions chapters/vertexpostproc.adoc
Expand Up @@ -556,12 +556,32 @@ Flat shading is applied to those vertex attributes that
<<interfaces-iointerfaces-matching,match>> fragment input attributes which
are decorated as code:Flat.

If neither <<geometry,geometry>> nor <<tessellation,tessellation shading>>
is active, the provoking vertex is determined by the
<<drawing-primitive-topologies, primitive topology>> defined by
If neither
ifdef::VK_EXT_mesh_shader,VK_NV_mesh_shader[]
<<mesh, mesh>>,
endif::VK_EXT_mesh_shader,VK_NV_mesh_shader[]
<<geometry,geometry>> nor <<tessellation,tessellation shading>> is active,
the provoking vertex is determined by the <<drawing-primitive-topologies,
primitive topology>> defined by
slink:VkPipelineInputAssemblyStateCreateInfo:pname:topology used to execute
the <<drawing,drawing command>>.

ifdef::VK_NV_mesh_shader[]
If a shader using code:MeshNV {ExecutionModel} is active, the provoking
vertex is determined by the <<drawing-primitive-topologies, primitive
topology>> defined by the <<drawing-point-lists, code:OutputPoints>>,
<<drawing-line-lists, code:OutputLinesNV>>, or <<drawing-triangle-lists,
code:OutputTrianglesNV>> execution mode.
endif::VK_NV_mesh_shader[]

ifdef::VK_EXT_mesh_shader[]
If a shader using code:MeshEXT {ExecutionModel} is active, the provoking
vertex is determined by the <<drawing-primitive-topologies, primitive
topology>> defined by the <<drawing-point-lists, code:OutputPoints>>,
<<drawing-line-lists, code:OutputLinesEXT>>, or <<drawing-triangle-lists,
code:OutputTrianglesEXT>> execution mode.
endif::VK_EXT_mesh_shader[]

If <<geometry,geometry shading>> is active, the provoking vertex is
determined by the <<drawing-primitive-topologies, primitive topology>>
defined by the <<drawing-point-lists, code:OutputPoints>>,
Expand Down