![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qrhi.h>
Public Types | |
enum | Flag { PreserveColorContents = 1 << 0 , PreserveDepthStencilContents = 1 << 1 } |
Flag values describing the load/store behavior for the render target. More... | |
![]() | |
enum | Type { Buffer , Texture , Sampler , RenderBuffer , RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings , GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer } |
Specifies type of the resource. More... | |
Public Member Functions | |
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 |
Protected Member Functions | |
QRhiTextureRenderTarget (QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc_, Flags flags_) | |
![]() | |
QRhiRenderTarget (QRhiImplementation *rhi) | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
Protected Attributes | |
QRhiTextureRenderTargetDescription | m_desc |
Flags | m_flags |
![]() | |
QRhiRenderPassDescriptor * | m_renderPassDesc = nullptr |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
\inmodule QtGui
Texture render target resource.
A texture render target allows rendering into one or more textures, optionally with a depth texture or depth/stencil renderbuffer.
For multisample rendering the common approach is to use a renderbuffer as the color attachment and set the non-multisample destination texture as the {resolve texture}.
The simplest example of creating a render target with a texture as its single color attachment:
Flag values describing the load/store behavior for the render target.
The load/store behavior may be baked into native resources under the hood, depending on the backend, and therefore it needs to be known upfront and cannot be changed without rebuilding (and so releasing and creating new native resources).
\value PreserveColorContents Indicates that the contents of the color attachments is to be loaded when starting a render pass, instead of clearing. This is potentially more expensive, especially on mobile (tiled) GPUs, but allows preserving the existing contents between passes.
\value PreserveDepthStencilContents Indicates that the contents of the depth texture is to be loaded when starting a render pass, instead clearing. Only applicable when a texture is used as the depth buffer (QRhiTextureRenderTargetDescription::depthTexture() is set) because depth/stencil renderbuffers may not have any physical backing and data may not be written out in the first place.
Enumerator | |
---|---|
PreserveColorContents | |
PreserveDepthStencilContents |
|
protected |
|
pure virtual |
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. Implemented in QD3D11TextureRenderTarget, QGles2TextureRenderTarget, QMetalTextureRenderTarget, QNullTextureRenderTarget, and QVkTextureRenderTarget.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), QSSGRenderShadowMap::addShadowMapEntry(), RenderHelpers::rhiPrepareAoTexture(), RenderHelpers::rhiPrepareDepthTexture(), RenderHelpers::rhiPrepareScreenTexture(), and QQuick3DSceneRenderer::synchronize().
|
inline |
Definition at line 1171 of file qrhi.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), QRhiD3D11::beginPass(), QRhiGles2::beginPass(), QRhiMetal::beginPass(), QRhiNull::beginPass(), and renderToKTXFileInternal().
|
inline |
|
pure virtual |
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.
Implemented in QD3D11TextureRenderTarget, QGles2TextureRenderTarget, QMetalTextureRenderTarget, QNullTextureRenderTarget, and QVkTextureRenderTarget.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), QSSGRenderShadowMap::addShadowMapEntry(), RenderHelpers::rhiPrepareAoTexture(), RenderHelpers::rhiPrepareDepthTexture(), RenderHelpers::rhiPrepareScreenTexture(), RenderHelpers::rhiRenderReflectionMap(), and QQuick3DSceneRenderer::synchronize().
|
overridevirtual |
Implements QRhiResource.
Definition at line 4932 of file qrhi.cpp.
References QRhiResource::TextureRenderTarget.
|
inline |
Sets the render target description desc.
Definition at line 1172 of file qrhi.h.
References desc.
Referenced by QSSGRenderReflectionMap::addReflectionMapEntry(), and QSSGRenderShadowMap::addShadowMapEntry().
|
protected |
Definition at line 1183 of file qrhi.h.
Referenced by QRhiVulkan::activateTextureRenderTarget(), QRhiMetal::beginPass(), QD3D11TextureRenderTarget::create(), QGles2TextureRenderTarget::create(), QMetalTextureRenderTarget::create(), QNullTextureRenderTarget::create(), QVkTextureRenderTarget::create(), QRhiD3D11::endPass(), QRhiGles2::endPass(), QRhiGles2::enqueueBindFramebuffer(), QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor(), QVkTextureRenderTarget::newCompatibleRenderPassDescriptor(), QD3D11TextureRenderTarget::pixelSize(), QGles2TextureRenderTarget::pixelSize(), QMetalTextureRenderTarget::pixelSize(), QNullTextureRenderTarget::pixelSize(), and QVkTextureRenderTarget::pixelSize().
|
protected |
Definition at line 1184 of file qrhi.h.
Referenced by QRhiD3D11::beginPass(), QRhiMetal::beginPass(), QRhiGles2::enqueueBindFramebuffer(), and QVkTextureRenderTarget::newCompatibleRenderPassDescriptor().