Skip to content

Queue::submit with blocking-flag set does not guarantee command buffer completion? #133

@Silverlan

Description

@Silverlan

So, this is a bit of an odd one and I'm not at all sure if this has even anything to do with Anvil.
Occasionally I get an error from the validation layers when I try to destroy a command buffer I've submitted, even though I've set the in_should_block-parameter to true:

[VK] Attempt to free command buffer (0x2101289c100) which is in use. The Vulkan spec states: All elements of pCommandBuffers must not be in the pending state (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkFreeCommandBuffers-pCommandBuffers-00047)

I've had this happen, for example, in the last else-branch of Image::change_image_layout:

[...]
else
{
    Anvil::CommandBufferMGPUSubmission cmd_buffer_submission;
    const Anvil::MGPUDevice*           mgpu_device_ptr(dynamic_cast<const Anvil::MGPUDevice*>(m_device_ptr) );

    cmd_buffer_submission.cmd_buffer_ptr = transition_command_buffer_ptr.get      ();
    cmd_buffer_submission.device_mask    = (1 << mgpu_device_ptr->get_n_physical_devices()) - 1;

    /* TODO */
    anvil_assert(in_opt_n_set_semaphores  == 0);
    anvil_assert(in_opt_n_wait_semaphores == 0);

    in_queue_ptr->submit(
        Anvil::SubmitInfo::create_execute(&cmd_buffer_submission,
                                            1, /* in_n_command_buffer_submissions */
                                            true /* should_block */)
    );
}

(The error triggers when transition_command_buffer_ptr goes out of scope and is destroyed.)
As far as I can tell the error is nonsense, the command buffer is allocated in the same function and only used for that one purpose, so there's no way it could be in use anywhere else.
I've only had this happen with my Nvidia GTX 650Ti BOOST, so this might just be a driver bug (or a false positive by the validation layer?).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions