Top Description Fields Constructors Methods
org.lwjgl.vulkan

public Class NVDeviceGeneratedCommands

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

This extension allows the device to generate a number of critical graphics commands for command buffers.

When rendering a large number of objects, the device can be leveraged to implement a number of critical functions, like updating matrices, or implementing occlusion culling, frustum culling, front to back sorting, etc. Implementing those on the device does not require any special extension, since an application is free to define its own data structures, and just process them using shaders.

However, if the application desires to quickly kick off the rendering of the final stream of objects, then unextended Vulkan forces the application to read back the processed stream and issue graphics command from the host. For very large scenes, the synchronization overhead and cost to generate the command buffer can become the bottleneck. This extension allows an application to generate a device side stream of state changes and commands, and convert it efficiently into a command buffer without having to read it back to the host.

Furthermore, it allows incremental changes to such command buffers by manipulating only partial sections of a command stream — for example pipeline bindings. Unextended Vulkan requires re-creation of entire command buffers in such a scenario, or updates synchronized on the host.

The intended usage for this extension is for the application to:

For each draw in a sequence, the following can be specified:

While the GPU can be faster than a CPU to generate the commands, it will not happen asynchronously to the device, therefore the primary use case is generating “less” total work (occlusion culling, classification to use specialized shaders, etc.).

Example Code

Open-Source samples illustrating the usage of the extension can be found at the following location (may not yet exist at time of writing):

https://github.com/nvpro-samples/vk_device_generated_cmds

VK_NV_device_generated_commands
Name String
VK_NV_device_generated_commands
Extension Type
Device extension
Registered Extension Number
278
Revision
3
Extension and Version Dependencies
Version 1.1 and VK_KHR_buffer_device_address
Contact
Other Extension Metadata
Last Modified Date
2020-02-20
Interactions and External Dependencies
  • This extension requires Vulkan 1.1
  • This extension requires VK_EXT_buffer_device_address or VK_KHR_buffer_device_address or Vulkan 1.2 for the ability to bind vertex and index buffers on the device.
  • This extension interacts with VK_NV_mesh_shader. If the latter extension is not supported, remove the command token to initiate mesh tasks drawing in this extension.
Contributors
  • Christoph Kubisch, NVIDIA
  • Pierre Boudier, NVIDIA
  • Jeff Bolz, NVIDIA
  • Eric Werness, NVIDIA
  • Yuriy O’Donnell, Epic Games
  • Baldur Karlsson, Valve
  • Mathias Schott, NVIDIA
  • Tyson Smith, NVIDIA
  • Ingo Esser, NVIDIA

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV

VkIndirectCommandsLayoutUsageFlagBitsNV - Bitmask specifying allowed usage of an indirect commands layout Description

public static final int
VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV

VkIndirectCommandsLayoutUsageFlagBitsNV - Bitmask specifying allowed usage of an indirect commands layout Description

public static final int
VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV

VkIndirectCommandsLayoutUsageFlagBitsNV - Bitmask specifying allowed usage of an indirect commands layout Description

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV

VkIndirectStateFlagBitsNV - Bitmask specifying state that can be altered on the device Description

public static final String
public static final int
VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION

The extension specification version.

public static final int
public static final int
VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV

Extends VkPipelineCreateFlagBits.

public static final int
VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV

Extends VkPipelineStageFlagBits.

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static void
nvkCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, int isPreprocessed, long pGeneratedCommandsInfo)

Unsafe version of: CmdExecuteGeneratedCommandsNV

public static void
nvkCmdPreprocessGeneratedCommandsNV(VkCommandBuffer commandBuffer, long pGeneratedCommandsInfo)

Unsafe version of: CmdPreprocessGeneratedCommandsNV

public static int
nvkCreateIndirectCommandsLayoutNV(VkDevice device, long pCreateInfo, long pAllocator, long pIndirectCommandsLayout)

Unsafe version of: CreateIndirectCommandsLayoutNV

public static void
nvkDestroyIndirectCommandsLayoutNV(VkDevice device, long indirectCommandsLayout, long pAllocator)

Unsafe version of: DestroyIndirectCommandsLayoutNV

public static void
nvkGetGeneratedCommandsMemoryRequirementsNV(VkDevice device, long pInfo, long pMemoryRequirements)

Unsafe version of: GetGeneratedCommandsMemoryRequirementsNV

public static void
vkCmdBindPipelineShaderGroupNV(VkCommandBuffer
the command buffer that the pipeline will be bound to.
commandBuffer
,
int
a VkPipelineBindPoint value specifying the bind point to which the pipeline will be bound.
pipelineBindPoint
,
long
the pipeline to be bound.
pipeline
,
int
the shader group to be bound.
groupIndex
)

Bind a pipeline object.

public static void
vkCmdExecuteGeneratedCommandsNV(VkCommandBuffer
the command buffer into which the command is recorded.
commandBuffer
,
boolean
represents whether the input data has already been preprocessed on the device. If it is FALSE this command will implicitly trigger the preprocessing step, otherwise not.
isPreprocessed
,
VkGeneratedCommandsInfoNV
a pointer to a VkGeneratedCommandsInfoNV structure containing parameters affecting the generation of commands.
pGeneratedCommandsInfo
)

Generate and execute commands on the device.

public static void
vkCmdPreprocessGeneratedCommandsNV(VkCommandBuffer
the command buffer which does the preprocessing.
commandBuffer
,
VkGeneratedCommandsInfoNV
a pointer to a VkGeneratedCommandsInfoNV structure containing parameters affecting the preprocessing step.
pGeneratedCommandsInfo
)

Performs preprocessing for generated commands.

public static int
vkCreateIndirectCommandsLayoutNV(VkDevice
the logical device that creates the indirect command layout.
device
,
VkIndirectCommandsLayoutCreateInfoNV
a pointer to a VkIndirectCommandsLayoutCreateInfoNV structure containing parameters affecting creation of the indirect command layout.
pCreateInfo
,
VkAllocationCallbacks
controls host memory allocation as described in the Memory Allocation chapter.
pAllocator
,
LongBuffer
a pointer to a VkIndirectCommandsLayoutNV handle in which the resulting indirect command layout is returned.
pIndirectCommandsLayout
)

Create an indirect command layout object.

public static int
vkCreateIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommandsLayoutCreateInfoNV pCreateInfo, VkAllocationCallbacks pAllocator, long[] pIndirectCommandsLayout)

Array version of: CreateIndirectCommandsLayoutNV

public static void
vkDestroyIndirectCommandsLayoutNV(VkDevice
the logical device that destroys the layout.
device
,
long
the layout to destroy.
indirectCommandsLayout
,
VkAllocationCallbacks
controls host memory allocation as described in the Memory Allocation chapter.
pAllocator
)

Destroy an indirect commands layout.

public static void
vkGetGeneratedCommandsMemoryRequirementsNV(VkDevice
the logical device that owns the buffer.
device
,
VkGeneratedCommandsMemoryRequirementsInfoNV
a pointer to a VkGeneratedCommandsMemoryRequirementsInfoNV structure containing parameters required for the memory requirements query.
pInfo
,
VkMemoryRequirements2
a pointer to a VkMemoryRequirements2 structure in which the memory requirements of the buffer object are returned.
pMemoryRequirements
)

Retrieve the buffer allocation requirements for generated commands.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait