Merge pull request #88289 from DarioSamo/rd_minimized_window

Fix swap chain errors when application starts minimized.
This commit is contained in:
Rémi Verschelde 2024-05-17 11:13:31 +02:00
commit d3e261523f
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -3154,9 +3154,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;