Class VulkanModuleCommandBuffer
java.lang.Object
io.codetoil.curved_spacetime.vulkan.VulkanModuleCommandBuffer
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 Summary
ConstructorsConstructorDescriptionVulkanModuleCommandBuffer(VulkanModuleCommandPool commandPool, boolean primary, boolean oneTimeSubmit, Logger logger) Allocates a command buffer from the given pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidBegins recording into a primary buffer.voidbeginRecording(org.lwjgl.vulkan.VkCommandBufferInheritanceInfo inheritanceInfo) Begins recording, supplying what a secondary buffer inherits from its caller.voidcleanup()Returns this buffer to its pool.voidFinishes recording, leaving the buffer ready to submit.org.lwjgl.vulkan.VkCommandBufferReturns the underlying Vulkan command buffer.voidreset()Discards anything recorded, releasing the buffer's resources back to the pool.
-
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 familyprimary-truefor a primary buffer,falsefor a secondary oneoneTimeSubmit- whether the buffer is recorded fresh before each submissionlogger- 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, ornullfor a primary buffer- Throws:
RuntimeException- if this is a secondary buffer andinheritanceInfoisnull
-
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.
-