]> git.tdb.fi Git - libs/gl.git/blob - source/backends/vulkan/swapchain.h
Initial implementation of Vulkan backend
[libs/gl.git] / source / backends / vulkan / swapchain.h
1 #ifndef MSP_GL_VULKAN_SWAPCHAIN_H_
2 #define MSP_GL_VULKAN_SWAPCHAIN_H_
3
4 #include "handles.h"
5 #include "swapchaintexture.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Device;
11 class Semaphore;
12
13 class SwapChain
14 {
15         friend class VulkanCommands;
16
17 private:
18         Device &device;
19         VkSwapchain handle = 0;
20         VkSurface surface = 0;
21         unsigned width = 0;
22         unsigned height = 0;
23         std::vector<SwapChainTexture> images;
24         int current_index = -1;
25
26 public:
27         SwapChain(unsigned, unsigned, unsigned);
28         ~SwapChain();
29
30         unsigned get_n_images() const { return images.size(); }
31         SwapChainTexture &get_image(unsigned i) { return images[i]; }
32
33         unsigned begin_frame(Semaphore &);
34         void present_frame(Semaphore &);
35 };
36
37 } // namespace GL
38 } // namespace Msp
39
40 #endif