41 vk::SurfaceKHR intrinsic;
43 vk::SwapchainKHR swapchain;
45 static constexpr uint32_t defaultNumberOfSwapchainImages = 2;
47 uint32_t 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;
97 void teardown() override;
105 std::optional<uint32_t> acquireNextImageFromSwapchain();
106 void presentImageToQueue(uint32_t frameBufferIndex, vk::Semaphore renderFinishedSemaphore);
109 void submitCommandBuffer();
111 bool readSurfaceExtent(
extent2 minimum_size,
extent2 maximum_size);
112 bool checkSurfaceExtent();
115 void buildSemaphores();
116 void teardownSemaphores();
117 gfx_surface_state buildSwapchain(
size_t new_count,
extent2 new_size);
118 void teardownSwapchain();
119 void buildCommandBuffers();
120 void teardownCommandBuffers();
121 void buildRenderPasses();
122 void teardownRenderPasses();
123 void buildFramebuffers();
124 void teardownFramebuffers();
125 void buildPipelines();
126 void teardownPipelines();
128 void teardownSurface();
129 void teardownDevice();
141 std::tuple<
size_t,
extent2> get_image_count_and_size(
size_t new_count,
extent2 new_size);