summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-10-05 16:30:52 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-10-05 20:02:20 +0200
commit3b4e92b62dd728bb279a5b972df8200c39db372b (patch)
tree37408aa740e9839ed240b10c84e85e7c3cd7ec09 /src/gui/rhi
parentb254eff6959ea4a41c5df55bc4c2f5461ded2c15 (diff)
rhi: Add a way to query the parent QRhi from a resource
Quick3D introduces the need to verify the QRhi when only a QRhiTexture (pulled out from a QSGTexture) is available. To enable this, there needs to be a way to retrieve the QRhi from the QRhiTexture. Change-Id: I00777f08b030a7de742169beb0b99ca6282d51a6 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qrhi.cpp8
-rw-r--r--src/gui/rhi/qrhi_p.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index eac11638bf..afe79c6687 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -2212,6 +2212,14 @@ quint64 QRhiResource::globalResourceId() const
}
/*!
+ \return the QRhi that created this resource.
+ */
+QRhi *QRhiResource::rhi() const
+{
+ return m_rhi->q;
+}
+
+/*!
\class QRhiBuffer
\internal
\inmodule QtGui
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 1d0dce97c5..1d32d08e84 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -30,6 +30,7 @@
QT_BEGIN_NAMESPACE
class QWindow;
+class QRhi;
class QRhiImplementation;
class QRhiBuffer;
class QRhiRenderBuffer;
@@ -684,6 +685,8 @@ public:
quint64 globalResourceId() const;
+ QRhi *rhi() const;
+
protected:
QRhiResource(QRhiImplementation *rhi);
Q_DISABLE_COPY(QRhiResource)