Assert in SwapchainBuilder on queue getting failure

This resolves the TODO about what to do if the queues couldn't be found.
This commit is contained in:
Charles Giessen 2021-04-23 15:41:10 -06:00 committed by Charles Giessen
parent 84ba7a79ee
commit 70265d8b29

View File

@ -1607,7 +1607,7 @@ SwapchainBuilder::SwapchainBuilder(Device const& device) {
info.surface = device.surface; info.surface = device.surface;
auto present = device.get_queue_index(QueueType::present); auto present = device.get_queue_index(QueueType::present);
auto graphics = device.get_queue_index(QueueType::graphics); auto graphics = device.get_queue_index(QueueType::graphics);
// TODO: handle error of queue's not available assert(graphics.has_value() && present.has_value() && "Graphics and Present queue indexes must be valid");
info.graphics_queue_index = present.value(); info.graphics_queue_index = present.value();
info.present_queue_index = graphics.value(); info.present_queue_index = graphics.value();
info.allocation_callbacks = device.allocation_callbacks; info.allocation_callbacks = device.allocation_callbacks;
@ -1620,7 +1620,7 @@ SwapchainBuilder::SwapchainBuilder(Device const& device, VkSurfaceKHR const surf
temp_device.surface = surface; temp_device.surface = surface;
auto present = temp_device.get_queue_index(QueueType::present); auto present = temp_device.get_queue_index(QueueType::present);
auto graphics = temp_device.get_queue_index(QueueType::graphics); auto graphics = temp_device.get_queue_index(QueueType::graphics);
// TODO: handle error of queue's not available assert(graphics.has_value() && present.has_value() && "Graphics and Present queue indexes must be valid");
info.graphics_queue_index = present.value(); info.graphics_queue_index = present.value();
info.present_queue_index = graphics.value(); info.present_queue_index = graphics.value();
info.allocation_callbacks = device.allocation_callbacks; info.allocation_callbacks = device.allocation_callbacks;