Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created November 2, 2023 12:19
Show Gist options
  • Save torarnv/9e27eebdb1d5027c3850efbe8e7392b7 to your computer and use it in GitHub Desktop.
Save torarnv/9e27eebdb1d5027c3850efbe8e7392b7 to your computer and use it in GitHub Desktop.
diff --git i/src/gui/CMakeLists.txt w/src/gui/CMakeLists.txt
index e848ac23c32..989e94c2263 100644
--- i/src/gui/CMakeLists.txt
+++ w/src/gui/CMakeLists.txt
@@ -1000,6 +1000,7 @@ qt_internal_extend_target(Gui CONDITION IOS OR MACOS
rhi/qrhimetal.mm rhi/qrhimetal_p.h
PUBLIC_LIBRARIES
${FWMetal}
+ ${FWQuartzCore}
)
qt_internal_extend_target(Gui
diff --git i/src/gui/rhi/qrhimetal.mm w/src/gui/rhi/qrhimetal.mm
index 48690df5d9d..e9380f8dc47 100644
--- i/src/gui/rhi/qrhimetal.mm
+++ w/src/gui/rhi/qrhimetal.mm
@@ -22,6 +22,7 @@
#include <Metal/Metal.h>
#include <QuartzCore/CAMetalLayer.h>
+#include <QuartzCore/CATransaction.h>
QT_BEGIN_NAMESPACE
@@ -2408,6 +2409,9 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
[swapChainD->cbWrapper.d->cb presentDrawable: drawable];
}
+ if (presentsWithTransaction && needsPresent)
+ [CATransaction begin];
+
[swapChainD->cbWrapper.d->cb commit];
if (presentsWithTransaction && needsPresent) {
@@ -2418,6 +2422,7 @@ QRhi::FrameOpResult QRhiMetal::endFrame(QRhiSwapChain *swapChain, QRhi::EndFrame
// issuing the present.
[swapChainD->cbWrapper.d->cb waitUntilScheduled];
[drawable present];
+ [CATransaction commit];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment