summaryrefslogtreecommitdiff
path: root/src/vulkan_swapchain.h
blob: 99405b680647b62000cdec71f8ebb16e10873d6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "imgui_impl_glfw.h"
#include "imgui_impl_vulkan.h"
#include "vulkan_helper.h"
#include "vulkan/vulkan_core.h"
#include <cstdint>
#include <sys/types.h>
#include <vector>
#include <string>

std::vector<std::string> get_glfw_instance_extensions();

namespace iris {

struct Swapchain {
    iris::Device device;

    VkSurfaceKHR surface = VK_NULL_HANDLE;
    VkSwapchainKHR swapchain = VK_NULL_HANDLE;
    VkRenderPass render_pass = VK_NULL_HANDLE;
    VkDescriptorPool descriptor_pool = VK_NULL_HANDLE;
    GLFWwindow *window = nullptr;
    uint32_t width = -1;
    uint32_t height = -1;
    
    static constexpr uint32_t SWAPCHAIN_IMAGE_COUNT = 3;
    VkImage swapchain_images[SWAPCHAIN_IMAGE_COUNT];
    VkImageView swapchain_image_views[SWAPCHAIN_IMAGE_COUNT];
    VkFramebuffer framebuffers[SWAPCHAIN_IMAGE_COUNT];

    Swapchain(GLFWwindow *window, iris::Device device);
    ~Swapchain();
};

} // namespace iris