Render pass resource. 更多...
头: | #include <QRhiRenderPassDescriptor> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
Since: | Qt 6.6 |
继承: | QRhiResource |
virtual bool | isCompatible (const QRhiRenderPassDescriptor * other ) const = 0 |
virtual const QRhiNativeHandles * | nativeHandles () |
virtual QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor () const = 0 |
virtual QVector<quint32> | serializedFormat () const = 0 |
virtual QRhiResource::Type | resourceType () const override |
A render pass, if such a concept exists in the underlying graphics API, is a collection of attachments (color, depth, stencil) and describes how those attachments are used.
注意: This is a RHI API with limited compatibility guarantees, see QRhi 了解细节。
[pure virtual]
bool
QRhiRenderPassDescriptor::
isCompatible
(const
QRhiRenderPassDescriptor
*
other
) const
返回 true 若
other
QRhiRenderPassDescriptor
is compatible with this one, meaning
this
and
other
can be used interchangebly in
QRhiGraphicsPipeline::setRenderPassDescriptor
().
The concept of the compatibility of renderpass descriptors is similar to the 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 created from the same QRhiTextureRenderTarget are always compatible.
类似于 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 采用 QRhiGraphicsPipeline even when the QRhiRenderPassDescriptor the pipeline was originally built was is no longer available (but the data returned from its serializedFormat () still is).
另请参阅 newCompatibleRenderPassDescriptor () 和 serializedFormat ().
[虚拟]
const
QRhiNativeHandles
*QRhiRenderPassDescriptor::
nativeHandles
()
Returns a pointer to a backend-specific
QRhiNativeHandles
subclass, such as
QRhiVulkanRenderPassNativeHandles
. The returned value is
nullptr
when exposing the underlying native resources is not supported by the backend.
另请参阅 QRhiVulkanRenderPassNativeHandles .
[pure virtual]
QRhiRenderPassDescriptor
*QRhiRenderPassDescriptor::
newCompatibleRenderPassDescriptor
() const
返回新的 QRhiRenderPassDescriptor that is compatible with this one.
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.
另请参阅 isCompatible ().
[override virtual]
QRhiResource::Type
QRhiRenderPassDescriptor::
resourceType
() const
重实现: QRhiResource::resourceType() const .
Returns the resource type.
[pure virtual]
QVector
<
quint32
> QRhiRenderPassDescriptor::
serializedFormat
() const
Returns a vector of integers containing an opaque blob describing the data relevant for compatibility .
Given two
QRhiRenderPassDescriptor
对象
rp1
and
rp2
, if the data returned from this function is identical, then
rp1->isCompatible(rp2)
, and vice versa hold true as well.
注意: The returned data is meant to be used for storing in memory and comparisons during the lifetime of the QRhi the object belongs to. It is not meant for storing on disk, reusing between processes, or using with multiple QRhi instances with potentially different backends.
另请参阅 isCompatible ().