diff options
Diffstat (limited to 'src/blucat/renderer.cpp')
-rw-r--r-- | src/blucat/renderer.cpp | 16 |
1 files changed, 12 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() { |