LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::ISwapChain Class Referenceabstract

Interface for a swap chain. More...

#include <rendering_api.hpp>

Inherited by LiteFX::Rendering::SwapChain< IDirectX12Image, DirectX12FrameBuffer >, LiteFX::Rendering::SwapChain< IVulkanImage, VulkanFrameBuffer >, and LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >.

Public Member Functions

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

Interface for a swap chain.

Constructor & Destructor Documentation

◆ ~ISwapChain()

virtual LiteFX::Rendering::ISwapChain::~ISwapChain ( )
virtualdefaultnoexcept

Member Function Documentation

◆ buffers()

virtual const UInt32 & LiteFX::Rendering::ISwapChain::buffers ( ) const
pure virtualnoexcept

Returns the number of images in the swap chain.

Returns
The number of images in the swap chain.

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.

◆ getSurfaceFormats()

virtual Array< Format > LiteFX::Rendering::ISwapChain::getSurfaceFormats ( ) const
pure virtualnoexcept

Returns an array of supported formats, that can be drawn to the surface.

Returns
An array of supported formats, that can be drawn to the surface.

surface

See also
ISurface

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.

◆ images()

Array< const IImage * > LiteFX::Rendering::ISwapChain::images ( ) const
inlinenoexcept

Returns an array of the swap chain present images.

Returns
Returns an array of the swap chain present images.

◆ present()

virtual void LiteFX::Rendering::ISwapChain::present ( const IFrameBuffer 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.

Implemented in LiteFX::Rendering::SwapChain< TImageInterface, TFrameBuffer >, LiteFX::Rendering::SwapChain< IDirectX12Image, DirectX12FrameBuffer >, and LiteFX::Rendering::SwapChain< IVulkanImage, VulkanFrameBuffer >.

◆ renderArea()

virtual const Size2d & LiteFX::Rendering::ISwapChain::renderArea ( ) const
pure virtualnoexcept

Returns the size of the render area.

Returns
The size of the render area.

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.

◆ reset()

virtual void LiteFX::Rendering::ISwapChain::reset ( const Format &  surfaceFormat,
const Size2d renderArea,
const UInt32 buffers 
)
pure virtual

Causes the swap chain to be re-created. All frame and command buffers will be invalidated and rebuilt.

There is no guarantee, that the swap chain images will end up in the exact format, as specified by surfaceFormat . If the format itself is not supported, a compatible format may be looked up. If the lookup fails, the method may raise an exception.

Similarly, it is not guaranteed, that the number of images returned by images matches the number specified in buffers . A swap chain may require a minimum number of images or may constraint a maximum number of images. In both cases, buffers will be clamped.

Parameters
surfaceFormatThe swap chain image format.
renderAreaThe dimensions of the frame buffers.
buffersThe number of buffers in the swap chain.
See also
multiSamplingLevel

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.

◆ surfaceFormat()

virtual const Format & LiteFX::Rendering::ISwapChain::surfaceFormat ( ) const
pure virtualnoexcept

Returns the swap chain image format.

Returns
The swap chain image format.

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.

◆ swapBackBuffer()

virtual UInt32 LiteFX::Rendering::ISwapChain::swapBackBuffer ( ) const
pure virtual

Swaps the front buffer with the next back buffer in order.

Returns
A reference of the front buffer after the buffer swap.

Implemented in LiteFX::Rendering::Backends::DirectX12SwapChain, and LiteFX::Rendering::Backends::VulkanSwapChain.