Skip to content

Commit 2ecdd75

Browse files
committed
hack in framebuffers
1 parent 01d7366 commit 2ecdd75

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

framework/sdl_service/test/vulkan_test.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class VulkanRenderer : public Service {
159159
VkSwapchainKHR _swapchain{};
160160
std::vector<VkImage> _swapchain_images{};
161161
std::vector<VkImageView> _swapchain_image_views{};
162+
std::vector<VkFramebuffer> _swapchain_framebuffers{};
162163

163164
public:
164165
VulkanRenderer(void) {
@@ -218,6 +219,9 @@ class VulkanRenderer : public Service {
218219
if (_device) {
219220
vk::Device device{_device};
220221

222+
for (const auto& fb : _swapchain_framebuffers) {
223+
device.destroy(fb);
224+
}
221225
for (const auto& img_view : _swapchain_image_views) {
222226
device.destroy(img_view);
223227
}
@@ -405,6 +409,22 @@ class VulkanRenderer : public Service {
405409
}));
406410
}
407411

412+
// TODO: move
413+
414+
_swapchain_framebuffers.clear();
415+
for (const auto& img_view : _swapchain_image_views) {
416+
vk::ImageView tmp_img_view = img_view;
417+
_swapchain_framebuffers.push_back(device.createFramebuffer({
418+
{},
419+
{}, // rend
420+
1,
421+
&tmp_img_view,
422+
surface_extent.width,
423+
surface_extent.height,
424+
1
425+
}));
426+
}
427+
408428
return true;
409429
}
410430
};

0 commit comments

Comments
 (0)