diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-03-31 10:20:07 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2023-04-28 08:37:10 +0100 |
commit | 486381006558b22175176473dd53cc4d75a45bcf (patch) | |
tree | f5eca26e805f8a520628e7d233d4770b8b335ac2 /src/gui/rhi/qrhivulkan.cpp | |
parent | 1c5c1df43e2be10c46c13461888b012c89938150 (diff) |
Call into platform hooks for start and end frames
This closely matches QPlatformOpenGLContext which in turn, where it can
be used by backends to guard low level resources.
Change-Id: Ia44cebced6cdf94497279c47d3c35c0e02e4cb0e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 17e291eee1..2f8afb389a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -3,6 +3,7 @@ #include "qrhivulkan_p_p.h" #include "qrhivulkanext_p.h" +#include <qpa/qplatformvulkaninstance.h> #define VMA_IMPLEMENTATION #define VMA_DYNAMIC_VULKAN_FUNCTIONS 1 @@ -1695,6 +1696,8 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin const int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0; QVkSwapChain::FrameResources &frame(swapChainD->frameRes[frameResIndex]); + inst->handle()->beginFrame(swapChainD->window); + if (!frame.imageAcquired) { // Wait if we are too far ahead, i.e. the thread gets throttled based on the presentation rate // (note that we are using FIFO mode -> vsync) @@ -1803,6 +1806,10 @@ QRhi::FrameOpResult QRhiVulkan::endFrame(QRhiSwapChain *swapChain, QRhi::EndFram QVkSwapChain *swapChainD = QRHI_RES(QVkSwapChain, swapChain); Q_ASSERT(currentSwapChain == swapChainD); + auto cleanup = qScopeGuard([this, swapChainD] { + inst->handle()->endFrame(swapChainD->window); + }); + recordPrimaryCommandBuffer(&swapChainD->cbWrapper); int frameResIndex = swapChainD->bufferCount > 1 ? swapChainD->currentFrameSlot : 0; |