Interface for a swap chain, a chain of multiple IImage instances that can be presented using a ISurface.
More...
#include <SwapChain.h>
|
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 IImage * | image (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.
|
|
Interface for a swap chain, a chain of multiple IImage instances that can be presented using a ISurface.
◆ buffers()
virtual unsigned int spark::render::ISwapChain::buffers |
( |
| ) |
const |
|
nodiscardpure virtualnoexcept |
◆ image()
virtual const IImage * spark::render::ISwapChain::image |
( |
unsigned int | back_buffer | ) |
const |
|
nodiscardpure virtual |
Gets the swap chain's current image for the given back buffer.
- Parameters
-
back_buffer | Index of the back buffer to get the image for. |
- Returns
- A IImage pointer to the swap chain's current image for the given back buffer.
- Exceptions
-
◆ images()
std::vector< const IImage * > spark::render::ISwapChain::images |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Gets all the swap chain's images.
- Returns
- A std::vector containing pointers to all the swap chain's images.
◆ present()
void spark::render::ISwapChain::present |
( |
const IFrameBuffer & | frame_buffer | ) |
const |
|
inlinenoexcept |
Queues a present that gets executed after frame_buffer signals that it's done rendering.
- Parameters
-
frame_buffer | The frame buffer for which the present should wait. |
◆ renderArea()
virtual math::Vector2< unsigned int > spark::render::ISwapChain::renderArea |
( |
| ) |
const |
|
nodiscardpure virtualnoexcept |
◆ reset()
virtual void spark::render::ISwapChain::reset |
( |
Format | surface_format, |
|
|
math::Vector2< unsigned int > | render_area, |
|
|
unsigned int | buffers ) |
|
pure virtualnoexcept |
Recreates the swap chain with the given parameters. All frame buffers that use this swap chain will be invalidated and recreated.
There is no guarantee that:
- the swap chain images will end up in the exact format, as specified by
surface_format
. If the format itself is not supported, a compatible format may be looked up. If the lookup fails, the method may raise an exception.
- that the number of images returned by ISwapChain::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
-
surface_format | A Format describing the swap chain's surface format. |
render_area | A math::Vector2<unsigned int> describing the swap chain's frame buffers size. |
buffers | The number of buffers in the swap chain. |
◆ surfaceFormat()
virtual Format spark::render::ISwapChain::surfaceFormat |
( |
| ) |
const |
|
nodiscardpure virtualnoexcept |
◆ surfaceFormats()
virtual std::vector< Format > spark::render::ISwapChain::surfaceFormats |
( |
| ) |
const |
|
nodiscardpure virtualnoexcept |
Gets all the swap chain's supported surface formats.
- Returns
- A std::vector containing all the swap chain's supported surface formats.
Implemented in spark::render::vk::VulkanSwapChain.
◆ swapBackBuffer()
virtual unsigned int spark::render::ISwapChain::swapBackBuffer |
( |
| ) |
const |
|
nodiscardpure virtualnoexcept |