Allocate and present separate top/bottom screen framebuffer images

Instead of operating directly on the swapchain images, we have our own
top/bottom framebuffer images that will be rendered to independent of
having an available swapchain. The images are blitted into the swapchain
images, allowing for resizing too!
This commit is contained in:
Wunkolo 2023-07-25 22:00:37 -07:00
parent d0832ca558
commit e3699fe8f8
5 changed files with 354 additions and 15 deletions

View file

@ -37,6 +37,8 @@ class RendererVK final : public Renderer {
// Todo: make this a configuration option
static constexpr usize frameBufferingCount = 3;
vk::UniqueDeviceMemory framebufferMemory = {};
// Frame-buffering data
// Each vector is `frameBufferingCount` in size
std::vector<vk::UniqueCommandBuffer> frameCommandBuffers = {};
@ -44,6 +46,9 @@ class RendererVK final : public Renderer {
std::vector<vk::UniqueSemaphore> renderFinishedSemaphore = {};
std::vector<vk::UniqueFence> frameFinishedFences = {};
std::vector<vk::UniqueImage> topScreenImages = {};
std::vector<vk::UniqueImage> bottomScreenImages = {};
// Recreate the swapchain, possibly re-using the old one in the case of a resize
vk::Result recreateSwapchain(vk::SurfaceKHR surface, vk::Extent2D swapchainExtent);