SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
VulkanSwapChain.h
1#pragma once
2
3#include "spark/render/SwapChain.h"
4#include "spark/render/Format.h"
5#include "spark/render/vk/Export.h"
6#include "spark/render/vk/Helpers.h"
7#include "spark/render/vk/VulkanFrameBuffer.h"
8#include "spark/render/vk/VulkanImage.h"
9
10#include "spark/math/Vector2.h"
11
12SPARK_FWD_DECLARE_VK_HANDLE(VkSemaphore)
13
14namespace spark::render::vk
15{
16 class VulkanDevice;
17
21 class SPARK_RENDER_VK_EXPORT VulkanSwapChain final : public SwapChain<IVulkanImage, VulkanFrameBuffer>
22 {
23 public:
31 explicit VulkanSwapChain(const VulkanDevice& device,
32 Format surface_format = Format::B8G8R8A8_SRGB,
33 const math::Vector2<unsigned>& render_area = {1280, 720},
34 unsigned buffers = 3);
35 ~VulkanSwapChain() override;
36
37 VulkanSwapChain(const VulkanSwapChain& other) = delete;
38 VulkanSwapChain(VulkanSwapChain&& other) noexcept = delete;
39 VulkanSwapChain& operator=(const VulkanSwapChain& other) = delete;
40 VulkanSwapChain& operator=(VulkanSwapChain&& other) noexcept = delete;
41
46 [[nodiscard]] const VkSemaphore& semaphore() const noexcept;
47
49 [[nodiscard]] unsigned buffers() const noexcept override;
50
52 [[nodiscard]] math::Vector2<unsigned> renderArea() const noexcept override;
53
55 [[nodiscard]] Format surfaceFormat() const noexcept override;
56
58 [[nodiscard]] std::vector<Format> surfaceFormats() const noexcept override;
59
61 void reset(Format surface_format, math::Vector2<unsigned> render_area, unsigned buffers) noexcept override;
62
64 [[nodiscard]] unsigned swapBackBuffer() const noexcept override;
65
67 [[nodiscard]] std::vector<const IVulkanImage*> images() const noexcept override;
68
70 [[nodiscard]] const IVulkanImage* image(unsigned back_buffer) const override;
71
73 void present(const VulkanFrameBuffer& frame_buffer) const noexcept override;
74
75 private:
76 struct Impl;
77 std::unique_ptr<Impl> m_impl;
78 };
79}
A vector with two components.
Definition Vector2.h:13
Represents a swap chain, i.e. a chain of multiple IImage instances, that can be presented to a ISurfa...
Definition SwapChain.h:101
Represents a Vulkan image.
Definition VulkanImage.h:33
Vulkan implementation of IGraphicsDevice.
Definition VulkanDevice.h:25
Vulkan implementation of IFrameBuffer.
Definition VulkanFrameBuffer.h:21
Vulkan implementation of ISwapChain.
Definition VulkanSwapChain.h:22
Definition VulkanSwapChain.cpp:13