Advertisement

Running GPU, CPU in parallel in Vulkan, DX12

Started by August 09, 2017 06:30 PM
1 comment, last by mark_braga 7 years, 6 months ago

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); // resets command buffer
  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?

I figured it out. Just need to call vkGetFenceStatus to see if the fence is signalled or not

This topic is closed to new replies.

Advertisement