3#include "spark/render/Export.h"
4#include "spark/render/FrameBuffer.h"
5#include "spark/render/Image.h"
6#include "spark/render/Format.h"
8#include "spark/math/Vector2.h"
10namespace spark::render
30 [[nodiscard]] virtual
unsigned int buffers() const noexcept = 0;
36 [[nodiscard]] virtual math::Vector2<
unsigned int> renderArea() const noexcept = 0;
45 [[nodiscard]] virtual const
IImage* image(
unsigned int back_buffer) const = 0;
51 [[nodiscard]] std::vector<const
IImage*> images() const noexcept {
return genericImages(); }
63 [[nodiscard]]
virtual std::vector<Format>
surfaceFormats() const noexcept = 0;
78 virtual
void reset(Format surface_format, math::Vector2<
unsigned int> render_area,
unsigned int buffers) noexcept = 0;
84 [[nodiscard]] virtual
unsigned int swapBackBuffer() const noexcept = 0;
89 [[nodiscard]] virtual std::vector<const
IImage*> genericImages() const noexcept = 0;
90 virtual
void genericPresent(const
IFrameBuffer& frame_buffer) const noexcept = 0;
99 template <typename ImageType, typename FrameBufferType>
103 using image_type = ImageType;
104 using frame_buffer_type = FrameBufferType;
108 [[nodiscard]]
virtual std::vector<const image_type*>
images() const noexcept = 0;
111 virtual
void present(const frame_buffer_type& frame_buffer) const noexcept = 0;
114 [[nodiscard]] std::vector<const
IImage*> genericImages() const noexcept final
117 std::vector<const IImage*> images_vector;
118 images_vector.reserve(tmp.size());
119 std::ranges::transform(tmp, std::back_inserter(images_vector), [](
const auto& image) {
return static_cast<const IImage*
>(image); });
120 return images_vector;
123 void genericPresent(
const IFrameBuffer& frame_buffer)
const noexcept final { present(
static_cast<const frame_buffer_type&
>(frame_buffer)); }
Interface for a frame buffer.
Definition FrameBuffer.h:17
Interface for a swap chain, a chain of multiple IImage instances that can be presented using a ISurfa...
Definition SwapChain.h:16
virtual Format surfaceFormat() const noexcept=0
Gets the swap chain's surface format.
void present(const IFrameBuffer &frame_buffer) const noexcept
Queues a present that gets executed after frame_buffer signals that it's done rendering.
Definition SwapChain.h:57
virtual std::vector< Format > surfaceFormats() const noexcept=0
Gets all the swap chain's supported surface formats.
Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurfa...
Definition SwapChain.h:101
virtual std::vector< const image_type * > images() const noexcept=0
Gets all the swap chain's images.