diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-03-17 17:57:04 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-03-22 11:58:02 +0000 |
commit | 6451fdffcfc6f12319e276950368ebb7fe04c50c (patch) | |
tree | bbec629354303b6e28fabc21040c1651b6b29327 /src | |
parent | caf0a9c0bd3620979a34b454a4ccffa9d60db886 (diff) |
rhi: metal: Fix offscreen frame command completion wait
Does what 711c55b63226c30532b39ec8d5191330512eb2e0 did for
Vulkan, i.e. removes the there-is-more-than-one-swapchain
condition.
Fixes: QTBUG-109971
Change-Id: If631748c50482389a3ef894823a1aaf1ebb38bee
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 2305f8af9f24cd5a71e1eb7129b518ad621a1770)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 17f73361b8..2a2cad1670 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -1531,15 +1531,13 @@ QRhi::FrameOpResult QRhiMetal::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi: Q_UNUSED(flags); currentFrameSlot = (currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT; - if (swapchains.count() > 1) { - for (QMetalSwapChain *sc : qAsConst(swapchains)) { - // wait+signal is the general pattern to ensure the commands for a - // given frame slot have completed (if sem is 1, we go 0 then 1; if - // sem is 0 we go -1, block, completion increments to 0, then us to 1) - dispatch_semaphore_t sem = sc->d->sem[currentFrameSlot]; - dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); - dispatch_semaphore_signal(sem); - } + for (QMetalSwapChain *sc : qAsConst(swapchains)) { + // wait+signal is the general pattern to ensure the commands for a + // given frame slot have completed (if sem is 1, we go 0 then 1; if + // sem is 0 we go -1, block, completion increments to 0, then us to 1) + dispatch_semaphore_t sem = sc->d->sem[currentFrameSlot]; + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + dispatch_semaphore_signal(sem); } d->ofr.active = true; |