Hello, I am currently working on synchronization for frame submission in Vulkan.
This is currently the logic of the draw function.
void draw()
{
uint32_t listIndex = gFrameCount++ % gSwapChainImageCount;
Cmd* pCmd = ppCmds[listIndex];
beginCmd(pCmd);
fillCommandList(pCmd);
endCmd(pCmd);
queueSubmit(pGraphicsQueue, pCmd);
}
gSwapChainImageCount is currently 3.
So there are no validation errors for first three frames but after I try to reset the command list in the fourth frame (listIndex is back to 0), I get a validation error
ERROR: [DS] : Attempt to reset command buffer (0x0000025AC56701B0) which is in use. The spec valid usage text states 'commandBuffer must not be in the pending state'
Now from what I read, submit will automatically stall after the third frame if swapChain[0] is still used. I have tried using all the present modes (Immediate, Fifo, Mailbox,...) but it gives the same error.
This leads me to believe that what I read was not correct. In that case, I would need to stall until that frame has been processed. So what would be the best way to determine if a commandBuffer is still in use in Vulkan?
↧