Handle error when setting boot image if swap chain is not available. Skip resizing swap chain during screen creation as it's not necessary and can fail when it starts minimized.
This commit is contained in:
parent
e92d55bbf4
commit
fc8ec5d8a9
|
@ -169,7 +169,11 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
|
|||
return;
|
||||
}
|
||||
|
||||
RD::get_singleton()->screen_prepare_for_drawing(DisplayServer::MAIN_WINDOW_ID);
|
||||
Error err = RD::get_singleton()->screen_prepare_for_drawing(DisplayServer::MAIN_WINDOW_ID);
|
||||
if (err != OK) {
|
||||
// Window is minimized and does not have valid swapchain, skip drawing without printing errors.
|
||||
return;
|
||||
}
|
||||
|
||||
RID texture = texture_storage->texture_allocate();
|
||||
texture_storage->texture_2d_initialize(texture, p_image);
|
||||
|
|
|
@ -3164,9 +3164,6 @@ Error RenderingDevice::screen_create(DisplayServer::WindowID p_screen) {
|
|||
RDD::SwapChainID swap_chain = driver->swap_chain_create(surface);
|
||||
ERR_FAIL_COND_V_MSG(swap_chain.id == 0, ERR_CANT_CREATE, "Unable to create swap chain.");
|
||||
|
||||
Error err = driver->swap_chain_resize(main_queue, swap_chain, _get_swap_chain_desired_count());
|
||||
ERR_FAIL_COND_V_MSG(err != OK, ERR_CANT_CREATE, "Unable to resize the new swap chain.");
|
||||
|
||||
screen_swap_chains[p_screen] = swap_chain;
|
||||
|
||||
return OK;
|
||||
|
|
Loading…
Reference in New Issue