diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-31 16:39:34 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-03 10:51:25 +0200 |
commit | ff6369767321afc49b37645bb6b85d3556921645 (patch) | |
tree | a6a45cd6c6450d5bee220f44412118c5646e229e /src/quick/scenegraph/qsgdefaultcontext.cpp | |
parent | e2c5ee11bcdc2f093004716f5e65e81cdce9ff85 (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/qsgdefaultcontext.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultcontext.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index fee1a8449e..8318d96eac 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -324,13 +324,13 @@ void *QSGDefaultContext::getResource(QQuickWindow *window, Resource resource) co if (rhiSupport->graphicsApi() == OpenGL) return rc->openglContext(); else - return const_cast<void *>(rhiSupport->rifResource(resource, rc)); + return const_cast<void *>(rhiSupport->rifResource(resource, rc, window)); #if QT_CONFIG(vulkan) case VulkanInstanceResource: return window->vulkanInstance(); #endif default: - return const_cast<void *>(rhiSupport->rifResource(resource, rc)); + return const_cast<void *>(rhiSupport->rifResource(resource, rc, window)); } } |