aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.cpp15
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendererinterface.h2
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp17
3 files changed, 30 insertions, 4 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
index 6970aa0afb..efbab4086c 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.cpp
@@ -113,8 +113,19 @@ QT_BEGIN_NAMESPACE
the scenegraph, when applicable. This value was introduced in Qt 5.14.
\value RhiSwapchainResource The resource is a pointer to a QRhiSwapchain
- instance that is associated with the window. This value was introduced in
- Qt 6.0.
+ instance that is associated with the window. The value is null when the
+ window is used in combination with QQuickRenderControl. This value was
+ introduced in Qt 6.0.
+
+ \value RhiRedirectCommandBuffer The resource is a pointer to a
+ QRhiCommandBuffer instance that is associated with the window and its
+ QQuickRenderControl. The value is null when the window is not associated
+ with a QQuickRenderControl. This value was introduced in Qt 6.0.
+
+ \value RhiRedirectRenderTarget The resource is a pointer to a
+ QRhiTextureRenderTarget instance that is associated with the window and its
+ QQuickRenderControl. The value is null when the window is not associated
+ with a QQuickRenderControl. This value was introduced in Qt 6.0.
\value PhysicalDeviceResource The resource is a pointer to the pysical
device object used by the scenegraph, when applicable. For example, a
diff --git a/src/quick/scenegraph/coreapi/qsgrendererinterface.h b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
index 9d7b9a5738..c001ecc2db 100644
--- a/src/quick/scenegraph/coreapi/qsgrendererinterface.h
+++ b/src/quick/scenegraph/coreapi/qsgrendererinterface.h
@@ -68,6 +68,8 @@ public:
PainterResource,
RhiResource,
RhiSwapchainResource,
+ RhiRedirectCommandBuffer,
+ RhiRedirectRenderTarget,
PhysicalDeviceResource,
OpenGLContextResource,
DeviceContextResource,
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)