I'm developing a game with two command queue. One for compute shader to compute heavy work, it takes about 40ms, one for rendering, it takes less than 16ms.
I need use compute result to modify rendering content, but compute is much slower than rendering, I use conditional rendering to skip the modification if compute result is not ready.
typedef struct VkConditionalRenderingBeginInfoEXT {
VkStructureType sType;
const void* pNext;
VkBuffer buffer;
VkDeviceSize offset;
VkConditionalRenderingFlagsEXT flags;
} VkConditionalRenderingBeginInfoEXT;
I write the buffer on compute queue after the compute is finished, then call vkCmdBeginConditionalRenderingEXT on rendering queue.
Now the problem is, I can't set proper memory barrier for thie buffer because it is accessed across queues, so my question is how to set memory barrier to make sure the buffer writing on compute queue is finished before rendering queue to read it.