diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-19 14:45:41 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-19 18:30:03 +0200 |
commit | b4447c39a95bc03d7874a323e179d0f8cda83255 (patch) | |
tree | ac47563b96d35a06561762531b1bbd52e760aab6 /src/quick/scenegraph/qsgrhisupport.cpp | |
parent | aef24b3a945fe15828e3bc304c5b0333125f05fb (diff) |
Fix up exposing the swapchain to Quick3D
Quick3D is broken in combination with QQuickRenderControl. This is
because just exposing the swapchain is not enough - there is no
swapchain with QQuickRenderControl. Rather, one needs access to the
command buffer and render target then.
Change-Id: I6c06ad3d83ab0018b9f985073757a3378dbce24b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhisupport.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 007739d2d7..618e1f1411 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -441,10 +441,23 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res, const QQuickWindow *w) { QRhi *rhi = rc->rhi(); - if (res == QSGRendererInterface::RhiResource || !rhi) + if (!rhi) + return nullptr; + + // Accessing the underlying QRhi* objects are essential both for Qt Quick + // 3D and advanced solutions, such as VR engine integrations. + switch (res) { + case QSGRendererInterface::RhiResource: return rhi; - if (res == QSGRendererInterface::RhiSwapchainResource) + case QSGRendererInterface::RhiSwapchainResource: return QQuickWindowPrivate::get(w)->swapchain; + case QSGRendererInterface::RhiRedirectCommandBuffer: + return QQuickWindowPrivate::get(w)->redirect.commandBuffer; + case QSGRendererInterface::RhiRedirectRenderTarget: + return QQuickWindowPrivate::get(w)->redirect.rt.renderTarget; + default: + break; + } const QRhiNativeHandles *nat = rhi->nativeHandles(); if (!nat) |