diff options
author | Chuyan Zhang <me@zcy.moe> | 2024-09-06 01:50:30 -0700 |
---|---|---|
committer | Chuyan Zhang <me@zcy.moe> | 2024-09-06 01:50:30 -0700 |
commit | e12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0 (patch) | |
tree | 1e7803cbdd48b8a2de355916f042f7b77325f920 /src/vulkan_swapchain.h | |
parent | 8c7926588b616988e7b016eaf704acee0ee77cc9 (diff) | |
download | iris-e12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0.tar.gz iris-e12ca33626bdadedc3158cb69f2a4d2f9bbeeeb0.zip |
setup swapchain
Diffstat (limited to 'src/vulkan_swapchain.h')
-rw-r--r-- | src/vulkan_swapchain.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/vulkan_swapchain.h b/src/vulkan_swapchain.h new file mode 100644 index 0000000..99405b6 --- /dev/null +++ b/src/vulkan_swapchain.h @@ -0,0 +1,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
\ No newline at end of file |