![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h More...
#include <qrhi.h>
Public Types | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer , ShadingRateMap } |
Specifies type of the resource. More... |
Public Member Functions | |
virtual | ~QRhiResource () |
Destructor. | |
virtual Type | resourceType () const =0 |
virtual void | destroy ()=0 |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
void | deleteLater () |
When called without a frame being recorded, this function is equivalent to deleting the object. | |
QByteArray | name () const |
void | setName (const QByteArray &name) |
Sets a name for the object. | |
quint64 | globalResourceId () const |
QRhi * | rhi () const |
Protected Member Functions | |
QRhiResource (QRhiImplementation *rhi) |
Protected Attributes | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Friends | |
class | QRhiImplementation |
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Base class for classes encapsulating native resource objects.
enum QRhiResource::Type |
Specifies type of the resource.
\value Buffer \value Texture \value Sampler \value RenderBuffer \value RenderPassDescriptor \value SwapChainRenderTarget \value TextureRenderTarget \value ShaderResourceBindings \value GraphicsPipeline \value SwapChain \value ComputePipeline \value CommandBuffer \value ShadingRateMap
|
virtual |
Destructor.
Releases (or requests deferred releasing of) the underlying native graphics resources, if there are any.
|
protected |
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.
If the QRhi that created this object is already destroyed, the object is deleted immediately.
Using deleteLater() can be a useful convenience in many cases, and it complements the low-level guarantee (that the underlying native graphics objects are never destroyed until it is safe to do so and it is known for sure that they are not used by the GPU in an still in-flight frame), by offering a way to make sure the C++ object instances (of QRhiBuffer, QRhiTexture, etc.) themselves also stay valid until the end of the current frame.
The following example shows a convenient way of creating a throwaway buffer that is only used in one frame and gets automatically released in endFrame(). (when it comes to the underlying native buffer(s), the usual guarantee applies: the QRhi backend defers the releasing of those until it is guaranteed that the frame in which the buffer is accessed by the GPU has completed)
|
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.
The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.
Implemented in QD3D11Buffer, QD3D11CommandBuffer, QD3D11ComputePipeline, QD3D11GraphicsPipeline, QD3D11RenderBuffer, QD3D11RenderPassDescriptor, QD3D11Sampler, QD3D11ShaderResourceBindings, QD3D11SwapChain, QD3D11SwapChainRenderTarget, QD3D11Texture, QD3D11TextureRenderTarget, QGles2Buffer, QGles2CommandBuffer, QGles2ComputePipeline, QGles2GraphicsPipeline, QGles2RenderBuffer, QGles2RenderPassDescriptor, QGles2Sampler, QGles2ShaderResourceBindings, QGles2SwapChain, QGles2SwapChainRenderTarget, QGles2Texture, QGles2TextureRenderTarget, QMetalBuffer, QMetalCommandBuffer, QMetalComputePipeline, QMetalGraphicsPipeline, QMetalRenderBuffer, QMetalRenderPassDescriptor, QMetalSampler, QMetalShaderResourceBindings, QMetalShadingRateMap, QMetalSwapChain, QMetalSwapChainRenderTarget, QMetalTexture, QMetalTextureRenderTarget, QNullBuffer, QNullCommandBuffer, QNullComputePipeline, QNullGraphicsPipeline, QNullRenderBuffer, QNullRenderPassDescriptor, QNullSampler, QNullShaderResourceBindings, QNullSwapChain, QNullSwapChainRenderTarget, QNullTexture, QNullTextureRenderTarget, QVkBuffer, QVkCommandBuffer, QVkComputePipeline, QVkGraphicsPipeline, QVkRenderBuffer, QVkRenderPassDescriptor, QVkSampler, QVkShaderResourceBindings, QVkShadingRateMap, QVkSwapChain, QVkSwapChainRenderTarget, QVkTexture, and QVkTextureRenderTarget.
quint64 QRhiResource::globalResourceId | ( | ) | const |
User code rarely needs to deal with the value directly. It is used internally for tracking and bookkeeping purposes.
QByteArray QRhiResource::name | ( | ) | const |
|
pure virtual |
Implemented in QRhiBuffer, QRhiCommandBuffer, QRhiComputePipeline, QRhiGraphicsPipeline, QRhiRenderBuffer, QRhiRenderPassDescriptor, QRhiSampler, QRhiShaderResourceBindings, QRhiShadingRateMap, QRhiSwapChain, QRhiSwapChainRenderTarget, QRhiTexture, and QRhiTextureRenderTarget.
QRhi * QRhiResource::rhi | ( | ) | const |
void QRhiResource::setName | ( | const QByteArray & | name | ) |
Sets a name for the object.
This allows getting 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}.
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.
|
friend |
|
protected |
|
protected |