SimpleGL  1.1.0
A framework for platform independent rendering
swapchain.hpp
Go to the documentation of this file.
1 
8 #ifndef SWAPCHAIN_HPP
9 #define SWAPCHAIN_HPP
10 
11 #include <SimpleGL_vk/SimpleGL_vk_Export.h>
12 
13 #include <vector>
14 
15 #include <vulkan/vulkan.h>
16 
17 #include <glm/glm.hpp>
18 
19 #include "surface.hpp"
20 
21 namespace sgl {
22 
28  struct SwapchainData {
29 
31  std::vector<VkImage> images;
32 
34  std::vector<VkImageView> imageViews;
35 
37  VkFormat imageFormat;
38 
40  VkExtent2D extent;
41 
43  uint32_t index;
44  };
45 
51  class SIMPLEGL_VK_EXPORT Swapchain {
52 
53  private:
55  VkSwapchainKHR handle;
56 
58  SwapchainData swapchainData;
59 
60  public:
67  Swapchain(Surface* surface, glm::ivec2 size);
68 
70  ~Swapchain(void);
71 
77  VkSwapchainKHR getHandle();
78 
84  SwapchainData getSwapchainData();
85 
87  void acquireNextImage();
88 
90  void present();
91  };
92 }
93 
94 #endif /* SWAPCHAIN_HPP */
std::vector< VkImage > images
The available swapchain images.
Definition: swapchain.hpp:31
Generic namespace for the SimpleGL framework.
Definition: application.hpp:18
VkExtent2D extent
The swapchain extent.
Definition: swapchain.hpp:40
This struct stores relevant swapchain data.
Definition: swapchain.hpp:28
This class wraps a Vulkan swapchain.
Definition: swapchain.hpp:51
std::vector< VkImageView > imageViews
The image views for the swapchain images.
Definition: swapchain.hpp:34
VkFormat imageFormat
The swapchain image format.
Definition: swapchain.hpp:37
This class wraps a Vulkan surface.
Definition: surface.hpp:25
uint32_t index
The current swapchain image index.
Definition: swapchain.hpp:43