44 vk::SurfaceKHR intrinsic;
46 vk::SwapchainKHR swapchain;
48 static constexpr uint32_t defaultNumberOfSwapchainImages = 2;
50 int nrSwapchainImages;
51 vk::Extent2D swapchainImageExtent;
52 vk::SurfaceFormatKHR swapchainImageFormat;
55 static const vk::Format depthImageFormat = vk::Format::eD32Sfloat;
56 VmaAllocation depthImageAllocation;
58 vk::ImageView depthImageView;
60 static const vk::Format colorImageFormat = vk::Format::eR16G16B16A16Sfloat;
66 vk::RenderPass renderPass;
68 vk::CommandBuffer commandBuffer;
70 vk::Semaphore imageAvailableSemaphore;
71 vk::Semaphore renderFinishedSemaphore;
72 vk::Fence renderFinishedFence;
100 void teardown() override;
108 std::optional<uint32_t> acquireNextImageFromSwapchain();
109 void presentImageToQueue(uint32_t frameBufferIndex, vk::Semaphore renderFinishedSemaphore);
112 void submitCommandBuffer();
114 bool readSurfaceExtent(
extent2 minimum_size,
extent2 maximum_size);
115 bool checkSurfaceExtent();
118 void buildSemaphores();
119 void teardownSemaphores();
120 gfx_surface_state buildSwapchain();
121 void teardownSwapchain();
122 void buildCommandBuffers();
123 void teardownCommandBuffers();
124 void buildRenderPasses();
125 void teardownRenderPasses();
126 void buildFramebuffers();
127 void teardownFramebuffers();
128 void buildPipelines();
129 void teardownPipelines();
131 void teardownSurface();
132 void teardownDevice();
135 std::tuple<uint32_t, vk::Extent2D> getImageCountAndExtent();