summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhimetal.mm
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-11 16:16:29 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-11 16:23:19 +0200
commitf4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (patch)
tree4119707660438ff58bd51f9cbe0f9e2a33f4b806 /src/gui/rhi/qrhimetal.mm
parent9bd6cec74dbbc5aece55dc0c8808494db29b9963 (diff)
parent93f2f33a49f6c96a4f94f344edf03164ed944d02 (diff)
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Diffstat (limited to 'src/gui/rhi/qrhimetal.mm')
-rw-r--r--src/gui/rhi/qrhimetal.mm15
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) {