Skip to content

Crash and/or big stutter/freeze when reloading scene with multiple meshes and lights #82576

Closed
@eldidou

Description

@eldidou

Godot version

4.2.dev5

System information

Godot v4.2.dev5 - Ubuntu 22.04.3 LTS 22.04 - X11 - Vulkan (Forward+) - integrated Intel(R) UHD Graphics (CML GT2) () - Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz (12 Threads)

Issue description

When reloading a scene that instantiates multiple lights and meshes at startup, the game will freeze for a long time, and in some cases it will also crash.

I works well the first time the scene is loaded during the startup, it's only when reload_current_scene() or change_scene_to_file() is called that the issue is triggered. The (re)loading itself seems fast, but 2~3 frames later there will be a freeze (and possibly a crash).

If shadows are enabled on the lights the freeze is longer and there is no crash.
If shadows are disabled there is a crash:

ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2429)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2429)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2429)

The freeze time grows linearly with the the number of meshes multiplied by the number of lights.

  • 20 lights, 50 meshes: 1.77s
  • 20 lights, 100 meshes: 3.51s
  • 40 lights, 50 meshes: 3.34s
  • 40 lights, 100 meshes: 6.64s

It doesn't happen with all meshes, for some it will have no freeze of crash whatsoever. The minimal project contains two meshes, one that triggers the issue, one that doesn't, they are the same simple mesh, just slightly translated.

It happens only in 4.2, not in 4.1. I've also tried with this commit #80566, but the issue still happens.

Steps to reproduce

  • create a scene that instantiates ~20 OmniLight3D and ~50 mesh model, during the _ready() of the scene.
  • display the time for each frame
  • Launch the scene
  • call reload_current_scene with a key press

The second loading of the scene (with reload_current_scene) triggers the freeze/crash.

Minimal reproduction project

light_model_instantiate_issue.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions