SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::SwapChain< ImageType, FrameBufferType > Class Template Referenceabstract

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

#include <SwapChain.h>

Inheritance diagram for spark::render::SwapChain< ImageType, FrameBufferType >:
spark::render::ISwapChain

Public Types

using image_type = ImageType
 
using frame_buffer_type = FrameBufferType
 

Public Member Functions

virtual std::vector< const image_type * > images () const noexcept=0
 Gets all the swap chain's images.
 
virtual void present (const frame_buffer_type &frame_buffer) const noexcept=0
 Queues a present that gets executed after frame_buffer signals that it's done rendering.
 
- Public Member Functions inherited from spark::render::ISwapChain
virtual Format surfaceFormat () const noexcept=0
 Gets the swap chain's surface format.
 
virtual unsigned int buffers () const noexcept=0
 Gets the number of images in the swap chain.
 
virtual math::Vector2< unsigned int > renderArea () const noexcept=0
 Gets the swap chain's render area.
 
virtual const IImageimage (unsigned int back_buffer) const =0
 Gets the swap chain's current image for the given back buffer.
 
std::vector< const IImage * > images () const noexcept
 Gets all the swap chain's images.
 
void present (const IFrameBuffer &frame_buffer) const noexcept
 Queues a present that gets executed after frame_buffer signals that it's done rendering.
 
virtual std::vector< Format > surfaceFormats () const noexcept=0
 Gets all the swap chain's supported surface formats.
 
virtual void reset (Format surface_format, math::Vector2< unsigned int > render_area, unsigned int buffers) noexcept=0
 Recreates the swap chain with the given parameters. All frame buffers that use this swap chain will be invalidated and recreated.
 
virtual unsigned int swapBackBuffer () const noexcept=0
 Swaps the front buffer with the next back buffer in order.
 

Detailed Description

template<typename ImageType, typename FrameBufferType>
class spark::render::SwapChain< ImageType, FrameBufferType >

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

Template Parameters
ImageTypeType of the swap chain's images. (inherits from IImage)
FrameBufferTypeType of the frame buffer. (inherits from IFrameBuffer)

Member Function Documentation

◆ images()

template<typename ImageType , typename FrameBufferType >
virtual std::vector< const image_type * > spark::render::SwapChain< ImageType, FrameBufferType >::images ( ) const
nodiscardpure virtualnoexcept

Gets all the swap chain's images.

Returns
A std::vector containing pointers to all the swap chain's images.

Implemented in spark::render::vk::VulkanSwapChain.

◆ present()

template<typename ImageType , typename FrameBufferType >
virtual void spark::render::SwapChain< ImageType, FrameBufferType >::present ( const frame_buffer_type & frame_buffer) const
pure virtualnoexcept

Queues a present that gets executed after frame_buffer signals that it's done rendering.

Parameters
frame_bufferThe frame buffer for which the present should wait.