C Specification
To record an indirect mesh tasks draw, call:
// Provided by VK_NV_mesh_shader
void vkCmdDrawMeshTasksIndirectNV(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride);
Parameters
-
commandBufferis the command buffer into which the command is recorded. -
bufferis the buffer containing draw parameters. -
offsetis the byte offset intobufferwhere parameters begin. -
drawCountis the number of draws to execute, and can be zero. -
strideis the byte stride between successive sets of draw parameters.
Description
vkCmdDrawMeshTasksIndirectNV behaves similarly to
vkCmdDrawMeshTasksNV except that the parameters are read by the device
from a buffer during execution.
drawCount draws are executed by the command, with parameters taken
from buffer starting at offset and increasing by stride
bytes for each successive draw.
The parameters of each draw are encoded in an array of
VkDrawMeshTasksIndirectCommandNV structures.
If drawCount is less than or equal to one, stride is ignored.
-
If a
VkImageViewis sampled withVK_FILTER_LINEARas a result of this command, then the image view’s format features must containVK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT -
If a
VkImageViewis accessed using atomic operations as a result of this command, then the image view’s format features must containVK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT -
If a
VkImageViewis sampled withVK_FILTER_CUBIC_EXTas a result of this command, then the image view’s format features must containVK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT -
Any VkImageView being sampled with
VK_FILTER_CUBIC_EXTas a result of this command must have a VkImageViewType and format that supports cubic filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicreturned byvkGetPhysicalDeviceImageFormatProperties2 -
Any VkImageView being sampled with
VK_FILTER_CUBIC_EXTwith a reduction mode of eitherVK_SAMPLER_REDUCTION_MODE_MINorVK_SAMPLER_REDUCTION_MODE_MAXas a result of this command must have a VkImageViewType and format that supports cubic filtering together with minmax filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicMinmaxreturned byvkGetPhysicalDeviceImageFormatProperties2 -
Any VkImage created with a VkImageCreateInfo::
flagscontainingVK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NVsampled as a result of this command must only be sampled using a VkSamplerAddressMode ofVK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE -
For each set n that is statically used by the
VkPipelinebound to the pipeline bind point used by this command, a descriptor set must have been bound to n at the same pipeline bind point, with aVkPipelineLayoutthat is compatible for set n, with theVkPipelineLayoutused to create the currentVkPipeline, as described in [descriptorsets-compatibility] -
For each push constant that is statically used by the
VkPipelinebound to the pipeline bind point used by this command, a push constant value must have been set for the same pipeline bind point, with aVkPipelineLayoutthat is compatible for push constants, with theVkPipelineLayoutused to create the currentVkPipeline, as described in [descriptorsets-compatibility] -
Descriptors in each bound descriptor set, specified via
vkCmdBindDescriptorSets, must be valid if they are statically used by theVkPipelinebound to the pipeline bind point used by this command -
A valid pipeline must be bound to the pipeline bind point used by this command
-
If the
VkPipelineobject bound to the pipeline bind point used by this command requires any dynamic state, that state must have been set forcommandBuffer, and done so after any previously bound pipeline with the corresponding state not specified as dynamic -
There must not have been any calls to dynamic state setting commands for any state not specified as dynamic in the
VkPipelineobject bound to the pipeline bind point used by this command, since that pipeline was bound -
If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject that uses unnormalized coordinates, that sampler must not be used to sample from anyVkImagewith aVkImageViewof the typeVK_IMAGE_VIEW_TYPE_3D,VK_IMAGE_VIEW_TYPE_CUBE,VK_IMAGE_VIEW_TYPE_1D_ARRAY,VK_IMAGE_VIEW_TYPE_2D_ARRAYorVK_IMAGE_VIEW_TYPE_CUBE_ARRAY, in any shader stage -
If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-VOpImageSample*orOpImageSparseSample*instructions withImplicitLod,DreforProjin their name, in any shader stage -
If the
VkPipelineobject bound to the pipeline bind point used by this command accesses aVkSamplerobject that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-VOpImageSample*orOpImageSparseSample*instructions that includes a LOD bias or any offset values, in any shader stage -
If the robust buffer access feature is not enabled, and if the
VkPipelineobject bound to the pipeline bind point used by this command accesses a uniform buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point -
If the robust buffer access feature is not enabled, and if the
VkPipelineobject bound to the pipeline bind point used by this command accesses a storage buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point -
If
commandBufferis an unprotected command buffer, any resource accessed by theVkPipelineobject bound to the pipeline bind point used by this command must not be a protected resource -
If a
VkImageViewis accessed usingOpImageWriteas a result of this command, then theTypeof theTexeloperand of that instruction must have at least as many components as the image view’s format. -
The current render pass must be compatible with the
renderPassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toVK_PIPELINE_BIND_POINT_GRAPHICS -
The subpass index of the current render pass must be equal to the
subpassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toVK_PIPELINE_BIND_POINT_GRAPHICS -
Every input attachment used by the current subpass must be bound to the pipeline via a descriptor set
-
Image subresources used as attachments in the current render pass must not be accessed in any way other than as an attachment by this command
-
If the draw is recorded in a render pass instance with multiview enabled, the maximum instance index must be less than or equal to VkPhysicalDeviceMultiviewProperties::
maxMultiviewInstanceIndex -
If the bound graphics pipeline was created with VkPipelineSampleLocationsStateCreateInfoEXT::
sampleLocationsEnableset toVK_TRUEand the current subpass has a depth/stencil attachment, then that attachment must have been created with theVK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXTbit set -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled, but not theVK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXTdynamic state enabled, then vkCmdSetViewportWithCountEXT must have been called in the current command buffer prior to this draw command, and theviewportCountparameter ofvkCmdSetViewportWithCountEXTmust match theVkPipelineViewportStateCreateInfo::scissorCountof the pipeline -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXTdynamic state enabled, but not theVK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled, then vkCmdSetScissorWithCountEXT must have been called in the current command buffer prior to this draw command, and thescissorCountparameter ofvkCmdSetScissorWithCountEXTmust match theVkPipelineViewportStateCreateInfo::viewportCountof the pipeline -
If the bound graphics pipeline state was created with both the
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXTandVK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic states enabled then both vkCmdSetViewportWithCountEXT and vkCmdSetScissorWithCountEXT must have been called in the current command buffer prior to this draw command, and theviewportCountparameter ofvkCmdSetViewportWithCountEXTmust match thescissorCountparameter ofvkCmdSetScissorWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled, but not theVK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NVdynamic state enabled, then the bound graphics pipeline must have been created with VkPipelineViewportWScalingStateCreateInfoNV::viewportCountgreater or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTandVK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NVdynamic states enabled then theviewportCountparameter in the last call to vkCmdSetViewportWScalingNV must be greater than or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled, but not theVK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NVdynamic state enabled, then the bound graphics pipeline must have been created with VkPipelineViewportShadingRateImageStateCreateInfoNV::viewportCountgreater or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTandVK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NVdynamic states enabled then theviewportCountparameter in the last call to vkCmdSetViewportShadingRatePaletteNV must be greater than or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled and an instance of VkPipelineViewportSwizzleStateCreateInfoNV chained fromVkPipelineVieportCreateInfo, then the bound graphics pipeline must have been created with VkPipelineViewportSwizzleStateCreateInfoNV::viewportCountgreater or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXTdynamic state enabled and an instance of VkPipelineViewportExclusiveScissorStateCreateInfoNV chained fromVkPipelineVieportCreateInfo, then the bound graphics pipeline must have been created with VkPipelineViewportExclusiveScissorStateCreateInfoNV::exclusiveScissorCountgreater or equal to theviewportCountparameter in the last call to vkCmdSetViewportWithCountEXT -
If the bound graphics pipeline state was created with the
VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXTdynamic state enabled then vkCmdSetPrimitiveTopologyEXT must have been called in the current command buffer prior to this draw command, and theprimitiveTopologyparameter ofvkCmdSetPrimitiveTopologyEXTmust be of the same topology class as the pipeline VkPipelineInputAssemblyStateCreateInfo::topologystate
-
If the multi-draw indirect feature is not enabled,
drawCountmust be0or1 -
drawCountmust be less than or equal toVkPhysicalDeviceLimits::maxDrawIndirectCount -
If
drawCountis greater than1,stridemust be a multiple of4and must be greater than or equal tosizeof(VkDrawMeshTasksIndirectCommandNV) -
If
drawCountis equal to1, (offset+sizeof(VkDrawMeshTasksIndirectCommandNV)) must be less than or equal to the size ofbuffer -
If
drawCountis greater than1, (stride× (drawCount- 1) +offset+sizeof(VkDrawMeshTasksIndirectCommandNV)) must be less than or equal to the size ofbuffer
-
commandBuffermust be a valid VkCommandBuffer handle -
buffermust be a valid VkBuffer handle -
commandBuffermust be in the recording state -
The
VkCommandPoolthatcommandBufferwas allocated from must support graphics operations -
This command must only be called inside of a render pass instance
-
Both of
buffer, andcommandBuffermust have been created, allocated, or retrieved from the same VkDevice
-
Host access to
commandBuffermust be externally synchronized -
Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
| Command Buffer Levels | Render Pass Scope | Supported Queue Types | Pipeline Type |
|---|---|---|---|
Primary |
Inside |
Graphics |
Graphics |
See Also
VkBuffer, VkCommandBuffer, VkDeviceSize
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.