org.lwjgl.vulkan.AMDDrawIndirectCount Maven / Gradle / Ivy
Show all versions of lwjgl-vulkan Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
/**
* 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
* - {@code VK_AMD_draw_indirect_count}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 34
* - Revision
* - 1
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
*
* - Contact
*
* - Daniel Rakos @aqnuep
*
* - Last Modified Date
* - 2016-08-23
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Matthaeus G. Chajdas, AMD
* - Derrick Owens, AMD
* - Graham Sellers, AMD
* - Daniel Rakos, AMD
* - Dominik Witczak, AMD
*
*
*/
public class AMDDrawIndirectCount {
/** The extension specification version. */
public static final int VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME = "VK_AMD_draw_indirect_count";
protected AMDDrawIndirectCount() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(VKCapabilitiesDevice caps) {
return checkFunctions(
caps.vkCmdDrawIndirectCountAMD, caps.vkCmdDrawIndexedIndirectCountAMD
);
}
// --- [ vkCmdDrawIndirectCountAMD ] ---
/**
* 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 vkCmdDrawIndirectCountAMD(
* VkCommandBuffer commandBuffer,
* VkBuffer buffer,
* VkDeviceSize offset,
* VkBuffer countBuffer,
* VkDeviceSize countBufferOffset,
* uint32_t maxDrawCount,
* uint32_t stride);
*
* Description
*
* {@link #vkCmdDrawIndirectCountAMD CmdDrawIndirectCountAMD} behaves similar to {@link VK10#vkCmdDrawIndirect CmdDrawIndirect} 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 {@code countBuffer} located at {@code countBufferOffset} and use this as the draw count.
*
* Valid Usage
*
*
* - {@code offset} must be a multiple of 4
* - {@code countBufferOffset} must be a multiple of 4
* - {@code stride} must be a multiple of 4 and must be greater than or equal to sizeof({@link VkDrawIndirectCommand})
* - If {@code maxDrawCount} is greater than or equal to 1,
(stride × (maxDrawCount - 1) + offset + sizeof({@link VkDrawIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - If the drawIndirectFirstInstance feature is not enabled, all the {@code firstInstance} members of the {@link VkDrawIndirectCommand} structures accessed by this command must be 0
* - The current render pass must be compatible with the {@code renderPass} member of the {@link VkGraphicsPipelineCreateInfo} structure specified when creating the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}.
* - The subpass index of the current render pass must be equal to the {@code subpass} member of the {@link VkGraphicsPipelineCreateInfo} structure specified when creating the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}.
* - For each set n that is statically used by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, a descriptor set must have been bound to n at {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, with a {@code VkPipelineLayout} that is compatible for set n, with the {@code VkPipelineLayout} used to create the current {@code VkPipeline}, as described in the “Pipeline Layout Compatibility” section
* - For each push constant that is statically used by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, a push constant value must have been set for {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, with a {@code VkPipelineLayout} that is compatible for push constants, with the {@code VkPipelineLayout} used to create the current {@code VkPipeline}, as described in the “Pipeline Layout Compatibility” section
* - Descriptors in each bound descriptor set, specified via {@link VK10#vkCmdBindDescriptorSets CmdBindDescriptorSets}, must be valid if they are statically used by the currently bound {@code VkPipeline} object, specified via {@link VK10#vkCmdBindPipeline CmdBindPipeline}
* - All vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must have valid buffers bound
* - A valid graphics pipeline must be bound to the current command buffer with {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}
* - If the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} requires any dynamic state, that state must have been set on the current command buffer
* - If the count stored in {@code countBuffer} is equal to 1,
(offset + sizeof({@link VkDrawIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - If the count stored in {@code countBuffer} is greater than 1,
(stride × (drawCount - 1) + offset + sizeof({@link VkDrawIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - The count stored in {@code countBuffer} must be less than or equal to {@link VkPhysicalDeviceLimits}{@code ::maxDrawIndirectCount}
* - Every input attachment used by the current subpass must be bound to the pipeline via a descriptor set
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used to sample from any {@code VkImage} with a {@code VkImageView} of the type {@link VK10#VK_IMAGE_VIEW_TYPE_3D IMAGE_VIEW_TYPE_3D}, {@link VK10#VK_IMAGE_VIEW_TYPE_CUBE IMAGE_VIEW_TYPE_CUBE}, {@link VK10#VK_IMAGE_VIEW_TYPE_1D_ARRAY IMAGE_VIEW_TYPE_1D_ARRAY}, {@link VK10#VK_IMAGE_VIEW_TYPE_2D_ARRAY IMAGE_VIEW_TYPE_2D_ARRAY} or {@link VK10#VK_IMAGE_VIEW_TYPE_CUBE_ARRAY IMAGE_VIEW_TYPE_CUBE_ARRAY}, in any shader stage
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used with any of the SPIR-V {@code OpImageSample*} or {@code OpImageSparseSample*} instructions with {@code ImplicitLod}, {@code Dref} or {@code Proj} in their name, in any shader stage
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used with any of the SPIR-V {@code OpImageSample*} or {@code OpImageSparseSample*} instructions that includes a LOD bias or any offset values, in any shader stage
* - If the robust buffer access feature is not enabled, and any shader stage in the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} accesses a uniform buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set
* - If the robust buffer access feature is not enabled, and any shader stage in the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} accesses a storage buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set
* - Any {@code VkImageView} being sampled with {@link VK10#VK_FILTER_LINEAR FILTER_LINEAR} as a result of this command must be of a format which supports linear filtering, as specified by the {@link VK10#VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT} flag in {@link VkFormatProperties}{@code ::linearTilingFeatures} (for a linear image) or {@link VkFormatProperties}{@code ::optimalTilingFeatures}(for an optimally tiled image) returned by {@link VK10#vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties}
* - 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 {@link VkPhysicalDeviceMultiviewPropertiesKHX}{@code ::maxMultiviewInstanceIndex}.
* - If the currently bound graphics pipeline was created with {@link VkPipelineSampleLocationsStateCreateInfoEXT}{@code ::sampleLocationsEnable} set to {@link VK10#VK_TRUE TRUE} and the current subpass has a depth/stencil attachment, then that attachment must have been created with the {@link EXTSampleLocations#VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT} bit set
*
*
* Valid Usage (Implicit)
*
*
* - {@code commandBuffer} must be a valid {@code VkCommandBuffer} handle
* - {@code buffer} must be a valid {@code VkBuffer} handle
* - {@code countBuffer} must be a valid {@code VkBuffer} handle
* - {@code commandBuffer} must be in the recording state
* - The {@code VkCommandPool} that {@code commandBuffer} was allocated from must support graphics operations
* - This command must only be called inside of a render pass instance
* - Each of {@code buffer}, {@code commandBuffer}, and {@code countBuffer} must have been created, allocated, or retrieved from the same {@code VkDevice}
*
*
* Host Synchronization
*
*
* - Host access to {@code commandBuffer} must be externally synchronized
* - Host access to the {@code VkCommandPool} that {@code commandBuffer} was allocated from must be externally synchronized
*
*
* Command Properties
*
*
* Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type
* Primary Secondary Inside Graphics Graphics
*
*
* @param commandBuffer the command buffer into which the command is recorded.
* @param buffer the buffer containing draw parameters.
* @param offset the byte offset into {@code buffer} where parameters begin.
* @param countBuffer the buffer containing the draw count.
* @param countBufferOffset the byte offset into {@code countBuffer} where the draw count begins.
* @param 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 {@code countBuffer} and {@code maxDrawCount}.
* @param stride the byte stride between successive sets of draw parameters.
*/
public static void vkCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, @NativeType("VkBuffer") long buffer, @NativeType("VkDeviceSize") long offset, @NativeType("VkBuffer") long countBuffer, @NativeType("VkDeviceSize") long countBufferOffset, @NativeType("uint32_t") int maxDrawCount, @NativeType("uint32_t") int stride) {
long __functionAddress = commandBuffer.getCapabilities().vkCmdDrawIndirectCountAMD;
if (CHECKS) {
check(__functionAddress);
}
callPJJJJV(__functionAddress, commandBuffer.address(), buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);
}
// --- [ vkCmdDrawIndexedIndirectCountAMD ] ---
/**
* 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 vkCmdDrawIndexedIndirectCountAMD(
* VkCommandBuffer commandBuffer,
* VkBuffer buffer,
* VkDeviceSize offset,
* VkBuffer countBuffer,
* VkDeviceSize countBufferOffset,
* uint32_t maxDrawCount,
* uint32_t stride);
*
* Description
*
* {@link #vkCmdDrawIndexedIndirectCountAMD CmdDrawIndexedIndirectCountAMD} behaves similar to {@link #vkCmdDrawIndirectCountAMD CmdDrawIndirectCountAMD} 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 {@code countBuffer} located at {@code countBufferOffset} and use this as the draw count.
*
* Valid Usage
*
*
* - {@code offset} must be a multiple of 4
* - {@code countBufferOffset} must be a multiple of 4
* - {@code stride} must be a multiple of 4 and must be greater than or equal to sizeof({@link VkDrawIndirectCommand})
* - If {@code maxDrawCount} is greater than or equal to 1,
(stride × (maxDrawCount - 1) + offset + sizeof({@link VkDrawIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - If the drawIndirectFirstInstance feature is not enabled, all the {@code firstInstance} members of the {@link VkDrawIndexedIndirectCommand} structures accessed by this command must be 0
* - The current render pass must be compatible with the {@code renderPass} member of the {@link VkGraphicsPipelineCreateInfo} structure specified when creating the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}.
* - The subpass index of the current render pass must be equal to the {@code subpass} member of the {@link VkGraphicsPipelineCreateInfo} structure specified when creating the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}.
* - For each set n that is statically used by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, a descriptor set must have been bound to n at {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, with a {@code VkPipelineLayout} that is compatible for set n, with the {@code VkPipelineLayout} used to create the current {@code VkPipeline}, as described in the “Pipeline Layout Compatibility” section
* - For each push constant that is statically used by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, a push constant value must have been set for {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}, with a {@code VkPipelineLayout} that is compatible for push constants, with the {@code VkPipelineLayout} used to create the current {@code VkPipeline}, as described in the “Pipeline Layout Compatibility” section
* - Descriptors in each bound descriptor set, specified via {@link VK10#vkCmdBindDescriptorSets CmdBindDescriptorSets}, must be valid if they are statically used by the currently bound {@code VkPipeline} object, specified via {@link VK10#vkCmdBindPipeline CmdBindPipeline}
* - All vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must have valid buffers bound
* - A valid graphics pipeline must be bound to the current command buffer with {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS}
* - If the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} requires any dynamic state, that state must have been set on the current command buffer
* - If count stored in {@code countBuffer} is equal to 1,
(offset + sizeof({@link VkDrawIndexedIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - If count stored in {@code countBuffer} is greater than 1,
(stride × (drawCount - 1) + offset + sizeof({@link VkDrawIndexedIndirectCommand}))
must be less than or equal to the size of {@code buffer}
* - {@code drawCount} must be less than or equal to {@link VkPhysicalDeviceLimits}{@code ::maxDrawIndirectCount}
* - Every input attachment used by the current subpass must be bound to the pipeline via a descriptor set
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used to sample from any {@code VkImage} with a {@code VkImageView} of the type {@link VK10#VK_IMAGE_VIEW_TYPE_3D IMAGE_VIEW_TYPE_3D}, {@link VK10#VK_IMAGE_VIEW_TYPE_CUBE IMAGE_VIEW_TYPE_CUBE}, {@link VK10#VK_IMAGE_VIEW_TYPE_1D_ARRAY IMAGE_VIEW_TYPE_1D_ARRAY}, {@link VK10#VK_IMAGE_VIEW_TYPE_2D_ARRAY IMAGE_VIEW_TYPE_2D_ARRAY} or {@link VK10#VK_IMAGE_VIEW_TYPE_CUBE_ARRAY IMAGE_VIEW_TYPE_CUBE_ARRAY}, in any shader stage
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used with any of the SPIR-V {@code OpImageSample*} or {@code OpImageSparseSample*} instructions with {@code ImplicitLod}, {@code Dref} or {@code Proj} in their name, in any shader stage
* - If any {@code VkSampler} object that is accessed from a shader by the {@code VkPipeline} currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} uses unnormalized coordinates, it must not be used with any of the SPIR-V {@code OpImageSample*} or {@code OpImageSparseSample*} instructions that includes a LOD bias or any offset values, in any shader stage
* - If the robust buffer access feature is not enabled, and any shader stage in the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} accesses a uniform buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set
* - If the robust buffer access feature is not enabled, and any shader stage in the {@code VkPipeline} object currently bound to {@link VK10#VK_PIPELINE_BIND_POINT_GRAPHICS PIPELINE_BIND_POINT_GRAPHICS} accesses a storage buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set
* - Any {@code VkImageView} being sampled with {@link VK10#VK_FILTER_LINEAR FILTER_LINEAR} as a result of this command must be of a format which supports linear filtering, as specified by the {@link VK10#VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT} flag in {@link VkFormatProperties}{@code ::linearTilingFeatures} (for a linear image) or {@link VkFormatProperties}{@code ::optimalTilingFeatures}(for an optimally tiled image) returned by {@link VK10#vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties}
* - 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 {@link VkPhysicalDeviceMultiviewPropertiesKHX}{@code ::maxMultiviewInstanceIndex}.
* - If the currently bound graphics pipeline was created with {@link VkPipelineSampleLocationsStateCreateInfoEXT}{@code ::sampleLocationsEnable} set to {@link VK10#VK_TRUE TRUE} and the current subpass has a depth/stencil attachment, then that attachment must have been created with the {@link EXTSampleLocations#VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT} bit set
*
*
* Valid Usage (Implicit)
*
*
* - {@code commandBuffer} must be a valid {@code VkCommandBuffer} handle
* - {@code buffer} must be a valid {@code VkBuffer} handle
* - {@code countBuffer} must be a valid {@code VkBuffer} handle
* - {@code commandBuffer} must be in the recording state
* - The {@code VkCommandPool} that {@code commandBuffer} was allocated from must support graphics operations
* - This command must only be called inside of a render pass instance
* - Each of {@code buffer}, {@code commandBuffer}, and {@code countBuffer} must have been created, allocated, or retrieved from the same {@code VkDevice}
*
*
* Host Synchronization
*
*
* - Host access to {@code commandBuffer} must be externally synchronized
* - Host access to the {@code VkCommandPool} that {@code commandBuffer} was allocated from must be externally synchronized
*
*
* Command Properties
*
*
* Command Buffer Levels Render Pass Scope Supported Queue Types Pipeline Type
* Primary Secondary Inside Graphics Graphics
*
*
* @param commandBuffer the command buffer into which the command is recorded.
* @param buffer the buffer containing draw parameters.
* @param offset the byte offset into {@code buffer} where parameters begin.
* @param countBuffer the buffer containing the draw count.
* @param countBufferOffset the byte offset into {@code countBuffer} where the draw count begins.
* @param 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 {@code countBuffer} and {@code maxDrawCount}.
* @param stride the byte stride between successive sets of draw parameters.
*/
public static void vkCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, @NativeType("VkBuffer") long buffer, @NativeType("VkDeviceSize") long offset, @NativeType("VkBuffer") long countBuffer, @NativeType("VkDeviceSize") long countBufferOffset, @NativeType("uint32_t") int maxDrawCount, @NativeType("uint32_t") int stride) {
long __functionAddress = commandBuffer.getCapabilities().vkCmdDrawIndexedIndirectCountAMD;
if (CHECKS) {
check(__functionAddress);
}
callPJJJJV(__functionAddress, commandBuffer.address(), buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);
}
}