Skip to content

Document how to do D3D12-style command buffer management in Vulkan #15

@Tobski

Description

@Tobski

There's a particular usage pattern for dynamically recorded command buffers which DX12 applications make use of DX12's ability to free-associate command buffers with command allocators, which is not how things naturally work in Vulkan.

Whilst this might not be the ideal method for managing command buffers in all cases, it works, and is natural for anyone porting D3D12 content.

After discussion in the Vulkan WG, we agreed that the following advice is the right way to achieve the same in Vulkan, with no expected perf implications vs DX12:

  • Allocate command pools with VK_COMMAND_POOL_CREATE_TRANSIENT_BIT
  • Treat VkCommandPool objects the same as ID3D12CommandAllocator objects
    • I.e. they are externally synchronized command allocators
  • Don't pre-allocate command buffers
  • Allocate command buffers when you want to begin recording, then begin them
  • When the command buffer is no longer in use, free the command buffer
    • Ideally along with all others associated with the same pool

It would be useful to turn this porting advice into a section of the Vulkan-Guide, possibly alongside other porting advice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions