LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer > Class Template Referenceabstract

Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurface. More...

#include <rendering.hpp>

Inherits LiteFX::Rendering::ISwapChain.

Public Types

using image_interface_type = TImageInterface
 
using frame_buffer_type = TFrameBuffer
 

Public Member Functions

virtual ~SwapChain () noexcept=default
 
virtual Array< const image_interface_type * > images () const noexcept=0
 
virtual void present (const frame_buffer_type &frameBuffer) const =0
 Queues a present that gets executed after frameBuffer signals its readiness. More...
 
virtual void present (const IFrameBuffer &frameBuffer) const override
 Queues a present that gets executed after frameBuffer signals its readiness. More...
 
- Public Member Functions inherited from LiteFX::Rendering::ISwapChain
virtual ~ISwapChain () noexcept=default
 
virtual const Format & surfaceFormat () const noexcept=0
 Returns the swap chain image format. More...
 
virtual const UInt32buffers () const noexcept=0
 Returns the number of images in the swap chain. More...
 
virtual const Size2drenderArea () const noexcept=0
 Returns the size of the render area. More...
 
Array< const IImage * > images () const noexcept
 Returns an array of the swap chain present images. More...
 
virtual void present (const IFrameBuffer &frameBuffer) const =0
 Queues a present that gets executed after frameBuffer signals its readiness. More...
 
virtual Array< Format > getSurfaceFormats () const noexcept=0
 Returns an array of supported formats, that can be drawn to the surface. More...
 
virtual void reset (const Format &surfaceFormat, const Size2d &renderArea, const UInt32 &buffers)=0
 Causes the swap chain to be re-created. All frame and command buffers will be invalidated and rebuilt. More...
 
virtual UInt32 swapBackBuffer () const =0
 Swaps the front buffer with the next back buffer in order. More...
 

Detailed Description

template<typename TImageInterface, typename TFrameBuffer>
requires rtti::implements<TFrameBuffer, FrameBuffer<typename TFrameBuffer::command_buffer_type>> && std::derived_from<TImageInterface, IImage>
class LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >

Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurface.

Template Parameters
TImageInterfaceThe type of the image interface. Must inherit from IImage.

Member Typedef Documentation

◆ frame_buffer_type

template<typename TImageInterface , typename TFrameBuffer >
using LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::frame_buffer_type = TFrameBuffer

◆ image_interface_type

template<typename TImageInterface , typename TFrameBuffer >
using LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::image_interface_type = TImageInterface

Constructor & Destructor Documentation

◆ ~SwapChain()

template<typename TImageInterface , typename TFrameBuffer >
virtual LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::~SwapChain ( )
virtualdefaultnoexcept

Member Function Documentation

◆ images()

template<typename TImageInterface , typename TFrameBuffer >
virtual Array< const image_interface_type * > LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::images ( ) const
pure virtualnoexcept

◆ present() [1/2]

template<typename TImageInterface , typename TFrameBuffer >
virtual void LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::present ( const frame_buffer_type frameBuffer) const
pure virtual

Queues a present that gets executed after frameBuffer signals its readiness.

Parameters
frameBufferThe frame buffer for which the present should wait.

◆ present() [2/2]

template<typename TImageInterface , typename TFrameBuffer >
virtual void LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >::present ( const IFrameBuffer frameBuffer) const
inlineoverridevirtual

Queues a present that gets executed after frameBuffer signals its readiness.

Implements LiteFX::Rendering::ISwapChain.