我提交队列并指定围栏。在提交之前,我会打印栅栏:
qDebug() << "submitting fence: " << cmdFence;
vkQueueSubmit(gfxQueue, 1, &submitInfo, cmdFence);
这是最近3次提交的结果:
submitting fence: 0x145
submitting fence: 0x142
submitting fence: 0x145
在其他地方,我有一个代码应该等待栅栏:
qDebug() << "waiting for fences";
for(auto f : activeFences)
qDebug() << "fence " << f;
if(vkWaitForFences(m_moduleData.deviceData.device,
static_cast<uint32_t>(activeFences.size()),
activeFences.data(),
VK_TRUE,
UINT64_MAX) != VK_SUCCESS)
{
throw std::runtime_error{"failed to wait for fences"};
}
可以看出,在等待之前,我也在打印栅栏,这就是在vkWaitForFences
致电之前得到的:
waiting for fences
fence 0x142
先前提交的同一栅栏0x142
!但是验证层会产生警告:
vkWaitForFences called for fence 0x142 which has not been submitted on a Queue or during acquire next image.
应用程序可能在无限等待中冻结。但是为什么呢?