LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::Backends::VulkanSwapChain Class Reference

Implements a Vulkan swap chain. More...

#include <vulkan.hpp>

Inherits LiteFX::Rendering::SwapChain< IVulkanImage, VulkanFrameBuffer >.

Classes

class  VulkanSwapChainImpl
 

Public Member Functions

 VulkanSwapChain (const VulkanDevice &device, const Format &surfaceFormat=Format::B8G8R8A8_SRGB, const Size2d &renderArea={ 800, 600 }, const UInt32 &buffers=3)
 Initializes a Vulkan swap chain. More...
 
 VulkanSwapChain (const VulkanSwapChain &)=delete
 
 VulkanSwapChain (VulkanSwapChain &&)=delete
 
virtual ~VulkanSwapChain () noexcept
 
virtual const VkSemaphore & semaphore () const noexcept
 Returns a reference of the current swap semaphore, a command queue can wait on for presenting. More...
 
virtual const Format & surfaceFormat () const noexcept override
 Returns the swap chain image format. More...
 
virtual const UInt32buffers () const noexcept override
 Returns the number of images in the swap chain. More...
 
virtual const Size2drenderArea () const noexcept override
 Returns the size of the render area. More...
 
virtual Array< const IVulkanImage * > images () const noexcept override
 
virtual void present (const VulkanFrameBuffer &frameBuffer) const override
 
virtual Array< Format > getSurfaceFormats () const noexcept override
 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) override
 Causes the swap chain to be re-created. All frame and command buffers will be invalidated and rebuilt. More...
 
virtual UInt32 swapBackBuffer () const override
 Swaps the front buffer with the next back buffer in order. More...
 
- Public Member Functions inherited from LiteFX::Rendering::SwapChain< IVulkanImage, VulkanFrameBuffer >
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...
 

Additional Inherited Members

- Public Types inherited from LiteFX::Rendering::SwapChain< IVulkanImage, VulkanFrameBuffer >
using image_interface_type = IVulkanImage
 
using frame_buffer_type = VulkanFrameBuffer
 

Detailed Description

Implements a Vulkan swap chain.

Constructor & Destructor Documentation

◆ VulkanSwapChain() [1/3]

VulkanSwapChain::VulkanSwapChain ( const VulkanDevice device,
const Format &  surfaceFormat = Format::B8G8R8A8_SRGB,
const Size2d renderArea = { 800, 600 },
const UInt32 buffers = 3 
)
explicit

Initializes a Vulkan swap chain.

Parameters
deviceThe device that owns the swap chain.
formatThe initial surface format.
renderAreaThe initial size of the render area.
buffersThe initial number of buffers.

◆ VulkanSwapChain() [2/3]

LiteFX::Rendering::Backends::VulkanSwapChain::VulkanSwapChain ( const VulkanSwapChain )
delete

◆ VulkanSwapChain() [3/3]

LiteFX::Rendering::Backends::VulkanSwapChain::VulkanSwapChain ( VulkanSwapChain &&  )
delete

◆ ~VulkanSwapChain()

VulkanSwapChain::~VulkanSwapChain ( )
virtualdefaultnoexcept

Member Function Documentation

◆ buffers()

const UInt32 & VulkanSwapChain::buffers ( ) const
overridevirtualnoexcept

Returns the number of images in the swap chain.

Implements LiteFX::Rendering::ISwapChain.

◆ getSurfaceFormats()

Array< Format > VulkanSwapChain::getSurfaceFormats ( ) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::ISwapChain.

◆ images()

Array< const IVulkanImage * > VulkanSwapChain::images ( ) const
overridevirtualnoexcept

◆ present()

void VulkanSwapChain::present ( const VulkanFrameBuffer frameBuffer) const
overridevirtual

◆ renderArea()

const Size2d & VulkanSwapChain::renderArea ( ) const
overridevirtualnoexcept

Returns the size of the render area.

Implements LiteFX::Rendering::ISwapChain.

◆ reset()

void VulkanSwapChain::reset ( const Format &  surfaceFormat,
const Size2d renderArea,
const UInt32 buffers 
)
overridevirtual

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

Implements LiteFX::Rendering::ISwapChain.

◆ semaphore()

const VkSemaphore & VulkanSwapChain::semaphore ( ) const
virtualnoexcept

Returns a reference of the current swap semaphore, a command queue can wait on for presenting.

Returns
A reference of the current swap semaphore, a command queue can wait on for presenting.

◆ surfaceFormat()

const Format & VulkanSwapChain::surfaceFormat ( ) const
overridevirtualnoexcept

Returns the swap chain image format.

Implements LiteFX::Rendering::ISwapChain.

◆ swapBackBuffer()

UInt32 VulkanSwapChain::swapBackBuffer ( ) const
overridevirtual

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

Implements LiteFX::Rendering::ISwapChain.