Class VulkanModuleCommandBuffer

java.lang.Object
io.codetoil.curved_spacetime.vulkan.VulkanModuleCommandBuffer

public class VulkanModuleCommandBuffer extends Object
A Vulkan command buffer allocated from a VulkanModuleCommandPool.

Commands are recorded between beginRecording() and endRecording(), then submitted through a VulkanModuleQueue. A primary buffer can be submitted directly; a secondary one can only be executed from within a primary buffer, and must declare what it inherits when recording begins.

  • Constructor Details

    • VulkanModuleCommandBuffer

      public VulkanModuleCommandBuffer(VulkanModuleCommandPool commandPool, boolean primary, boolean oneTimeSubmit, Logger logger)
      Allocates a command buffer from the given pool.
      Parameters:
      commandPool - the pool to allocate from, which fixes the queue family
      primary - true for a primary buffer, false for a secondary one
      oneTimeSubmit - whether the buffer is recorded fresh before each submission
      logger - the logger to write buffer diagnostics to
      Throws:
      AssertionError - if the buffer cannot be allocated
  • Method Details

    • beginRecording

      public void beginRecording()
      Begins recording into a primary buffer.
      Throws:
      RuntimeException - if this is a secondary buffer, which needs inheritance information
    • beginRecording

      public void beginRecording(org.lwjgl.vulkan.VkCommandBufferInheritanceInfo inheritanceInfo)
      Begins recording, supplying what a secondary buffer inherits from its caller.
      Parameters:
      inheritanceInfo - the render pass, subpass, and framebuffer a secondary buffer inherits, or null for a primary buffer
      Throws:
      RuntimeException - if this is a secondary buffer and inheritanceInfo is null
    • cleanup

      public void cleanup()
      Returns this buffer to its pool.
    • endRecording

      public void endRecording()
      Finishes recording, leaving the buffer ready to submit.
      Throws:
      AssertionError - if the recorded commands are invalid
    • getVkCommandBuffer

      public org.lwjgl.vulkan.VkCommandBuffer getVkCommandBuffer()
      Returns the underlying Vulkan command buffer.
      Returns:
      the VkCommandBuffer
    • reset

      public void reset()
      Discards anything recorded, releasing the buffer's resources back to the pool.