![]() |
Qt 6.x
The Qt SDK
|
#include <qrhivulkan_p.h>
Public Member Functions | |
QVkTextureRenderTarget (QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags) | |
~QVkTextureRenderTarget () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
QSize | pixelSize () const override |
float | devicePixelRatio () const override |
int | sampleCount () const override |
QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor () override |
bool | create () override |
Creates the corresponding native graphics resources. | |
![]() | |
QRhiResource::Type | resourceType () const override |
QRhiTextureRenderTargetDescription | description () const |
void | setDescription (const QRhiTextureRenderTargetDescription &desc) |
Sets the render target description desc. | |
Flags | flags () const |
void | setFlags (Flags f) |
Sets the flags to f. | |
virtual QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor ()=0 |
virtual bool | create ()=0 |
Creates the corresponding native graphics resources. | |
![]() | |
virtual QSize | pixelSize () const =0 |
virtual float | devicePixelRatio () const =0 |
virtual int | sampleCount () const =0 |
QRhiRenderPassDescriptor * | renderPassDescriptor () const |
void | setRenderPassDescriptor (QRhiRenderPassDescriptor *desc) |
Sets the QRhiRenderPassDescriptor desc for use with this render target. | |
![]() | |
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 |
Public Attributes | |
QVkRenderTargetData | d |
VkImageView | rtv [QVkRenderTargetData::MAX_COLOR_ATTACHMENTS] |
VkImageView | resrtv [QVkRenderTargetData::MAX_COLOR_ATTACHMENTS] |
int | lastActiveFrameSlot = -1 |
Friends | |
class | QRhiVulkan |
Definition at line 200 of file qrhivulkan_p.h.
QVkTextureRenderTarget::QVkTextureRenderTarget | ( | QRhiImplementation * | rhi, |
const QRhiTextureRenderTargetDescription & | desc, | ||
Flags | flags | ||
) |
Definition at line 6675 of file qrhivulkan.cpp.
References QVkRenderTargetData::MAX_COLOR_ATTACHMENTS, resrtv, and rtv.
QVkTextureRenderTarget::~QVkTextureRenderTarget | ( | ) |
Definition at line 6686 of file qrhivulkan.cpp.
References destroy().
|
overridevirtual |
Creates the corresponding native graphics resources.
If there are already resources present due to an earlier create() with no corresponding destroy(), then destroy() is called implicitly first.
true
when successful, false
when a graphics operation failed. Regardless of the return value, calling destroy() is always safe. Implements QRhiTextureRenderTarget.
Definition at line 6741 of file qrhivulkan.cpp.
References QVarLengthArray< T, Prealloc >::append(), QVkRenderBuffer::backingTexture, QRhiTextureRenderTargetDescription::cbeginColorAttachments(), QRhiTextureRenderTargetDescription::cendColorAttachments(), QRhiTextureRenderTargetDescription::colorAttachmentCount(), QVkRenderTargetData::colorAttCount, QVarLengthArray< T, Prealloc >::constData(), QVkRenderTargetData::currentResIdList, d, QRhiTextureRenderTargetDescription::depthStencilBuffer(), QRhiTextureRenderTargetDescription::depthTexture(), destroy(), QVkRenderTargetData::dpr, QVkRenderTargetData::dsAttCount, QVkRenderTargetData::fb, QRhiTexture::flags(), QSize::height(), QVkTexture::image, QVkRenderBuffer::imageView, QVkTexture::imageView, it, lastActiveFrameSlot, QRhiTextureRenderTarget::m_desc, QRhiRenderTarget::m_renderPassDesc, QVkRenderTargetData::multiViewCount, QRhiTexture::OneDimensional, QRhiTexture::pixelSize(), QRhiRenderBuffer::pixelSize(), QVkRenderTargetData::pixelSize, Q_ASSERT, QRHI_RES, QRHI_RES_RHI, qWarning, QRhiTexture::RenderTarget, QVkRenderTargetData::resolveAttCount, resrtv, QVkRenderPassDescriptor::rp, QVkRenderTargetData::rp, rtv, QVkRenderTargetData::sampleCount, QVkRenderBuffer::samples, QVkTexture::samples, QVkTexture::vkformat, and QSize::width().
Referenced by QRhiVulkan::activateTextureRenderTarget(), and pixelSize().
|
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 6691 of file qrhivulkan.cpp.
References d, e, QVkRenderTargetData::fb, lastActiveFrameSlot, QVkRenderTargetData::MAX_COLOR_ATTACHMENTS, QRHI_RES_RHI, resrtv, rtv, and QRhiVulkan::DeferredReleaseEntry::TextureRenderTarget.
Referenced by ~QVkTextureRenderTarget(), and create().
|
overridevirtual |
Implements QRhiRenderTarget.
Definition at line 6894 of file qrhivulkan.cpp.
References d, and QVkRenderTargetData::dpr.
|
overridevirtual |
The returned value is used in two ways: it can be passed to setRenderPassDescriptor() and QRhiGraphicsPipeline::setRenderPassDescriptor(). A render pass descriptor describes the attachments (color, depth/stencil) and the load/store behavior that can be affected by flags(). A QRhiGraphicsPipeline can only be used in combination with a render target that has a \l{QRhiRenderPassDescriptor::isCompatible()}{compatible} QRhiRenderPassDescriptor set.
Two QRhiTextureRenderTarget instances can share the same render pass descriptor as long as they have the same number and type of attachments. The associated QRhiTexture or QRhiRenderBuffer instances are not part of the render pass descriptor so those can differ in the two QRhiTextureRenderTarget instances.
Implements QRhiTextureRenderTarget.
Definition at line 6717 of file qrhivulkan.cpp.
References QRhiTextureRenderTargetDescription::cbeginColorAttachments(), QRhiTextureRenderTargetDescription::cendColorAttachments(), QRhiTextureRenderTargetDescription::depthStencilBuffer(), QRhiTextureRenderTargetDescription::depthTexture(), QRhiTextureRenderTarget::m_desc, QRhiTextureRenderTarget::m_flags, QRhiResource::m_rhi, QVkRenderPassDescriptor::ownsRp, QRhiTextureRenderTarget::PreserveColorContents, QRhiTextureRenderTarget::PreserveDepthStencilContents, QRHI_RES_RHI, and QVkRenderPassDescriptor::updateSerializedFormat().
|
overridevirtual |
Valid only after create() has been called successfully. Until then the result is a default-constructed QSize.
With QRhiTextureRenderTarget the returned size is the size of the associated attachments at the time of create(), in practice the size of the first color attachment, or the depth/stencil buffer if there are no color attachments. If the associated textures or renderbuffers are resized and rebuilt afterwards, then pixelSize() performs an implicit call to create() in order to rebuild the underlying data structures. This implicit check is similar to what QRhiCommandBuffer::beginPass() does, and ensures that the returned size is always up-to-date.
Implements QRhiRenderTarget.
Definition at line 6886 of file qrhivulkan.cpp.
References create(), QVkRenderTargetData::currentResIdList, d, QRhiTextureRenderTarget::m_desc, and QVkRenderTargetData::pixelSize.
|
overridevirtual |
Implements QRhiRenderTarget.
Definition at line 6899 of file qrhivulkan.cpp.
References d, and QVkRenderTargetData::sampleCount.
|
friend |
Definition at line 217 of file qrhivulkan_p.h.
QVkRenderTargetData QVkTextureRenderTarget::d |
Definition at line 213 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), QRhiVulkan::beginPass(), create(), destroy(), devicePixelRatio(), pixelSize(), and sampleCount().
int QVkTextureRenderTarget::lastActiveFrameSlot = -1 |
Definition at line 216 of file qrhivulkan_p.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), create(), and destroy().
VkImageView QVkTextureRenderTarget::resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS] |
Definition at line 215 of file qrhivulkan_p.h.
Referenced by QVkTextureRenderTarget(), create(), and destroy().
VkImageView QVkTextureRenderTarget::rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS] |
Definition at line 214 of file qrhivulkan_p.h.
Referenced by QVkTextureRenderTarget(), create(), and destroy().