Skip to content

Commit

Permalink
Merge pull request #88289 from DarioSamo/rd_minimized_window
Browse files Browse the repository at this point in the history
Fix swap chain errors when application starts minimized.
  • Loading branch information
akien-mga committed May 17, 2024
2 parents f4b047a + fc8ec5d commit d3e2615
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion servers/rendering/renderer_rd/renderer_compositor_rd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions servers/rendering/rendering_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d3e2615

Please sign in to comment.