summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-03-17 17:57:04 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-21 17:06:36 +0000
commit2f4b30ee086a8f5c8adff1941d594a4bbba46307 (patch)
tree0cd31b876ff2dffa4490b933070a0325ba01581b
parent5ea126d82b9c3999ac3b5d5050fc6dfa1f40adc9 (diff)
downloadqtbase-2f4b30ee086a8f5c8adff1941d594a4bbba46307.tar.gz
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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/rhi/qrhimetal.mm16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 70e5825a11..2c78517f74 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -1572,15 +1572,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 : std::as_const(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 : std::as_const(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;