41 vk::SurfaceKHR intrinsic;
43 vk::SwapchainKHR swapchain;
45 static constexpr uint32_t defaultNumberOfSwapchainImages = 2;
47 int nrSwapchainImages;
48 vk::Extent2D swapchainImageExtent;
49 vk::SurfaceFormatKHR swapchainImageFormat;
52 static const vk::Format depthImageFormat = vk::Format::eD32Sfloat;
53 VmaAllocation depthImageAllocation;
55 vk::ImageView depthImageView;
57 static const vk::Format colorImageFormat = vk::Format::eR16G16B16A16Sfloat;
63 vk::RenderPass renderPass;
65 vk::CommandBuffer commandBuffer;
67 vk::Semaphore imageAvailableSemaphore;
68 vk::Semaphore renderFinishedSemaphore;
69 vk::Fence renderFinishedFence;
96 void teardown() override;
97 void build() override;
100 std::optional<uint32_t> acquireNextImageFromSwapchain();
101 void presentImageToQueue(uint32_t frameBufferIndex, vk::Semaphore renderFinishedSemaphore);
104 void submitCommandBuffer();
106 bool readSurfaceExtent();
107 bool checkSurfaceExtent();
110 void buildSemaphores();
111 void teardownSemaphores();
112 gui_window_state buildSwapchain();
113 void teardownSwapchain();
114 void buildCommandBuffers();
115 void teardownCommandBuffers();
116 void buildRenderPasses();
117 void teardownRenderPasses();
118 void buildFramebuffers();
119 void teardownFramebuffers();
120 void buildPipelines();
121 void teardownPipelines();
123 void teardownSurface();
124 void teardownDevice();
127 std::tuple<uint32_t, vk::Extent2D> getImageCountAndExtent();