aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhisupport.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-31 16:39:34 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-03 10:51:25 +0200
commitff6369767321afc49b37645bb6b85d3556921645 (patch)
treea6a45cd6c6450d5bee220f44412118c5646e229e /src/quick/scenegraph/qsgrhisupport.cpp
parente2c5ee11bcdc2f093004716f5e65e81cdce9ff85 (diff)
Expose the QRhiSwapchain via QSGRendererInterface
...similarly to how we already do it for the QRhi itself. Just follow the same pattern. This allows Qt Quick 3D to stop peeking directly into QQuickWindowPrivate and accessing member variables in there. Code like the following QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window); QRhiCommandBuffer *cb = wd->swapchain->currentFrameCommandBuffer(); QRhiRenderPassDescriptor *rp = wd->rpDescForSwapchain; can now be written ca. like this, without pulling in quick-private: QRhiSwapChain *swapchain = window->rendererInterface->getResource(window, RhiSwapchain) QRhiCommandBuffer *cb = swapchain->currentFrameCommandBuffer(); QRhiRenderPassDescriptor *rp = swapchain->renderPassDescriptor(); This provides a more stable interface between the scenegraph and Quick 3D. In addition, this is also handy for manual tests, external test applications, etc. in case they do QRhi-based rendering in a QQuickWindow. Now these are also fine with just gui-private, no need to access QQuickWindowPrivate anymore. Change-Id: I921fb1c33c2fc77081272b1f180fdc2c87ed3ab5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 510f98ed6b..07730a5d2b 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -436,7 +436,8 @@ static const void *qsgrhi_mtl_rifResource(QSGRendererInterface::Resource res, co
#endif
const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
- const QSGDefaultRenderContext *rc)
+ const QSGDefaultRenderContext *rc,
+ const QQuickWindow *w)
{
// ### This condition is a temporary workaround to allow compilation
// with -no-opengl, but Vulkan or Metal enabled, to succeed. Full
@@ -447,6 +448,8 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
QRhi *rhi = rc->rhi();
if (res == QSGRendererInterface::RhiResource || !rhi)
return rhi;
+ if (res == QSGRendererInterface::RhiSwapchainResource)
+ return QQuickWindowPrivate::get(w)->swapchain;
const QRhiNativeHandles *nat = rhi->nativeHandles();
if (!nat)