diff --git a/framework/sdl_service/test/vulkan_test.cpp b/framework/sdl_service/test/vulkan_test.cpp index 4af9e78..6eed21f 100644 --- a/framework/sdl_service/test/vulkan_test.cpp +++ b/framework/sdl_service/test/vulkan_test.cpp @@ -159,6 +159,7 @@ class VulkanRenderer : public Service { VkSwapchainKHR _swapchain{}; std::vector _swapchain_images{}; std::vector _swapchain_image_views{}; + std::vector _swapchain_framebuffers{}; public: VulkanRenderer(void) { @@ -218,6 +219,9 @@ class VulkanRenderer : public Service { if (_device) { vk::Device device{_device}; + for (const auto& fb : _swapchain_framebuffers) { + device.destroy(fb); + } for (const auto& img_view : _swapchain_image_views) { device.destroy(img_view); } @@ -405,6 +409,22 @@ class VulkanRenderer : public Service { })); } + // TODO: move + + _swapchain_framebuffers.clear(); + for (const auto& img_view : _swapchain_image_views) { + vk::ImageView tmp_img_view = img_view; + _swapchain_framebuffers.push_back(device.createFramebuffer({ + {}, + {}, // rend + 1, + &tmp_img_view, + surface_extent.width, + surface_extent.height, + 1 + })); + } + return true; } };