Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QSSGRhiResourceHandle Class Reference

\inmodule QtQuick3D More...

#include <qssgrenderextensions.h>

Collaboration diagram for QSSGRhiResourceHandle:

Public Member Functions

 QSSGRhiResourceHandle () noexcept
 Constructs an invalid handle.
 ~QSSGRhiResourceHandle ()
 Destroys the handle.
 QSSGRhiResourceHandle (const QSSGRhiResourceHandle &other) noexcept
 Constructs a copy of other.
QSSGRhiResourceHandle & operator= (const QSSGRhiResourceHandle &other) noexcept
 Assigns other to this handle.
 QSSGRhiResourceHandle (QSSGRhiResourceHandle &&other) noexcept=default
void swap (QSSGRhiResourceHandle &other) noexcept
bool isValid () const noexcept
QRhiTexture * texture () const noexcept
QRhiBuffer * buffer () const noexcept
QRhiRenderBuffer * renderBuffer () const noexcept
quint64 globalResourceId () const noexcept

Friends

class QSSGRhiResourceHandlePrivate
bool comparesEqual (const QSSGRhiResourceHandle &lhs, const QSSGRhiResourceHandle &rhs) noexcept

Detailed Description

\inmodule QtQuick3D

Since
6.13

A non-owning handle to an RHI resource created by the renderer.

A QSSGRhiResourceHandle is returned by \l QSSGFrameData::getRhiResource(). It gives access to an RHI resource the renderer created, such as the QRhiTexture of a \l {QtQuick3D::ShaderImage}{ShaderImage}, the QRhiBuffer of a \l {QtQuick3D::ShaderStorageBuffer}{ShaderStorageBuffer}, a render result such as the depth texture of a View3D, or an attachment of a \l {QtQuick3D::RenderPass}{RenderPass}. Depending on the resource, either texture(), buffer() or renderBuffer() returns it.

Definition at line 36 of file qssgrenderextensions.h.

Constructor & Destructor Documentation

◆ QSSGRhiResourceHandle() [1/3]

QSSGRhiResourceHandle::QSSGRhiResourceHandle ( )
defaultnoexcept

Constructs an invalid handle.

◆ ~QSSGRhiResourceHandle()

QSSGRhiResourceHandle::~QSSGRhiResourceHandle ( )
default

Destroys the handle.

This does not affect the resource.

◆ QSSGRhiResourceHandle() [2/3]

QSSGRhiResourceHandle::QSSGRhiResourceHandle ( const QSSGRhiResourceHandle & other)
defaultnoexcept

Constructs a copy of other.

◆ QSSGRhiResourceHandle() [3/3]

QSSGRhiResourceHandle::QSSGRhiResourceHandle ( QSSGRhiResourceHandle && other)
defaultnoexcept

Member Function Documentation

◆ buffer()

QRhiBuffer * QSSGRhiResourceHandle::buffer ( ) const
nodiscardnoexcept
Returns
The buffer, or \nullptr if the handle is invalid or does not refer to a buffer.

Definition at line 154 of file qssgrhiresourcehandle.cpp.

◆ globalResourceId()

quint64 QSSGRhiResourceHandle::globalResourceId ( ) const
nodiscardnoexcept
Returns
The QRhiResource::globalResourceId() of the RHI resource, or 0 for a default constructed handle.

This is not the \l QSSGResourceId of the scene resource. The scene resource keeps its QSSGResourceId when the renderer replaces the RHI resource behind it, while the replacement gets a new globalResourceId(). Unlike the address of the QRhiResource, a globalResourceId() is unique across all QRhi instances and is never given to another RHI resource.

The globalResourceId() is kept after the handle becomes invalid. To find out whether the resource was replaced, compare handles rather than ids, since a resource the renderer rebuilds in place keeps its globalResourceId().

See also
{Scene resources and RHI resources}

Definition at line 190 of file qssgrhiresourcehandle.cpp.

◆ isValid()

bool QSSGRhiResourceHandle::isValid ( ) const
nodiscardnoexcept
Returns
true if the handle refers to a resource that the renderer has not retired.

Definition at line 136 of file qssgrhiresourcehandle.cpp.

◆ operator=()

QSSGRhiResourceHandle & QSSGRhiResourceHandle::operator= ( const QSSGRhiResourceHandle & other)
defaultnoexcept

Assigns other to this handle.

◆ renderBuffer()

QRhiRenderBuffer * QSSGRhiResourceHandle::renderBuffer ( ) const
nodiscardnoexcept
Returns
The render buffer, or \nullptr if the handle is invalid or does not refer to a render buffer.

A render buffer is returned for the depth-stencil attachment of a \l {QtQuick3D::RenderPass}{RenderPass} that does not sample its depth.

See also
QSSGFrameData::AttachmentSelector

Definition at line 168 of file qssgrhiresourcehandle.cpp.

◆ swap()

void QSSGRhiResourceHandle::swap ( QSSGRhiResourceHandle & other)
inlinenoexcept

Definition at line 45 of file qssgrenderextensions.h.

◆ texture()

QRhiTexture * QSSGRhiResourceHandle::texture ( ) const
nodiscardnoexcept
Returns
The texture, or \nullptr if the handle is invalid or does not refer to a texture.

Definition at line 145 of file qssgrhiresourcehandle.cpp.

◆ comparesEqual

bool comparesEqual ( const QSSGRhiResourceHandle & lhs,
const QSSGRhiResourceHandle & rhs )
friend

Definition at line 54 of file qssgrenderextensions.h.

◆ QSSGRhiResourceHandlePrivate

friend class QSSGRhiResourceHandlePrivate
friend

Definition at line 60 of file qssgrenderextensions.h.


The documentation for this class was generated from the following files: