31 vk::SurfaceKHR intrinsic;
33 vk::SwapchainKHR swapchain;
35 int nrSwapchainImages;
36 vk::Extent2D swapchainImageExtent;
37 vk::SurfaceFormatKHR swapchainImageFormat;
42 static const vk::Format depthImageFormat = vk::Format::eD32Sfloat;
43 VmaAllocation depthImageAllocation;
45 vk::ImageView depthImageView;
47 static const vk::Format colorImageFormat = vk::Format::eR16G16B16A16Sfloat;
48 VmaAllocation colorImageAllocation;
50 vk::ImageView colorImageView;
51 vk::DescriptorImageInfo colorDescriptorImageInfo;
53 vk::RenderPass renderPass;
55 vk::CommandBuffer commandBuffer;
57 vk::Semaphore imageAvailableSemaphore;
58 vk::Semaphore renderFinishedSemaphore;
59 vk::Fence renderFinishedFence;
75 void initialize()
override;
79 void teardown()
override;
80 void build()
override;
84 virtual vk::SurfaceKHR getSurface()
const = 0;
87 std::optional<uint32_t> acquireNextImageFromSwapchain();
88 void presentImageToQueue(uint32_t frameBufferIndex, vk::Semaphore renderFinishedSemaphore);
90 void fillCommandBuffer(vk::Framebuffer frameBuffer);
91 void submitCommandBuffer();
93 bool readSurfaceExtent();
94 bool checkSurfaceExtent();
97 void buildSemaphores();
98 void teardownSemaphores();
99 State buildSwapchain();
100 void teardownSwapchain();
101 void buildCommandBuffers();
102 void teardownCommandBuffers();
103 void buildRenderPasses();
104 void teardownRenderPasses();
105 void buildFramebuffers();
106 void teardownFramebuffers();
107 void buildPipelines();
108 void teardownPipelines();
110 void teardownSurface();
111 void teardownDevice();