Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QVkTextureRenderTarget Struct Reference

#include <qrhivulkan_p.h>

+ Inheritance diagram for QVkTextureRenderTarget:
+ Collaboration diagram for QVkTextureRenderTarget:

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
 
QRhiRenderPassDescriptornewCompatibleRenderPassDescriptor () override
 
bool create () override
 Creates the corresponding native graphics resources.
 
- Public Member Functions inherited from QRhiTextureRenderTarget
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.
 
- Public Member Functions inherited from QRhiRenderTarget
QRhiRenderPassDescriptorrenderPassDescriptor () const
 
void setRenderPassDescriptor (QRhiRenderPassDescriptor *desc)
 Sets the QRhiRenderPassDescriptor desc for use with this render target.
 
- 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
 
QRhirhi () const
 

Public Attributes

QVkRenderTargetData d
 
VkImageView rtv [QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
 
VkImageView dsv = VK_NULL_HANDLE
 
VkImageView resrtv [QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]
 
VkImageView resdsv = VK_NULL_HANDLE
 
int lastActiveFrameSlot = -1
 

Friends

class QRhiVulkan
 

Additional Inherited Members

- Public Types inherited from QRhiTextureRenderTarget
enum  Flag { PreserveColorContents = 1 << 0 , PreserveDepthStencilContents = 1 << 1 , DoNotStoreDepthStencilContents = 1 << 2 }
 Flag values describing the load/store behavior for the render target. More...
 
- Public Types inherited from QRhiResource
enum  Type {
  Buffer , Texture , Sampler , RenderBuffer ,
  RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings ,
  GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer
}
 Specifies type of the resource. More...
 
- Protected Member Functions inherited from QRhiTextureRenderTarget
 QRhiTextureRenderTarget (QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_)
 
- Protected Member Functions inherited from QRhiRenderTarget
 QRhiRenderTarget (QRhiImplementation *rhi)
 
- Protected Member Functions inherited from QRhiResource
 QRhiResource (QRhiImplementation *rhi)
 
- Protected Attributes inherited from QRhiTextureRenderTarget
QRhiTextureRenderTargetDescription m_desc
 
Flags m_flags
 
- Protected Attributes inherited from QRhiRenderTarget
QRhiRenderPassDescriptorm_renderPassDesc = nullptr
 
- Protected Attributes inherited from QRhiResource
QRhiImplementationm_rhi = nullptr
 
quint64 m_id
 
QByteArray m_objectName
 

Detailed Description

Definition at line 205 of file qrhivulkan_p.h.

Constructor & Destructor Documentation

◆ QVkTextureRenderTarget()

QVkTextureRenderTarget::QVkTextureRenderTarget ( QRhiImplementation * rhi,
const QRhiTextureRenderTargetDescription & desc,
Flags flags )

Definition at line 7056 of file qrhivulkan.cpp.

References QVkRenderTargetData::MAX_COLOR_ATTACHMENTS, resrtv, and rtv.

◆ ~QVkTextureRenderTarget()

QVkTextureRenderTarget::~QVkTextureRenderTarget ( )

Definition at line 7067 of file qrhivulkan.cpp.

References destroy().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

bool QVkTextureRenderTarget::create ( )
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.

Note
renderPassDescriptor() must be set before calling create(). To obtain a QRhiRenderPassDescriptor compatible with the render target, call newCompatibleRenderPassDescriptor() before create() but after setting all other parameters, such as description() and flags(). To save resources, reuse the same QRhiRenderPassDescriptor with multiple QRhiTextureRenderTarget instances, whenever possible. Sharing the same render pass descriptor is only possible when the render targets have the same number and type of attachments (the actual textures can differ) and the same flags.
resources, such as QRhiTexture instances, referenced in description() must already have create() called on them.
Returns
true when successful, false when a graphics operation failed. Regardless of the return value, calling destroy() is always safe.

Implements QRhiTextureRenderTarget.

Definition at line 7129 of file qrhivulkan.cpp.

References QRhiTextureRenderTargetDescription::cbeginColorAttachments(), QRhiTextureRenderTargetDescription::cendColorAttachments(), QRhiTextureRenderTargetDescription::colorAttachmentCount(), QVkRenderTargetData::colorAttCount, QVkRenderTargetData::currentResIdList, d, QRhiTextureRenderTargetDescription::depthResolveTexture(), QRhiTextureRenderTargetDescription::depthStencilBuffer(), QRhiTextureRenderTargetDescription::depthTexture(), destroy(), QVkRenderTargetData::dpr, QVkRenderTargetData::dsAttCount, QVkRenderTargetData::dsResolveAttCount, dsv, QVkRenderTargetData::fb, QSize::height(), it, lastActiveFrameSlot, QRhiTextureRenderTarget::m_desc, QRhiRenderTarget::m_renderPassDesc, QVkRenderTargetData::multiViewCount, QRhiTexture::OneDimensional, QVkRenderTargetData::pixelSize, Q_ASSERT, QRHI_RES, QRHI_RES_RHI, qWarning, QRhiTexture::RenderTarget, resdsv, QVkRenderTargetData::resolveAttCount, resrtv, QVkRenderPassDescriptor::rp, QVkRenderTargetData::rp, rtv, QVkRenderTargetData::sampleCount, and QSize::width().

Referenced by pixelSize().

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

◆ destroy()

void QVkTextureRenderTarget::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.

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 deleting a QRhiResource.

See also
deleteLater()

Implements QRhiResource.

Definition at line 7072 of file qrhivulkan.cpp.

References d, dsv, QVkRenderTargetData::fb, lastActiveFrameSlot, QRhiVulkan::DeferredReleaseEntry::lastActiveFrameSlot, QVkRenderTargetData::MAX_COLOR_ATTACHMENTS, QRHI_RES_RHI, resdsv, resrtv, rtv, QRhiVulkan::DeferredReleaseEntry::TextureRenderTarget, QRhiVulkan::DeferredReleaseEntry::textureRenderTarget, and QRhiVulkan::DeferredReleaseEntry::type.

Referenced by ~QVkTextureRenderTarget(), and create().

+ Here is the caller graph for this function:

◆ devicePixelRatio()

float QVkTextureRenderTarget::devicePixelRatio ( ) const
overridevirtual
Returns
the device pixel ratio. For QRhiTextureRenderTarget this is always
  1. For targets retrieved from a QRhiSwapChain the value reflects the \l{QWindow::devicePixelRatio()}{device pixel ratio} of the targeted QWindow.

Implements QRhiRenderTarget.

Definition at line 7330 of file qrhivulkan.cpp.

References d, and QVkRenderTargetData::dpr.

◆ newCompatibleRenderPassDescriptor()

QRhiRenderPassDescriptor * QVkTextureRenderTarget::newCompatibleRenderPassDescriptor ( )
overridevirtual
Returns
a new QRhiRenderPassDescriptor that is compatible with this render target.

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.

Note
resources, such as QRhiTexture instances, referenced in description() must already have create() called on them.
See also
create()

Implements QRhiTextureRenderTarget.

Definition at line 7103 of file qrhivulkan.cpp.

References QRhiTextureRenderTargetDescription::cbeginColorAttachments(), QRhiTextureRenderTargetDescription::cendColorAttachments(), QRhiTextureRenderTargetDescription::depthResolveTexture(), QRhiTextureRenderTargetDescription::depthStencilBuffer(), QRhiTextureRenderTargetDescription::depthTexture(), QRhiTextureRenderTarget::DoNotStoreDepthStencilContents, QRhiTextureRenderTarget::m_desc, QRhiTextureRenderTarget::m_flags, QRhiResource::m_rhi, QVkRenderPassDescriptor::ownsRp, QRhiTextureRenderTarget::PreserveColorContents, QRhiTextureRenderTarget::PreserveDepthStencilContents, QRHI_RES_RHI, and QVkRenderPassDescriptor::updateSerializedFormat().

+ Here is the call graph for this function:

◆ pixelSize()

QSize QVkTextureRenderTarget::pixelSize ( ) const
overridevirtual
Returns
the size in pixels.

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 7322 of file qrhivulkan.cpp.

References create(), QVkRenderTargetData::currentResIdList, d, QRhiTextureRenderTarget::m_desc, and QVkRenderTargetData::pixelSize.

+ Here is the call graph for this function:

◆ sampleCount()

int QVkTextureRenderTarget::sampleCount ( ) const
overridevirtual
Returns
the sample count or 1 if multisample antialiasing is not relevant for this render target.

Implements QRhiRenderTarget.

Definition at line 7335 of file qrhivulkan.cpp.

References d, and QVkRenderTargetData::sampleCount.

Friends And Related Symbol Documentation

◆ QRhiVulkan

friend class QRhiVulkan
friend

Definition at line 224 of file qrhivulkan_p.h.

Member Data Documentation

◆ d

QVkRenderTargetData QVkTextureRenderTarget::d

Definition at line 218 of file qrhivulkan_p.h.

Referenced by create(), destroy(), devicePixelRatio(), pixelSize(), and sampleCount().

◆ dsv

VkImageView QVkTextureRenderTarget::dsv = VK_NULL_HANDLE

Definition at line 220 of file qrhivulkan_p.h.

Referenced by create(), and destroy().

◆ lastActiveFrameSlot

int QVkTextureRenderTarget::lastActiveFrameSlot = -1

Definition at line 223 of file qrhivulkan_p.h.

Referenced by create(), and destroy().

◆ resdsv

VkImageView QVkTextureRenderTarget::resdsv = VK_NULL_HANDLE

Definition at line 222 of file qrhivulkan_p.h.

Referenced by create(), and destroy().

◆ resrtv

VkImageView QVkTextureRenderTarget::resrtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]

Definition at line 221 of file qrhivulkan_p.h.

Referenced by QVkTextureRenderTarget(), create(), and destroy().

◆ rtv

VkImageView QVkTextureRenderTarget::rtv[QVkRenderTargetData::MAX_COLOR_ATTACHMENTS]

Definition at line 219 of file qrhivulkan_p.h.

Referenced by QVkTextureRenderTarget(), create(), and destroy().


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