From cab146ac450b0cac43ca89c8d839b45b4e185a9f Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 2 Jun 2022 12:41:29 +0200 Subject: [PATCH] hack in framebuffers --- framework/sdl_service/test/vulkan_test.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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; } };