From 3b4e92b62dd728bb279a5b972df8200c39db372b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 5 Oct 2022 16:30:52 +0200 Subject: [PATCH] rhi: Add a way to query the parent QRhi from a resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/rhi/qrhi.cpp | 8 ++++++++ src/gui/rhi/qrhi_p.h | 3 +++ 2 files changed, 11 insertions(+) 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 @@ -2211,6 +2211,14 @@ quint64 QRhiResource::globalResourceId() const return m_id; } +/*! + \return the QRhi that created this resource. + */ +QRhi *QRhiResource::rhi() const +{ + return m_rhi->q; +} + /*! \class QRhiBuffer \internal 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)