From 2ead02037dc89e987fbc0a021fe470e29d226cfd Mon Sep 17 00:00:00 2001 From: Chuyan Zhang Date: Sat, 7 Sep 2024 00:40:38 -0700 Subject: Add more encapsulation, use VMA for allocation --- src/vulkan_swapchain.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/vulkan_swapchain.h') diff --git a/src/vulkan_swapchain.h b/src/vulkan_swapchain.h index 99405b6..509753f 100644 --- a/src/vulkan_swapchain.h +++ b/src/vulkan_swapchain.h @@ -1,5 +1,4 @@ #include "imgui_impl_glfw.h" -#include "imgui_impl_vulkan.h" #include "vulkan_helper.h" #include "vulkan/vulkan_core.h" #include @@ -12,7 +11,7 @@ std::vector get_glfw_instance_extensions(); namespace iris { struct Swapchain { - iris::Device device; + Device device; VkSurfaceKHR surface = VK_NULL_HANDLE; VkSwapchainKHR swapchain = VK_NULL_HANDLE; @@ -21,12 +20,16 @@ struct Swapchain { GLFWwindow *window = nullptr; uint32_t width = -1; uint32_t height = -1; + bool needs_recreate = false; 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]; + Texture2D upload_texture; + + void resize(uint32_t new_width, uint32_t new_height); Swapchain(GLFWwindow *window, iris::Device device); ~Swapchain(); }; -- cgit v1.2.3-70-g09d2