QRhiRenderBuffer Class

Renderbuffer resource. More...

Header: #include <QRhiRenderBuffer>
qmake: QT += rhi
Inherits: QRhiResource

Public Types

enum Flag { UsedWithSwapChainOnly }
flags Flags
enum Type { DepthStencil, Color }

Public Functions

virtual bool build() = 0
QRhiRenderBuffer::Flags flags() const
QSize pixelSize() const
int sampleCount() const
void setFlags(QRhiRenderBuffer::Flags h)
void setPixelSize(const QSize &sz)
void setSampleCount(int s)
void setType(QRhiRenderBuffer::Type t)
QRhiRenderBuffer::Type type() const

Reimplemented Public Functions

virtual QRhiResource::Type resourceType() const override

Protected Variables

QRhiRenderBuffer::Flags m_flags
QSize m_pixelSize
int m_sampleCount
QRhiRenderBuffer::Type m_type

Additional Inherited Members

Detailed Description

Renderbuffer resource.

Renderbuffers cannot be sampled or read but have some benefits over textures in some cases:

A DepthStencil renderbuffer may be lazily allocated and be backed by transient memory with some APIs. On some platforms this may mean the depth/stencil buffer uses no physical backing at all.

Color renderbuffers are useful since QRhi::MultisampleRenderBuffer may be supported even when QRhi::MultisampleTexture is not.

How the renderbuffer is implemented by a backend is not exposed to the applications. In some cases it may be backed by ordinary textures, while in others there may be a different kind of native resource used.

Member Type Documentation

enum QRhiRenderBuffer::Flag
flags QRhiRenderBuffer::Flags

Flag values for flags() and setFlags()

ConstantValueDescription
QRhiRenderBuffer::UsedWithSwapChainOnly1 << 0For DepthStencil renderbuffers this indicates that the renderbuffer is only used in combination with a QRhiSwapChain and never in other ways. Relevant with some backends, while others ignore it. With OpenGL where a separate windowing system interface API is in use (EGL, GLX, etc.), the flag is important since it avoids creating any actual resource as there is already a windowing system provided depth/stencil buffer as requested by QSurfaceFormat.

The Flags type is a typedef for QFlags<Flag>. It stores an OR combination of Flag values.

enum QRhiRenderBuffer::Type

Specifies the type of the renderbuffer

ConstantValueDescription
QRhiRenderBuffer::DepthStencil0Combined depth/stencil
QRhiRenderBuffer::Color1Color

Property Documentation

Member Function Documentation

[pure virtual] bool QRhiRenderBuffer::build()

Creates the corresponding native graphics resources. If there are already resources present due to an earlier build() with no corresponding release(), then release() is called implicitly first.

Returns true when successful, false when a graphics operation failed. Regardless of the return value, calling release() is always safe.

QRhiRenderBuffer::Flags QRhiRenderBuffer::flags() const

See also setFlags().

QSize QRhiRenderBuffer::pixelSize() const

See also setPixelSize().

[override virtual] QRhiResource::Type QRhiRenderBuffer::resourceType() const

Reimplemented from QRhiResource::resourceType().

Returns the resource type.

int QRhiRenderBuffer::sampleCount() const

See also setSampleCount().

void QRhiRenderBuffer::setFlags(QRhiRenderBuffer::Flags h)

See also flags().

void QRhiRenderBuffer::setPixelSize(const QSize &sz)

See also pixelSize().

void QRhiRenderBuffer::setSampleCount(int s)

See also sampleCount().

void QRhiRenderBuffer::setType(QRhiRenderBuffer::Type t)

See also type().

QRhiRenderBuffer::Type QRhiRenderBuffer::type() const

See also setType().

Member Variable Documentation

Related Non-Members

Macro Documentation