Class KHRDrawIndirectCount
- java.lang.Object
-
- org.lwjgl.vulkan.KHRDrawIndirectCount
-
public class KHRDrawIndirectCount extends java.lang.ObjectThis extension is based off the VK_AMD_draw_indirect_count extension. This extension allows an application to source the number of draw calls for indirect draw calls from a buffer. This enables applications to generate arbitrary amounts of draw commands and execute them without host intervention.- Name String
VK_KHR_draw_indirect_count- Extension Type
- Device extension
- Registered Extension Number
- 170
- Revision
- 1
- Extension and Version Dependencies
- Requires Vulkan 1.0
- Contact
- Piers Daniell pdaniell-nv
- Status
- Draft
- Last Modified Date
- 2017-08-25
- IP Status
- No known IP claims.
- Contributors
- Matthaeus G. Chajdas, AMD
- Derrick Owens, AMD
- Graham Sellers, AMD
- Daniel Rakos, AMD
- Dominik Witczak, AMD
- Piers Daniell, NVIDIA
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAMEThe extension name.static intVK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSIONThe extension specification version.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidvkCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, long buffer, long offset, long countBuffer, long countBufferOffset, int maxDrawCount, int stride)Perform an indexed indirect draw with the draw count sourced from a buffer.static voidvkCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, long buffer, long offset, long countBuffer, long countBufferOffset, int maxDrawCount, int stride)Perform an indirect draw with the draw count sourced from a buffer.
-
-
-
Field Detail
-
VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION
public static final int VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION
The extension specification version.- See Also:
- Constant Field Values
-
VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME
public static final java.lang.String VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME
The extension name.- See Also:
- Constant Field Values
-
-
Method Detail
-
vkCmdDrawIndirectCountKHR
public static void vkCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, long buffer, long offset, long countBuffer, long countBufferOffset, int maxDrawCount, int stride)
Perform an indirect draw with the draw count sourced from a buffer.C Specification
To record a non-indexed draw call with a draw call count sourced from a buffer, call:
void vkCmdDrawIndirectCountKHR( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);or the equivalent command
void vkCmdDrawIndirectCountAMD( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);Description
vkCmdDrawIndirectCountKHRbehaves similarly toCmdDrawIndirectexcept that the draw count is read by the device from a buffer during execution. The command will read an unsigned 32-bit integer fromcountBufferlocated atcountBufferOffsetand use this as the draw count.Valid Usage
- If a
VkImageViewis sampled withFILTER_LINEARas a result of this command, then the image view’s format features must containFORMAT_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 containFORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT - If a
VkImageViewis sampled withFILTER_CUBIC_EXTas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTwith a reduction mode of eitherSAMPLER_REDUCTION_MODE_MIN_EXTorSAMPLER_REDUCTION_MODE_MAX_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering together with minmax filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicMinmaxreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImagecreated with aVkImageCreateInfo::flagscontainingIMAGE_CREATE_CORNER_SAMPLED_BIT_NVsampled as a result of this command must only be sampled using aVkSamplerAddressModeofSAMPLER_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 Pipeline Layout 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 Pipeline Layout 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 - 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 typeIMAGE_VIEW_TYPE_3D,IMAGE_VIEW_TYPE_CUBE,IMAGE_VIEW_TYPE_1D_ARRAY,IMAGE_VIEW_TYPE_2D_ARRAYorIMAGE_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 - The current render pass must be compatible with the
renderPassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toPIPELINE_BIND_POINT_GRAPHICS. - The subpass index of the current render pass must be equal to the
subpassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toPIPELINE_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 toTRUEand the current subpass has a depth/stencil attachment, then that attachment must have been created with theIMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXTbit set - All vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must have valid buffers bound
- For a given vertex buffer binding, any attribute data fetched must be entirely contained within the corresponding vertex buffer binding, as described in Vertex Input Description
- If
bufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject buffermust have been created with theBUFFER_USAGE_INDIRECT_BUFFER_BITbit setoffsetmust be a multiple of 4commandBuffermust not be a protected command buffer- If
countBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject countBuffermust have been created with theBUFFER_USAGE_INDIRECT_BUFFER_BITbit setcountBufferOffsetmust be a multiple of 4- The count stored in
countBuffermust be less than or equal toVkPhysicalDeviceLimits::maxDrawIndirectCount stridemust be a multiple of 4 and must be greater than or equal to sizeof(VkDrawIndirectCommand)- If
maxDrawCountis greater than or equal to 1,(stride × (maxDrawCount - 1) + offset + sizeof(must be less than or equal to the size ofVkDrawIndirectCommand))buffer - If the count stored in
countBufferis equal to 1,(offset + sizeof(must be less than or equal to the size ofVkDrawIndirectCommand))buffer - If the count stored in
countBufferis greater than 1,(stride × (drawCount - 1) + offset + sizeof(must be less than or equal to the size ofVkDrawIndirectCommand))buffer
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlebuffermust be a validVkBufferhandlecountBuffermust be a validVkBufferhandlecommandBuffermust 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
- Each of
buffer,commandBuffer, andcountBuffermust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Inside Graphics Graphics - Parameters:
commandBuffer- the command buffer into which the command is recorded.buffer- the buffer containing draw parameters.offset- the byte offset intobufferwhere parameters begin.countBuffer- the buffer containing the draw count.countBufferOffset- the byte offset intocountBufferwhere the draw count begins.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 incountBufferandmaxDrawCount.stride- the byte stride between successive sets of draw parameters.
- If a
-
vkCmdDrawIndexedIndirectCountKHR
public static void vkCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, long buffer, long offset, long countBuffer, long countBufferOffset, int maxDrawCount, int stride)
Perform an indexed indirect draw with the draw count sourced from a buffer.C Specification
To record an indexed draw call with a draw call count sourced from a buffer, call:
void vkCmdDrawIndexedIndirectCountKHR( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);or the equivalent command
void vkCmdDrawIndexedIndirectCountAMD( VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);Description
vkCmdDrawIndexedIndirectCountKHRbehaves similarly toCmdDrawIndexedIndirectexcept that the draw count is read by the device from a buffer during execution. The command will read an unsigned 32-bit integer fromcountBufferlocated atcountBufferOffsetand use this as the draw count.Valid Usage
- If a
VkImageViewis sampled withFILTER_LINEARas a result of this command, then the image view’s format features must containFORMAT_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 containFORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT - If a
VkImageViewis sampled withFILTER_CUBIC_EXTas a result of this command, then the image view’s format features must containFORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImageViewbeing sampled withFILTER_CUBIC_EXTwith a reduction mode of eitherSAMPLER_REDUCTION_MODE_MIN_EXTorSAMPLER_REDUCTION_MODE_MAX_EXTas a result of this command must have aVkImageViewTypeand format that supports cubic filtering together with minmax filtering, as specified byVkFilterCubicImageViewImageFormatPropertiesEXT::filterCubicMinmaxreturned byvkGetPhysicalDeviceImageFormatProperties2 - Any
VkImagecreated with aVkImageCreateInfo::flagscontainingIMAGE_CREATE_CORNER_SAMPLED_BIT_NVsampled as a result of this command must only be sampled using aVkSamplerAddressModeofSAMPLER_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 Pipeline Layout 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 Pipeline Layout 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 - 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 typeIMAGE_VIEW_TYPE_3D,IMAGE_VIEW_TYPE_CUBE,IMAGE_VIEW_TYPE_1D_ARRAY,IMAGE_VIEW_TYPE_2D_ARRAYorIMAGE_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 - The current render pass must be compatible with the
renderPassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toPIPELINE_BIND_POINT_GRAPHICS. - The subpass index of the current render pass must be equal to the
subpassmember of theVkGraphicsPipelineCreateInfostructure specified when creating theVkPipelinebound toPIPELINE_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 toTRUEand the current subpass has a depth/stencil attachment, then that attachment must have been created with theIMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXTbit set - All vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must have valid buffers bound
- For a given vertex buffer binding, any attribute data fetched must be entirely contained within the corresponding vertex buffer binding, as described in Vertex Input Description
- If
bufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject buffermust have been created with theBUFFER_USAGE_INDIRECT_BUFFER_BITbit setoffsetmust be a multiple of 4commandBuffermust not be a protected command buffer- If
countBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject countBuffermust have been created with theBUFFER_USAGE_INDIRECT_BUFFER_BITbit setcountBufferOffsetmust be a multiple of 4- The count stored in
countBuffermust be less than or equal toVkPhysicalDeviceLimits::maxDrawIndirectCount stridemust be a multiple of 4 and must be greater than or equal to sizeof(VkDrawIndexedIndirectCommand)- If
maxDrawCountis greater than or equal to 1,(stride × (maxDrawCount - 1) + offset + sizeof(must be less than or equal to the size ofVkDrawIndexedIndirectCommand))buffer - If count stored in
countBufferis equal to 1,(offset + sizeof(must be less than or equal to the size ofVkDrawIndexedIndirectCommand))buffer - If count stored in
countBufferis greater than 1,(stride × (drawCount - 1) + offset + sizeof(must be less than or equal to the size ofVkDrawIndexedIndirectCommand))buffer
Valid Usage (Implicit)
commandBuffermust be a validVkCommandBufferhandlebuffermust be a validVkBufferhandlecountBuffermust be a validVkBufferhandlecommandBuffermust 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
- Each of
buffer,commandBuffer, andcountBuffermust have been created, allocated, or retrieved from the sameVkDevice
Host Synchronization
- Host access to
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type Primary Secondary Inside Graphics Graphics - Parameters:
commandBuffer- the command buffer into which the command is recorded.buffer- the buffer containing draw parameters.offset- the byte offset intobufferwhere parameters begin.countBuffer- the buffer containing the draw count.countBufferOffset- the byte offset intocountBufferwhere the draw count begins.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 incountBufferandmaxDrawCount.stride- the byte stride between successive sets of draw parameters.
- If a
-
-