QtBase  v6.3.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QRhiRenderBuffer Class Referenceabstract

#include <qrhi_p.h>

Inheritance diagram for QRhiRenderBuffer:
Inheritance graph
[legend]
Collaboration diagram for QRhiRenderBuffer:
Collaboration graph
[legend]

Classes

struct  NativeRenderBuffer
 

Public Types

enum  Type { DepthStencil , Color }
 
enum  Flag { UsedWithSwapChainOnly = 1 << 0 }
 
- Public Types inherited from QRhiResource
enum  Type {
  Buffer , Texture , Sampler , RenderBuffer ,
  RenderPassDescriptor , RenderTarget , TextureRenderTarget , ShaderResourceBindings ,
  GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer
}
 

Public Member Functions

QRhiResource::Type resourceType () const override
 
Type type () const
 
void setType (Type t)
 
QSize pixelSize () const
 
void setPixelSize (const QSize &sz)
 
int sampleCount () const
 
void setSampleCount (int s)
 
Flags flags () const
 
void setFlags (Flags h)
 
virtual bool create ()=0
 
virtual bool createFrom (NativeRenderBuffer src)
 
virtual QRhiTexture::Format backingFormat () const =0
 
- Public Member Functions inherited from QRhiResource
virtual ~QRhiResource ()
 
virtual void destroy ()=0
 
void deleteLater ()
 
QByteArray name () const
 
void setName (const QByteArray &name)
 
quint64 globalResourceId () const
 

Protected Member Functions

 QRhiRenderBuffer (QRhiImplementation *rhi, Type type_, const QSize &pixelSize_, int sampleCount_, Flags flags_, QRhiTexture::Format backingFormatHint_)
 
- Protected Member Functions inherited from QRhiResource
 QRhiResource (QRhiImplementation *rhi)
 

Protected Attributes

Type m_type
 
QSize m_pixelSize
 
int m_sampleCount
 
Flags m_flags
 
QRhiTexture::Format m_backingFormatHint
 
- Protected Attributes inherited from QRhiResource
QRhiImplementationm_rhi = nullptr
 
quint64 m_id
 
QByteArray m_objectName
 

Detailed Description

Definition at line 937 of file qrhi_p.h.

Member Enumeration Documentation

◆ Flag

Flag values for flags() and setFlags()

\value UsedWithSwapChainOnly For DepthStencil renderbuffers this indicates that the renderbuffer is only used in combination with a QRhiSwapChain, and never in any other way. This provides automatic sizing and resource rebuilding, so calling setPixelSize() or create() is not needed whenever this flag is set. This flag value may also trigger backend-specific behavior, for example with OpenGL, where a separate windowing system interface API is in use (EGL, GLX, etc.), the flag is especially important as it avoids creating any actual renderbuffer resource as there is already a windowing system provided depth/stencil buffer as requested by QSurfaceFormat.

Enumerator
UsedWithSwapChainOnly 

Definition at line 945 of file qrhi_p.h.

◆ Type

Specifies the type of the renderbuffer

\value DepthStencil Combined depth/stencil \value Color Color

Enumerator
DepthStencil 
Color 

Definition at line 940 of file qrhi_p.h.

Constructor & Destructor Documentation

◆ QRhiRenderBuffer()

QRhiRenderBuffer::QRhiRenderBuffer ( QRhiImplementation rhi,
Type  type_,
const QSize pixelSize_,
int  sampleCount_,
Flags  flags_,
QRhiTexture::Format  backingFormatHint_ 
)
protected

Definition at line 2363 of file qrhi.cpp.

Member Function Documentation

◆ backingFormat()

QRhiTexture::Format QRhiRenderBuffer::backingFormat ( ) const
pure virtual

◆ create()

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

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

Implemented in QVkRenderBuffer, QNullRenderBuffer, QMetalRenderBuffer, QGles2RenderBuffer, and QD3D11RenderBuffer.

Here is the caller graph for this function:

◆ createFrom()

bool QRhiRenderBuffer::createFrom ( NativeRenderBuffer  src)
virtual

Similar to create() except that no new native renderbuffer objects are created. Instead, the native renderbuffer object specified by src is used.

This allows importing an existing renderbuffer object (which must belong to the same device or sharing context, depending on the graphics API) from an external graphics engine.

Note
This is currently applicable to OpenGL only. This function exists solely to allow importing a renderbuffer object that is bound to some special, external object, such as an EGLImageKHR. Once the application performed the glEGLImageTargetRenderbufferStorageOES call, the renderbuffer object can be passed to this function to create a wrapping QRhiRenderBuffer, which in turn can be passed in as a color attachment to a QRhiTextureRenderTarget to enable rendering to the EGLImage.
pixelSize(), sampleCount(), and flags() must still be set correctly. Passing incorrect sizes and other values to QRhi::newRenderBuffer() and then following it with a createFrom() expecting that the native renderbuffer object alone is sufficient to deduce such values is wrong and will lead to problems.
QRhiRenderBuffer does not take ownership of the native object, and destroy() will not release that object.
This function is only implemented when the QRhi::RenderBufferImport feature is reported as \l{QRhi::isFeatureSupported()}{supported}. Otherwise, the function does nothing and the return value is false.
Returns
true when successful, false when not supported.

Reimplemented in QGles2RenderBuffer.

Definition at line 2423 of file qrhi.cpp.

Here is the call graph for this function:

◆ flags()

Flags QRhiRenderBuffer::flags ( ) const
inline

Definition at line 965 of file qrhi_p.h.

Here is the caller graph for this function:

◆ pixelSize()

QSize QRhiRenderBuffer::pixelSize ( ) const
inline

Definition at line 959 of file qrhi_p.h.

Here is the caller graph for this function:

◆ resourceType()

QRhiResource::Type QRhiRenderBuffer::resourceType ( ) const
overridevirtual
Returns
the resource type.

Implements QRhiResource.

Definition at line 2375 of file qrhi.cpp.

◆ sampleCount()

int QRhiRenderBuffer::sampleCount ( ) const
inline

Definition at line 962 of file qrhi_p.h.

Here is the caller graph for this function:

◆ setFlags()

void QRhiRenderBuffer::setFlags ( Flags  h)
inline

Definition at line 966 of file qrhi_p.h.

◆ setPixelSize()

void QRhiRenderBuffer::setPixelSize ( const QSize sz)
inline

Definition at line 960 of file qrhi_p.h.

Here is the caller graph for this function:

◆ setSampleCount()

void QRhiRenderBuffer::setSampleCount ( int  s)
inline

Definition at line 963 of file qrhi_p.h.

◆ setType()

void QRhiRenderBuffer::setType ( Type  t)
inline

Definition at line 957 of file qrhi_p.h.

◆ type()

Type QRhiRenderBuffer::type ( ) const
inline

Definition at line 956 of file qrhi_p.h.

Here is the caller graph for this function:

Member Data Documentation

◆ m_backingFormatHint

QRhiTexture::Format QRhiRenderBuffer::m_backingFormatHint
protected

Definition at line 980 of file qrhi_p.h.

◆ m_flags

Flags QRhiRenderBuffer::m_flags
protected

Definition at line 979 of file qrhi_p.h.

◆ m_pixelSize

QSize QRhiRenderBuffer::m_pixelSize
protected

Definition at line 977 of file qrhi_p.h.

◆ m_sampleCount

int QRhiRenderBuffer::m_sampleCount
protected

Definition at line 978 of file qrhi_p.h.

◆ m_type

Type QRhiRenderBuffer::m_type
protected

Definition at line 976 of file qrhi_p.h.


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