QtBase  v6.3.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QRhiResource Class Referenceabstract

#include <qrhi_p.h>

Inheritance diagram for QRhiResource:
Inheritance graph
[legend]
Collaboration diagram for QRhiResource:
Collaboration graph
[legend]

Public Types

enum  Type {
  Buffer , Texture , Sampler , RenderBuffer ,
  RenderPassDescriptor , RenderTarget , TextureRenderTarget , ShaderResourceBindings ,
  GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer
}
 

Public Member Functions

virtual ~QRhiResource ()
 
virtual Type resourceType () const =0
 
virtual void destroy ()=0
 
void deleteLater ()
 
QByteArray name () const
 
void setName (const QByteArray &name)
 
quint64 globalResourceId () const
 

Protected Member Functions

 QRhiResource (QRhiImplementation *rhi)
 

Protected Attributes

QRhiImplementationm_rhi = nullptr
 
quint64 m_id
 
QByteArray m_objectName
 

Friends

class QRhiImplementation
 

Detailed Description

Definition at line 673 of file qrhi_p.h.

Member Enumeration Documentation

◆ Type

Enumerator
Buffer 
Texture 
Sampler 
RenderBuffer 
RenderPassDescriptor 
RenderTarget 
TextureRenderTarget 
ShaderResourceBindings 
GraphicsPipeline 
SwapChain 
ComputePipeline 
CommandBuffer 

Definition at line 676 of file qrhi_p.h.

Constructor & Destructor Documentation

◆ ~QRhiResource()

QRhiResource::~QRhiResource ( )
virtual

Destructor.

Releases (or requests deferred releasing of) the underlying native graphics resources, if there are any.

Note
Resources referenced by commands for the current frame should not be released until the frame is submitted by QRhi::endFrame().
See also
destroy()

Definition at line 1998 of file qrhi.cpp.

◆ QRhiResource()

QRhiResource::QRhiResource ( QRhiImplementation rhi)
protected

Definition at line 1981 of file qrhi.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ deleteLater()

void QRhiResource::deleteLater ( )

When called without a frame being recorded, this function is equivalent to deleting the object. Between a QRhi::beginFrame() and QRhi::endFrame() however the behavior is different: the QRhiResource will not be destroyed until the frame is submitted via QRhi::endFrame(), thus satisfying the QRhi requirement of not altering QRhiResource objects that are referenced by the frame being recorded.

See also
destroy()

Definition at line 2034 of file qrhi.cpp.

Here is the call graph for this function:

◆ destroy()

void QRhiResource::destroy ( )
pure virtual

Releases (or requests deferred releasing of) the underlying native graphics resources. Safe to call multiple times, subsequent invocations will be a no-op then.

Once destroy() is called, the QRhiResource instance can be reused, by calling create() again. That will then result in creating new native graphics resources underneath.

Note
Resources referenced by commands for the current frame should not be released until the frame is submitted by QRhi::endFrame().

The QRhiResource destructor also performs the same task, so calling this function is not necessary before destroying a QRhiResource.

See also
deleteLater()

Implemented in QVkSwapChain, QVkCommandBuffer, QVkComputePipeline, QVkGraphicsPipeline, QVkShaderResourceBindings, QVkTextureRenderTarget, QVkReferenceRenderTarget, QVkRenderPassDescriptor, QVkSampler, QVkTexture, QVkRenderBuffer, QVkBuffer, QNullSwapChain, QNullCommandBuffer, QNullComputePipeline, QNullGraphicsPipeline, QNullShaderResourceBindings, QNullTextureRenderTarget, QNullReferenceRenderTarget, QNullRenderPassDescriptor, QNullSampler, QNullTexture, QNullRenderBuffer, QNullBuffer, QMetalSwapChain, QMetalCommandBuffer, QMetalComputePipeline, QMetalGraphicsPipeline, QMetalShaderResourceBindings, QMetalTextureRenderTarget, QMetalReferenceRenderTarget, QMetalRenderPassDescriptor, QMetalSampler, QMetalTexture, QMetalRenderBuffer, QMetalBuffer, QGles2SwapChain, QGles2CommandBuffer, QGles2ComputePipeline, QGles2GraphicsPipeline, QGles2ShaderResourceBindings, QGles2TextureRenderTarget, QGles2ReferenceRenderTarget, QGles2RenderPassDescriptor, QGles2Sampler, QGles2Texture, QGles2RenderBuffer, QGles2Buffer, QD3D11SwapChain, QD3D11CommandBuffer, QD3D11ComputePipeline, QD3D11GraphicsPipeline, QD3D11ShaderResourceBindings, QD3D11TextureRenderTarget, QD3D11ReferenceRenderTarget, QD3D11RenderPassDescriptor, QD3D11Sampler, QD3D11Texture, QD3D11RenderBuffer, and QD3D11Buffer.

Here is the caller graph for this function:

◆ globalResourceId()

quint64 QRhiResource::globalResourceId ( ) const
Returns
the global, unique identifier of this QRhiResource.

User code rarely needs to deal with the value directly. It is used internally for tracking and bookkeeping purposes.

Definition at line 2080 of file qrhi.cpp.

◆ name()

QByteArray QRhiResource::name ( ) const
Returns
the currently set object name. By default the name is empty.

Definition at line 2042 of file qrhi.cpp.

Here is the caller graph for this function:

◆ resourceType()

QRhiResource::Type QRhiResource::resourceType ( ) const
pure virtual

◆ setName()

void QRhiResource::setName ( const QByteArray name)

Sets a name for the object.

This has two uses: to get descriptive names for the native graphics resources visible in graphics debugging tools, such as \l{https://renderdoc.org/}{RenderDoc} and \l{https://developer.apple.com/xcode/}{XCode}, and in the output stream of QRhiProfiler.

When it comes to naming native objects by relaying the name via the appropriate graphics API, note that the name is ignored when QRhi::DebugMarkers are not supported, and may, depending on the backend, also be ignored when QRhi::EnableDebugMarkers is not set.

Note
The name may be ignored for objects other than buffers, renderbuffers, and textures, depending on the backend.
The name may be modified. For slotted resources, such as a QRhiBuffer backed by multiple native buffers, QRhi will append a suffix to make the underlying native buffers easily distinguishable from each other.

Definition at line 2068 of file qrhi.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ QRhiImplementation

friend class QRhiImplementation
friend

Definition at line 707 of file qrhi_p.h.

Member Data Documentation

◆ m_id

quint64 QRhiResource::m_id
protected

Definition at line 709 of file qrhi_p.h.

◆ m_objectName

QByteArray QRhiResource::m_objectName
protected

Definition at line 710 of file qrhi_p.h.

◆ m_rhi

QRhiImplementation* QRhiResource::m_rhi = nullptr
protected

Definition at line 708 of file qrhi_p.h.


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