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>
This commit is contained in:
Laszlo Agocs 2022-10-05 16:30:52 +02:00
parent b254eff695
commit 3b4e92b62d
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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)