mirror of https://github.com/snes9xgit/snes9x.git
Vulkan: Remove exception handler/old swapchain use.
Exceptions are now turned off anyway.
This commit is contained in:
parent
c7b77d4a76
commit
4f1a2d9c29
|
@ -164,11 +164,21 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
extents.height = surface_capabilities.minImageExtent.height;
|
||||
|
||||
auto present_modes = physical_device.getSurfacePresentModesKHR(surface).value;
|
||||
auto tearing_present_mode = vk::PresentModeKHR::eFifo;
|
||||
if (std::find(present_modes.begin(), present_modes.end(), vk::PresentModeKHR::eImmediate) != present_modes.end())
|
||||
tearing_present_mode = vk::PresentModeKHR::eImmediate;
|
||||
if (std::find(present_modes.begin(), present_modes.end(), vk::PresentModeKHR::eMailbox) != present_modes.end())
|
||||
tearing_present_mode = vk::PresentModeKHR::eMailbox;
|
||||
bool mailbox_supported =
|
||||
std::find(present_modes.begin(), present_modes.end(),
|
||||
vk::PresentModeKHR::eMailbox) != present_modes.end();
|
||||
bool immediate_supported =
|
||||
std::find(present_modes.begin(), present_modes.end(),
|
||||
vk::PresentModeKHR::eImmediate) != present_modes.end();
|
||||
|
||||
vk::PresentModeKHR present_mode = vk::PresentModeKHR::eFifo;
|
||||
if (mailbox_supported)
|
||||
present_mode = vk::PresentModeKHR::eMailbox;
|
||||
if (!vsync && immediate_supported)
|
||||
present_mode = vk::PresentModeKHR::eImmediate;
|
||||
|
||||
if (present_mode == vk::PresentModeKHR::eMailbox)
|
||||
num_swapchain_images++;
|
||||
|
||||
auto swapchain_create_info = vk::SwapchainCreateInfoKHR{}
|
||||
.setMinImageCount(num_swapchain_images)
|
||||
|
@ -179,23 +189,20 @@ bool Swapchain::create(unsigned int desired_num_swapchain_images, int new_width,
|
|||
.setImageUsage(vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eTransferSrc)
|
||||
.setCompositeAlpha(vk::CompositeAlphaFlagBitsKHR::eOpaque)
|
||||
.setClipped(true)
|
||||
.setPresentMode(vsync ? vk::PresentModeKHR::eFifo : tearing_present_mode)
|
||||
.setPresentMode(present_mode)
|
||||
.setSurface(surface)
|
||||
.setPreTransform(vk::SurfaceTransformFlagBitsKHR::eIdentity)
|
||||
.setImageArrayLayers(1)
|
||||
.setQueueFamilyIndices(graphics_queue_index);
|
||||
|
||||
if (swapchain_object)
|
||||
swapchain_create_info.setOldSwapchain(swapchain_object.get());
|
||||
|
||||
try {
|
||||
swapchain_object = device.createSwapchainKHRUnique(swapchain_create_info).value;
|
||||
} catch (std::exception &e) {
|
||||
swapchain_object.reset();
|
||||
}
|
||||
|
||||
if (!swapchain_object)
|
||||
auto resval = device.createSwapchainKHRUnique(swapchain_create_info);
|
||||
if (resval.result != vk::Result::eSuccess && resval.result != vk::Result::eSuboptimalKHR)
|
||||
{
|
||||
swapchain_object.reset();
|
||||
return false;
|
||||
}
|
||||
swapchain_object = std::move(resval.value);
|
||||
|
||||
auto swapchain_images = device.getSwapchainImagesKHR(swapchain_object.get()).value;
|
||||
vk::CommandBufferAllocateInfo command_buffer_allocate_info(command_pool, vk::CommandBufferLevel::ePrimary, swapchain_images.size());
|
||||
|
|
Loading…
Reference in New Issue