QRhiColorAttachment Class
Describes the a single color attachment of a render target. More...
Header: | #include <QRhiColorAttachment> |
qmake: | QT += rhi |
Public Functions
QRhiColorAttachment() | |
QRhiColorAttachment(QRhiTexture *texture) | |
QRhiColorAttachment(QRhiRenderBuffer *renderBuffer) | |
int | layer() const |
int | level() const |
QRhiRenderBuffer * | renderBuffer() const |
int | resolveLayer() const |
int | resolveLevel() const |
QRhiTexture * | resolveTexture() const |
void | setLayer(int layer) |
void | setLevel(int level) |
void | setRenderBuffer(QRhiRenderBuffer *rb) |
void | setResolveLayer(int layer) |
void | setResolveLevel(int level) |
void | setResolveTexture(QRhiTexture *tex) |
void | setTexture(QRhiTexture *tex) |
QRhiTexture * | texture() const |
Detailed Description
Describes the a single color attachment of a render target.
A color attachment is either a QRhiTexture or a QRhiRenderBuffer. The former, when texture() is set, is used in most cases.
Note: texture() and renderBuffer() cannot be both set (be non-null at the same time).
Setting renderBuffer instead is recommended only when multisampling is needed. Relying on QRhi::MultisampleRenderBuffer is a better choice than QRhi::MultisampleTexture in practice since the former is available in more run time configurations (e.g. when running on OpenGL ES 3.0 which has no support for multisample textures, but does support multisample renderbuffers).
When targeting a non-multisample texture, the layer() and level() indicate the targeted layer (face index 0-5
for cubemaps) and mip level.
When texture() or renderBuffer() is multisample, resolveTexture() can be set optionally. When set, samples are resolved automatically into that (non-multisample) texture at the end of the render pass. When rendering into a multisample renderbuffers, this is the only way to get resolved, non-multisample content out of them. Multisample textures allow sampling in shaders so for them this is just one option.
Note: when resolving is enabled, the multisample data may not be written out at all. This means that the multisample texture() must not be used afterwards with shaders for sampling when resolveTexture() is set.
Member Type Documentation
Property Documentation
Member Function Documentation
QRhiColorAttachment::QRhiColorAttachment()
Constructs an empty color attachment description.
QRhiColorAttachment::QRhiColorAttachment(QRhiTexture *texture)
Constructs a color attachment description that specifies texture as the associated color buffer.
QRhiColorAttachment::QRhiColorAttachment(QRhiRenderBuffer *renderBuffer)
Constructs a color attachment description that specifies renderBuffer as the associated color buffer.
int QRhiColorAttachment::layer() const
See also setLayer().
int QRhiColorAttachment::level() const
See also setLevel().
QRhiRenderBuffer *QRhiColorAttachment::renderBuffer() const
See also setRenderBuffer().
int QRhiColorAttachment::resolveLayer() const
See also setResolveLayer().
int QRhiColorAttachment::resolveLevel() const
See also setResolveLevel().
QRhiTexture *QRhiColorAttachment::resolveTexture() const
See also setResolveTexture().
void QRhiColorAttachment::setLayer(int layer)
See also layer().
void QRhiColorAttachment::setLevel(int level)
See also level().
void QRhiColorAttachment::setRenderBuffer(QRhiRenderBuffer *rb)
See also renderBuffer().
void QRhiColorAttachment::setResolveLayer(int layer)
See also resolveLayer().
void QRhiColorAttachment::setResolveLevel(int level)
See also resolveLevel().
void QRhiColorAttachment::setResolveTexture(QRhiTexture *tex)
See also resolveTexture().
void QRhiColorAttachment::setTexture(QRhiTexture *tex)
See also texture().
QRhiTexture *QRhiColorAttachment::texture() const
See also setTexture().