diff options
-rw-r--r-- | src/blucat/renderer.cpp | 16 | ||||
-rw-r--r-- | src/blucat/renderer.hpp | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/blucat/renderer.cpp b/src/blucat/renderer.cpp index 5777203..18d3976 100644 --- a/src/blucat/renderer.cpp +++ b/src/blucat/renderer.cpp @@ -101,10 +101,7 @@ unload_command_pool(void *obj) { auto self = static_cast<BluCat::Renderer*>(obj); - vkWaitForFences(BluCat::core.vk_device_with_swapchain->device, - BluCat::Swapchain::max_frames_in_flight, - BluCat::core.vk_swapchain->in_flight_fences.data(), VK_TRUE, - std::numeric_limits<uint64_t>::max()); + self->wait_frame(); vkDestroyCommandPool( self->queue_family->device->device, self->command_pool, nullptr); } @@ -164,6 +161,17 @@ Renderer::~Renderer() loader.revert(this); } +// FIXME: this is a workaround to prevent a code to free some resource while +// it still being rendered. +void +Renderer::wait_frame() +{ + vkWaitForFences(BluCat::core.vk_device_with_swapchain->device, + BluCat::Swapchain::max_frames_in_flight, + BluCat::core.vk_swapchain->in_flight_fences.data(), VK_TRUE, + std::numeric_limits<uint64_t>::max()); +} + void Renderer::draw() { diff --git a/src/blucat/renderer.hpp b/src/blucat/renderer.hpp index 2da6ae9..55b0727 100644 --- a/src/blucat/renderer.hpp +++ b/src/blucat/renderer.hpp @@ -63,6 +63,9 @@ struct Renderer std::initializer_list<std::shared_ptr<View3D>> views_3d); ~Renderer(); + void + wait_frame(); + void draw(); }; |