I am not quite sure if it is actually correct what I'm trying to do but there is not so much documentation about Vulkan so this is what I came up with. If I'm totally wrong in the way how I designed it, please correct me as well!
In my Vulkan application I have three different Queues
- graphicsQueue: Used to submit graphics command buffers
- presentQueue: Used to present finished images
- transferQueue: Used to copy buffers, textures etc.
I am trying to implement async model loading, which means all vertices, textures etc are loaded in a separate thread. When the model is finished loading, the draw command buffers are updated by the main thread so the newly loaded object is rendered.
Everything is working as it should expect that I get a warning from the Vulkan Validation layers:
THREADING ERROR : object of type VkQueue is simultaneously used in thread ...
If I step through the the Debugger, I can see that the following lines are affected:
//main Loop
vkQueueSubmit(graphicsQueue, ...) //draw command buffer
and
//Background loading thread
vkQueueSubmit(transferQueue, ...)//copy vertex command buffer
I printed the address of graphicsQueue and transferQueue and found out that they are the same (same address), so it seems like my graphics Card only Supports a single Queue. So now I'm trying to synchronize the calls to vkQueueSubmit using a Semaphore:
submitInfo.signalSemaphoreCount = 1;
submitInfo.pSignalSemaphores = &queueSemaphore;
Unformtunately the error is still the same.
So my question: How do I properly synchronize calls to vkQueueSubmit?
vkQueueSubmit()functions are not called from multiple threads at the same time. - Ekzuzy