Kanzi Engine API
kanzi::CompositionTargetRenderPass::Framebuffer Class Reference

Framebuffer attachment state. More...

#include <kanzi/core.ui/graphics3d/composition_target_render_pass.hpp>

Classes

struct  AttachmentPoint
 AttachmentPoint. More...
 

Public Member Functions

bool attachTarget (Renderer &renderer, const AttachmentPoint &attachmentPoint, Surface::APIAttachment attachment)
 Attaches a single attachment point to output index. More...
 
void attachTarget (Renderer &renderer, const Texture &texture, Surface::APIAttachment attachment)
 Attaches a single texture to output index. More...
 
void attachTarget (Renderer &renderer, const Renderbuffer &renderbuffer, Surface::APIAttachment attachment)
 Attaches a single renderbuffer to output index. More...
 
void clear ()
 Clear internal state. More...
 
 Framebuffer ()=default
 Default constructor. More...
 
unsigned int getDrawBufferCount () const
 Gets the draw buffer count for binding. More...
 
unsigned int getNativeHandle () const
 Gets the native framebuffer handle. More...
 
bool hasAttachedDepthTarget () const
 Indicates whether a depth target has been bound. More...
 
void recreateFramebuffer (Domain *domain)
 Recreates the framebuffer based on existing textures. More...
 
bool update (Domain *domain, array< TextureSharedPtr, 4u > &colorTexture, array< RenderbufferSharedPtr, 4u > &colorRenderbuffer, TextureSharedPtr depthTexture, RenderbufferSharedPtr depthStencilRenderbuffer)
 Updates the framebuffer state. More...
 

Protected Attributes

array< AttachmentPoint, 4 > m_colorAttachments
 Array of color attachments. More...
 
RenderbufferSharedPtr m_depthStencilRenderbuffer
 Depth/stencil renderbuffer. More...
 
TextureSharedPtr m_depthTexture
 Depth texture. More...
 
unsigned int m_drawBufferCount
 Number of draw buffers in use after last update. More...
 
GLFramebufferHandle m_handle
 Framebuffer handle used. More...
 

Detailed Description

Framebuffer attachment state.

Handles the attachment state for a framebuffer that combines multiple textures and renderbuffers into one render context.

Constructor & Destructor Documentation

kanzi::CompositionTargetRenderPass::Framebuffer::Framebuffer ( )
explicitdefault

Default constructor.

Member Function Documentation

unsigned int kanzi::CompositionTargetRenderPass::Framebuffer::getDrawBufferCount ( ) const
inline

Gets the draw buffer count for binding.

Returns
Draw buffer count.
unsigned int kanzi::CompositionTargetRenderPass::Framebuffer::getNativeHandle ( ) const
inline

Gets the native framebuffer handle.

Returns
Native handle ID.
void kanzi::CompositionTargetRenderPass::Framebuffer::clear ( )

Clear internal state.

After calling this function, the framebuffer does not own any GPU resources.

bool kanzi::CompositionTargetRenderPass::Framebuffer::update ( Domain domain,
array< TextureSharedPtr, 4u > &  colorTexture,
array< RenderbufferSharedPtr, 4u > &  colorRenderbuffer,
TextureSharedPtr  depthTexture,
RenderbufferSharedPtr  depthStencilRenderbuffer 
)

Updates the framebuffer state.

Recreates the framebuffer when any attachment state changes:

  • If color renderbuffer is specified, selects it instead of texture.
  • If depth/stencil renderbuffer is specified, selects it instead of texture.
  • Does not check the size or format. Requires the given textures and renderbuffers to have the correct settings.
    Parameters
    domainDomain to use.
    colorTexture0First color texture target.
    colorRenderbuffer0First color renderbuffer target.
    colorTexture1Second color texture target.
    colorRenderbuffer1Second color renderbuffer target.
    colorTexture2Third color texture target.
    colorRenderbuffer2Third color renderbuffer target.
    colorTexture3Fourth color texture target.
    colorRenderbuffer3Fourth color renderbuffer target.
    depthTextureDepth texture target.
    depthRequiredIndicates whether depth is required (if depth texture not specified).
    stencilRequiredIndicates whether stencil is required.
    Returns
    If the framebuffer was recreated true, otherwise false.
void kanzi::CompositionTargetRenderPass::Framebuffer::recreateFramebuffer ( Domain domain)

Recreates the framebuffer based on existing textures.

Parameters
domainDomain to use.
bool kanzi::CompositionTargetRenderPass::Framebuffer::attachTarget ( Renderer renderer,
const AttachmentPoint attachmentPoint,
Surface::APIAttachment  attachment 
)

Attaches a single attachment point to output index.

Favors renderbuffer.

Parameters
rendererRenderer to use.
attachmentPointAttachment point input (texture or renderbuffer).
attachmentSurface attachment target. Color buffer index or depth buffer.
Returns
If any target was attached true, otherwise false.
void kanzi::CompositionTargetRenderPass::Framebuffer::attachTarget ( Renderer renderer,
const Texture texture,
Surface::APIAttachment  attachment 
)

Attaches a single texture to output index.

Parameters
rendererRenderer to use.
textureColor texture to attach.
attachmentSurface attachment target. Color buffer index or depth buffer.
void kanzi::CompositionTargetRenderPass::Framebuffer::attachTarget ( Renderer renderer,
const Renderbuffer renderbuffer,
Surface::APIAttachment  attachment 
)

Attaches a single renderbuffer to output index.

Parameters
rendererRenderer to use.
renderbufferAttachment point to attach.
attachmentSurface attachment target. Color buffer index or depth buffer.
bool kanzi::CompositionTargetRenderPass::Framebuffer::hasAttachedDepthTarget ( ) const
inline

Indicates whether a depth target has been bound.

Returns true if a depth texture is attached or a depth renderbuffer exists.

Returns
If a depth target is bound, true, otherwise false.

Member Data Documentation

GLFramebufferHandle kanzi::CompositionTargetRenderPass::Framebuffer::m_handle
protected

Framebuffer handle used.

array<AttachmentPoint, 4> kanzi::CompositionTargetRenderPass::Framebuffer::m_colorAttachments
protected

Array of color attachments.

TextureSharedPtr kanzi::CompositionTargetRenderPass::Framebuffer::m_depthTexture
protected

Depth texture.

RenderbufferSharedPtr kanzi::CompositionTargetRenderPass::Framebuffer::m_depthStencilRenderbuffer
protected

Depth/stencil renderbuffer.

unsigned int kanzi::CompositionTargetRenderPass::Framebuffer::m_drawBufferCount
protected

Number of draw buffers in use after last update.


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