Validation layer error when using timeline semaphore to help perform queue family ownership transfer

Hi, I use timeline semaphore to help perform queue family ownership transfer for an image and get confused about the produced validation layer errors.

I have two queues graphic_queue, compute_queue from different queue families and corresponding command pools graphic_pool, compute_pool. I record three command buffers.

The first command buffer belongs to the graphic_pool and includes an image memory barrier to release the ownership of the image.

The second one belongs to the compute_pool. It includes an image memory barrier to acquire the ownership of the image and to perform layout transition from VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL to VK_IMAGE_LAYOUT_GENERAL. Then it uses vkCmdDispatch to invoke some computation, followed by another image memory barrier to release the ownership of the image again and change the image layout back to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.

The third command buffer belongs to the graphic_pool and includes an image memory barrier to acquire the ownership of the image.

Then I submit these command buffers with

vkQueueSubmit2(graphics_queue, 2, graphic_submits.data(), graphic_fence);
vkQueueSubmit2(compute_queue, 1, compute_submits.data(), compute_fence);

where graphic_submits and compute_submits are two arrays of VkSubmitInfo. graphic_submits is for the first and the third command buffers, while compute_submits is for the second command buffer. I use timeline semaphore to ensure the execution order of these 3 command buffers is exactly 1st → 2nd → 3rd. (The submission order is 1st → 3rd → 2nd)

The validation layer errors when I run

vkQueueSubmit2(graphics_queue, 2, graphic_submits.data(), graphic_fence);

is as following:

validation layer: Validation Error: [ UNASSIGNED-VkImageMemoryBarrier-image-00004 ] Object 0: handle = 0x21d946cdb80, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4acfa767 | vkQueueSubmit(): in submitted command buffer VkImageMemoryBarrier acquiring ownership of VkImage (VkImage 0x67ff8300000000f4[]), from srcQueueFamilyIndex 2 to dstQueueFamilyIndex 0 has no matching release barrier queued for execution.

It says that the 3rd command buffer (handle = 0x21d946cdb80) has no matching release barrier queued for execution, given the VkImageMemoryBarrier acquiring ownership of VkImage from compute_queue (srcQueueFamilyIndex 2) to graphic_queue (dstQueueFamilyIndex 0).

According to my understanding of timeline semaphore, it supports wait-before-signal submission order between different queues. However, this validation error makes me doubt whether my usage of timeline semaphore is correct. My settings of semaphore are like

cmd_buffer_1: signal 1
cmd_buffer_2: wait 1, signal 2
cmd_buffer_3: wait 2, signal 3

Please correct me if I am wrong.

I also have a small question about the vkQueueSubmit() in the validation error information because I used vkQueueSubmit2() to submit the command buffers.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.