mirror of https://github.com/snes9xgit/snes9x.git
Vulkan/Gtk: Make instance creation fail more robust.
This commit is contained in:
parent
039e68d306
commit
e3f1790711
|
@ -124,11 +124,12 @@ int S9xVulkanDisplayDriver::init()
|
||||||
wayland_surface = std::make_unique<WaylandSurface>();
|
wayland_surface = std::make_unique<WaylandSurface>();
|
||||||
wl_surface *surface = gdk_wayland_window_get_wl_surface(drawing_area->get_window()->gobj());
|
wl_surface *surface = gdk_wayland_window_get_wl_surface(drawing_area->get_window()->gobj());
|
||||||
wl_display *display = gdk_wayland_display_get_wl_display(drawing_area->get_display()->gobj());
|
wl_display *display = gdk_wayland_display_get_wl_display(drawing_area->get_display()->gobj());
|
||||||
|
|
||||||
if (!wayland_surface->attach(display, surface, get_metrics(*drawing_area)))
|
if (!wayland_surface->attach(display, surface, get_metrics(*drawing_area)))
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
context->init_wayland(wayland_surface->display, wayland_surface->child, current_width, current_height);
|
if (!context->init_wayland(wayland_surface->display, wayland_surface->child, current_width, current_height))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (GDK_IS_X11_WINDOW(drawing_area->get_window()->gobj()))
|
if (GDK_IS_X11_WINDOW(drawing_area->get_window()->gobj()))
|
||||||
|
@ -136,7 +137,8 @@ int S9xVulkanDisplayDriver::init()
|
||||||
display = gdk_x11_display_get_xdisplay(drawing_area->get_display()->gobj());
|
display = gdk_x11_display_get_xdisplay(drawing_area->get_display()->gobj());
|
||||||
xid = gdk_x11_window_get_xid(drawing_area->get_window()->gobj());
|
xid = gdk_x11_window_get_xid(drawing_area->get_window()->gobj());
|
||||||
|
|
||||||
context->init_Xlib(display, xid);
|
if (!context->init_Xlib(display, xid))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
device = context->device;
|
device = context->device;
|
||||||
|
|
|
@ -63,7 +63,13 @@ static vk::UniqueInstance create_instance_preamble(const char *wsi_extension)
|
||||||
vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_0);
|
vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_0);
|
||||||
vk::InstanceCreateInfo instance_create_info({}, &application_info, {}, extensions);
|
vk::InstanceCreateInfo instance_create_info({}, &application_info, {}, extensions);
|
||||||
|
|
||||||
auto instance = vk::createInstanceUnique(instance_create_info);
|
vk::UniqueInstance instance;
|
||||||
|
try {
|
||||||
|
instance = vk::createInstanceUnique(instance_create_info);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
instance.reset();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(instance.get());
|
VULKAN_HPP_DEFAULT_DISPATCHER.init(instance.get());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue