![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qrhimetal_p.h>
Public Member Functions | |
QMetalRenderPassDescriptor (QRhiImplementation *rhi) | |
~QMetalRenderPassDescriptor () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
bool | isCompatible (const QRhiRenderPassDescriptor *other) const override |
QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor () const override |
QVector< quint32 > | serializedFormat () const override |
void | updateSerializedFormat () |
Public Member Functions inherited from QRhiRenderPassDescriptor | |
QRhiResource::Type | resourceType () const override |
virtual const QRhiNativeHandles * | nativeHandles () |
Public Member Functions inherited from QRhiResource | |
virtual | ~QRhiResource () |
Destructor. | |
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 |
Public Attributes | |
int | colorAttachmentCount = 0 |
bool | hasDepthStencil = false |
int | colorFormat [MAX_COLOR_ATTACHMENTS] |
int | dsFormat |
bool | hasShadingRateMap = false |
QVector< quint32 > | serializedFormatData |
Static Public Attributes | |
static const int | MAX_COLOR_ATTACHMENTS = 8 |
Additional Inherited Members | |
Public Types inherited from QRhiResource | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer , ShadingRateMap } |
Specifies type of the resource. More... | |
Protected Member Functions inherited from QRhiRenderPassDescriptor | |
QRhiRenderPassDescriptor (QRhiImplementation *rhi) | |
Protected Member Functions inherited from QRhiResource | |
QRhiResource (QRhiImplementation *rhi) | |
Protected Attributes inherited from QRhiResource | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Definition at line 123 of file qrhimetal_p.h.
QMetalRenderPassDescriptor::QMetalRenderPassDescriptor | ( | QRhiImplementation * | rhi | ) |
Definition at line 4210 of file qrhimetal.mm.
References QMetalRenderPassDescriptor().
Referenced by QMetalRenderPassDescriptor().
QMetalRenderPassDescriptor::~QMetalRenderPassDescriptor | ( | ) |
Definition at line 4216 of file qrhimetal.mm.
References destroy().
|
overridevirtual |
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.
Implements QRhiResource.
Definition at line 4221 of file qrhimetal.mm.
Referenced by ~QMetalRenderPassDescriptor().
|
overridevirtual |
this
and other can be used interchangebly in QRhiGraphicsPipeline::setRenderPassDescriptor().The concept of the compatibility of renderpass descriptors is similar to the \l{QRhiShaderResourceBindings::isLayoutCompatible}{layout compatibility} of QRhiShaderResourceBindings instances. They allow better reuse of QRhiGraphicsPipeline instances: for example, a QRhiGraphicsPipeline instance cache is expected to use these functions to look for a matching pipeline, instead of just comparing pointers, thus allowing a different QRhiRenderPassDescriptor and QRhiShaderResourceBindings to be used in combination with the pipeline, as long as they are compatible.
The exact details of compatibility depend on the underlying graphics API. Two renderpass descriptors \l{QRhiTextureRenderTarget::newCompatibleRenderPassDescriptor()}{created} from the same QRhiTextureRenderTarget are always compatible.
Similarly to QRhiShaderResourceBindings, compatibility can also be tested without having two existing objects available. Extracting the opaque blob by calling serializedFormat() allows testing for compatibility by comparing the returned vector to another QRhiRenderPassDescriptor's serializedFormat(). This has benefits in certain situations, because it allows testing the compatibility of a QRhiRenderPassDescriptor with a QRhiGraphicsPipeline even when the QRhiRenderPassDescriptor the pipeline was originally built was is no longer available (but the data returned from its serializedFormat() still is).
Implements QRhiRenderPassDescriptor.
Definition at line 4228 of file qrhimetal.mm.
References colorAttachmentCount, colorFormat, dsFormat, hasDepthStencil, and hasShadingRateMap.
|
overridevirtual |
This function allows cloning a QRhiRenderPassDescriptor. The returned object is ready to be used, and the ownership is transferred to the caller. Cloning a QRhiRenderPassDescriptor object can become useful in situations where the object is stored in data structures related to graphics pipelines (in order to allow creating new pipelines which in turn requires a renderpass descriptor object), and the lifetime of the renderpass descriptor created from a render target may be shorter than the pipelines. (for example, because the engine manages and destroys renderpasses together with the textures and render targets it was created from) In such a situation, it can be beneficial to store a cloned version in the data structures, and thus transferring ownership as well.
Implements QRhiRenderPassDescriptor.
Definition at line 4270 of file qrhimetal.mm.
References colorAttachmentCount, colorFormat, dsFormat, hasDepthStencil, hasShadingRateMap, and updateSerializedFormat().
Given two QRhiRenderPassDescriptor objects rp1
and rp2
, if the data returned from this function is identical, then {rp1->isCompatible(rp2)}, and vice versa hold true as well.
When creating reusable components as part of a library, where graphics pipelines are created and maintained while targeting a QRhiRenderTarget (be it a swapchain or a texture) managed by the client of the library, the components must be able to deal with a changing QRhiRenderPassDescriptor. For example, because the render target changes and so invalidates the previously QRhiRenderPassDescriptor (with regards to the new render target at least) due to having a potentially different color format and attachments now. Or because \l{QRhiShadingRateMap}{variable rate shading} is taken into use dynamically. A simple pattern that helps dealing with this is performing the following check on every frame, to recognize the case when the pipeline needs to be associated with a new QRhiRenderPassDescriptor, because something is different about the render target now, compared to earlier frames:
Implements QRhiRenderPassDescriptor.
Definition at line 4286 of file qrhimetal.mm.
void QMetalRenderPassDescriptor::updateSerializedFormat | ( | ) |
Definition at line 4257 of file qrhimetal.mm.
References colorAttachmentCount, colorFormat, dsFormat, hasDepthStencil, and hasShadingRateMap.
Referenced by newCompatibleRenderPassDescriptor(), QMetalSwapChain::newCompatibleRenderPassDescriptor(), and QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor().
int QMetalRenderPassDescriptor::colorAttachmentCount = 0 |
Definition at line 138 of file qrhimetal_p.h.
Referenced by isCompatible(), newCompatibleRenderPassDescriptor(), QMetalSwapChain::newCompatibleRenderPassDescriptor(), QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor(), QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(), and updateSerializedFormat().
int QMetalRenderPassDescriptor::colorFormat[MAX_COLOR_ATTACHMENTS] |
Definition at line 140 of file qrhimetal_p.h.
Referenced by isCompatible(), newCompatibleRenderPassDescriptor(), QMetalSwapChain::newCompatibleRenderPassDescriptor(), QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor(), QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(), and updateSerializedFormat().
int QMetalRenderPassDescriptor::dsFormat |
Definition at line 141 of file qrhimetal_p.h.
Referenced by isCompatible(), newCompatibleRenderPassDescriptor(), QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(), and updateSerializedFormat().
bool QMetalRenderPassDescriptor::hasDepthStencil = false |
Definition at line 139 of file qrhimetal_p.h.
Referenced by isCompatible(), newCompatibleRenderPassDescriptor(), QMetalGraphicsPipeline::setupAttachmentsInMetalRenderPassDescriptor(), and updateSerializedFormat().
bool QMetalRenderPassDescriptor::hasShadingRateMap = false |
Definition at line 142 of file qrhimetal_p.h.
Referenced by isCompatible(), newCompatibleRenderPassDescriptor(), and updateSerializedFormat().
|
static |
Definition at line 137 of file qrhimetal_p.h.
Definition at line 143 of file qrhimetal_p.h.