diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-07 16:23:48 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-07 21:15:52 +0200 |
commit | 8cdc9ac5b2310e42c4fecdb001e1f8ddeecc4aa1 (patch) | |
tree | a6e2d064bd28247d875fdd83996eb5ff3466bacf /src/gui/rhi/qrhivulkan.cpp | |
parent | 2f8cfc2c608159bfbe6e085c37bd76bbaa5bd607 (diff) |
rhi: vulkan: Fix calling finish() twice with some copy commands in-between
The native command buffer handle was not updated, so the subsequent
finish() call attempted to record an invalid VkCommandBuffer. The
problem was not present with offscreen frames, only when finish() is
called with a swapchain-based frame active.
Task-number: QTBUG-84066
Change-Id: I9c4cb701c3dbbc28f237d6ae1cbf65aafd1fa95f
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index b46b0b819c..e67b249f9c 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -2001,10 +2001,13 @@ QRhi::FrameOpResult QRhiVulkan::finish() if (inFrame) { // Allocate and begin recording on a new command buffer. - if (ofr.active) + if (ofr.active) { startPrimaryCommandBuffer(&ofr.cbWrapper.cb); - else - startPrimaryCommandBuffer(&swapChainD->frameRes[swapChainD->currentFrameSlot].cmdBuf); + } else { + QVkSwapChain::FrameResources &frame(swapChainD->frameRes[swapChainD->currentFrameSlot]); + startPrimaryCommandBuffer(&frame.cmdBuf); + swapChainD->cbWrapper.cb = frame.cmdBuf; + } } executeDeferredReleases(true); |