diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:16:29 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:23:19 +0200 |
commit | f4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (patch) | |
tree | 4119707660438ff58bd51f9cbe0f9e2a33f4b806 /src/gui/rhi/qrhimetal.mm | |
parent | 9bd6cec74dbbc5aece55dc0c8808494db29b9963 (diff) | |
parent | 93f2f33a49f6c96a4f94f344edf03164ed944d02 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
Diffstat (limited to 'src/gui/rhi/qrhimetal.mm')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index ffb2283ae7..07753c985c 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -1243,8 +1243,10 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame return QRhi::FrameOpSuccess; } -QRhi::FrameOpResult QRhiMetal::beginOffscreenFrame(QRhiCommandBuffer **cb) +QRhi::FrameOpResult QRhiMetal::beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) { + Q_UNUSED(flags); + currentFrameSlot = (currentFrameSlot + 1) % QMTL_FRAMES_IN_FLIGHT; if (swapchains.count() > 1) { for (QMetalSwapChain *sc : qAsConst(swapchains)) { @@ -1268,8 +1270,9 @@ QRhi::FrameOpResult QRhiMetal::beginOffscreenFrame(QRhiCommandBuffer **cb) return QRhi::FrameOpSuccess; } -QRhi::FrameOpResult QRhiMetal::endOffscreenFrame() +QRhi::FrameOpResult QRhiMetal::endOffscreenFrame(QRhi::EndFrameFlags flags) { + Q_UNUSED(flags); Q_ASSERT(d->ofr.active); d->ofr.active = false; @@ -1986,9 +1989,11 @@ bool QMetalBuffer::build() } #endif - // Immutable and Static only has buf[0] and pendingUpdates[0] in use. - // Dynamic uses all. - d->slotted = m_type == Dynamic; + // Have QMTL_FRAMES_IN_FLIGHT versions regardless of the type, for now. + // This is because writing to a Managed buffer (which is what Immutable and + // Static maps to on macOS) is not safe when another frame reading from the + // same buffer is still in flight. + d->slotted = !m_usage.testFlag(QRhiBuffer::StorageBuffer); // except for SSBOs written in the shader QRHI_RES_RHI(QRhiMetal); for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) { |