Merge pull request #43531 from bruvzg/x11_fix_vlk_init_crash

Fixes crash if Vulkan presentation surface is not available.
This commit is contained in:
Rémi Verschelde 2020-11-14 13:33:36 +01:00 committed by GitHub
commit dd5485142f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -707,7 +707,8 @@ Error VulkanContext::_window_create(DisplayServer::WindowID p_window_id, VkSurfa
// We use a single GPU, but we need a surface to initialize the // We use a single GPU, but we need a surface to initialize the
// queues, so this process must be deferred until a surface // queues, so this process must be deferred until a surface
// is created. // is created.
_initialize_queues(p_surface); Error err = _initialize_queues(p_surface);
ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
} }
Window window; Window window;

View file

@ -3852,6 +3852,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
(screen_get_size(0).width - p_resolution.width) / 2, (screen_get_size(0).width - p_resolution.width) / 2,
(screen_get_size(0).height - p_resolution.height) / 2); (screen_get_size(0).height - p_resolution.height) / 2);
WindowID main_window = _create_window(p_mode, p_flags, Rect2i(window_position, p_resolution)); WindowID main_window = _create_window(p_mode, p_flags, Rect2i(window_position, p_resolution));
if (main_window == INVALID_WINDOW_ID) {
r_error = ERR_CANT_CREATE;
return;
}
for (int i = 0; i < WINDOW_FLAG_MAX; i++) { for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
if (p_flags & (1 << i)) { if (p_flags & (1 << i)) {
window_set_flag(WindowFlags(i), true, main_window); window_set_flag(WindowFlags(i), true, main_window);