33 vk::SurfaceKHR intrinsic;
35 vk::SwapchainKHR swapchain;
37 static constexpr uint32_t defaultNumberOfSwapchainImages = 2;
39 int nrSwapchainImages;
40 vk::Extent2D swapchainImageExtent;
41 vk::SurfaceFormatKHR swapchainImageFormat;
47 static const vk::Format depthImageFormat = vk::Format::eD32Sfloat;
48 VmaAllocation depthImageAllocation;
50 vk::ImageView depthImageView;
52 static const vk::Format colorImageFormat = vk::Format::eR16G16B16A16Sfloat;
58 vk::RenderPass renderPass;
60 vk::CommandBuffer commandBuffer;
62 vk::Semaphore imageAvailableSemaphore;
63 vk::Semaphore renderFinishedSemaphore;
64 vk::Fence renderFinishedFence;
91 void teardown() override;
92 void build() override;
95 std::optional<uint32_t> acquireNextImageFromSwapchain();
96 void presentImageToQueue(uint32_t frameBufferIndex, vk::Semaphore renderFinishedSemaphore);
98 void fillCommandBuffer(vk::Framebuffer frameBuffer,
aarect scissor_rectangle);
99 void submitCommandBuffer();
101 bool readSurfaceExtent();
102 bool checkSurfaceExtent();
105 void buildSemaphores();
106 void teardownSemaphores();
107 gui_window_state buildSwapchain();
108 void teardownSwapchain();
109 void buildCommandBuffers();
110 void teardownCommandBuffers();
111 void buildRenderPasses();
112 void teardownRenderPasses();
113 void buildFramebuffers();
114 void teardownFramebuffers();
115 void buildPipelines();
116 void teardownPipelines();
118 void teardownSurface();
119 void teardownDevice();
122 std::tuple<uint32_t, vk::Extent2D> getImageCountAndExtent();