Skip to content

Tut08 - calling vkBeginCommandBuffer on an active command buffer #36

@junglie85

Description

@junglie85

When I run the tutorial 08 code, I get the following validation layer error that vkBeginCommandBuffer is being called on an active command buffer. I get the same error when running my own version of the code, but instead of getting it for a single command buffer it occurs for all 3 command buffers.

validation layer: Validation Error: [ VUID-vkBeginCommandBuffer-commandBuffer-00049 ] Object 0: handle = 0x6000029add58, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x84029a9f | Calling vkBeginCommandBuffer() on active VkCommandBuffer 0x6000029add58[] before it has completed. You must check command buffer fence before this call. The Vulkan spec states: commandBuffer must not be in the recording or pending state (https://vulkan.lunarg.com/doc/view/1.2.182.0/mac/1.2-extensions/vkspec.html#VUID-vkBeginCommandBuffer-commandBuffer-00049)
validation layer: Validation Error: [ VUID-vkBeginCommandBuffer-commandBuffer-00049 ] Object 0: handle = 0x6000029ade28, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x84029a9f | Calling vkBeginCommandBuffer() on active VkCommandBuffer 0x6000029ade28[] before it has completed. You must check command buffer fence before this call. The Vulkan spec states: commandBuffer must not be in the recording or pending state (https://vulkan.lunarg.com/doc/view/1.2.182.0/mac/1.2-extensions/vkspec.html#VUID-vkBeginCommandBuffer-commandBuffer-00049)
validation layer: Validation Error: [ VUID-vkBeginCommandBuffer-commandBuffer-00049 ] Object 0: handle = 0x6000029adef8, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x84029a9f | Calling vkBeginCommandBuffer() on active VkCommandBuffer 0x6000029adef8[] before it has completed. You must check command buffer fence before this call. The Vulkan spec states: commandBuffer must not be in the recording or pending state (https://vulkan.lunarg.com/doc/view/1.2.182.0/mac/1.2-extensions/vkspec.html#VUID-vkBeginCommandBuffer-commandBuffer-00049)

I can make the error go away by adding vkWaitDeviceIdle() in the main loop after draw_frame(). Both LveSwapChain::acquireNextImage() and LveSwapChain::submitCommandBuffers() wait for the fences but this doesn't seem to have the correct effect now that buffers are being recorded each frame rather than once at command buffer creation.

I note that in the relevant tutorial video, these validation errors do not show.

Relevant specs:

==========
VULKANINFO
==========

Vulkan Instance Version: 1.2.182

Presentable Surfaces:
=====================
GPU id : 0 (Apple M1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions