godot icon indicating copy to clipboard operation
godot copied to clipboard

Godot renders a black screen when running a project with vulkan + rendering/driver/threads/thread_model = multi-threaded

Open matheusmdx opened this issue 4 months ago • 3 comments

Tested versions

Reproducible in latest master v4.4.dev.custom_build [1435247de] Not reproducible in v4.4.dev3.official [f4af8201b]

System information

Godot v4.4.dev (1435247de) - Windows 10.0.19045 - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 580 2048SP (Advanced Micro Devices, Inc.; 31.0.21921.1000) - AMD Ryzen 5 3600 6-Core Processor (12 threads)

Issue description

This is a regression from pr #90400, after that running any project using vulkan (forward or mobile) and multi-thread in rendering makes godot run a black screen and spam these errors:

ERROR: This function (buffer_update) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:472)
ERROR: This function (draw_list_begin) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:3978)
ERROR: This function (draw_list_end) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:4524)
ERROR: This function (draw_list_begin_for_screen) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:3802)
ERROR: Condition "draw_list == RD::INVALID_ID" is true.
   at: RendererCompositorRD::blit_render_targets_to_screen (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/renderer_rd/renderer_compositor_rd.cpp:44)
ERROR: This function (swap_buffers) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:5629)
ERROR: This function (get_captured_timestamps_count) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:6344)
ERROR: This function (get_captured_timestamps_frame) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:6349)
ERROR: This function (free) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:5407)
ERROR: This function (texture_is_valid) can only be called from the render thread.
   at: (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/rendering_device.cpp:1867)

Closing the game will also spam a lot of rid's that leaked and sometimes crash with this backtrace:

ERROR: At exit: 1 framebuffer cache instance(s) still in use.
   at: FramebufferCacheRD::~FramebufferCacheRD (C:\Users\Matheus\Downloads\Godot Source\servers/rendering/renderer_rd/framebuffer_cache_rd.cpp:85)
ERROR: Pages in use exist at exit in PagedAllocator: struct FramebufferCacheRD::Cache
   at: PagedAllocator<struct FramebufferCacheRD::Cache,0,4096>::~PagedAllocator (C:\Users\Matheus\Downloads\Godot Source\core/templates/paged_allocator.h:170)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.4.dev.custom_build (e2c6daf7eff6e0b7e2e8d967e95a9ad56e948231)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] PagedAllocator<FramebufferCacheRD::Cache,0,4096>::free (C:\Users\Matheus\Downloads\Godot Source\core\templates\paged_allocator.h:91)
[1] FramebufferCacheRD::_invalidate (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\renderer_rd\framebuffer_cache_rd.cpp:53)
[2] FramebufferCacheRD::_framebuffer_invalidation_callback (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\renderer_rd\framebuffer_cache_rd.cpp:57)
[3] RenderingDevice::_free_internal (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\rendering_device.cpp:5453)
[4] RenderingDevice::free (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\rendering_device.cpp:5411)
[5] RenderingDevice::_free_rids<RID_Owner<RenderingDevice::Framebuffer,1> > (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\rendering_device.cpp:6193)
[6] RenderingDevice::finalize (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\rendering_device.cpp:6402)
[7] RenderingDevice::~RenderingDevice (C:\Users\Matheus\Downloads\Godot Source\servers\rendering\rendering_device.cpp:7231)
[8] RenderingDevice::`scalar deleting destructor'
[9] memdelete<RenderingDevice> (C:\Users\Matheus\Downloads\Godot Source\core\os\memory.h:143)
[10] DisplayServerWindows::~DisplayServerWindows (C:\Users\Matheus\Downloads\Godot Source\platform\windows\display_server_windows.cpp:6547)
[11] DisplayServerWindows::`scalar deleting destructor'
[12] memdelete<DisplayServer> (C:\Users\Matheus\Downloads\Godot Source\core\os\memory.h:143)
[13] finalize_display (C:\Users\Matheus\Downloads\Godot Source\main\main.cpp:371)
[14] Main::cleanup (C:\Users\Matheus\Downloads\Godot Source\main\main.cpp:4612)
[15] widechar_main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:186)
[16] _main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:206)
[17] main (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:220)
[18] WinMain (C:\Users\Matheus\Downloads\Godot Source\platform\windows\godot_windows.cpp:234)
[19] __scrt_common_main_seh (D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
[20] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

CC @DarioSamo

Steps to reproduce

Just run any project in a build that includes pr #90400 with rendering/driver/threads/thread_model = multi-threaded and vulkan (forward or mobile)

Minimal reproduction project (MRP)

N/A

matheusmdx avatar Oct 18 '24 03:10 matheusmdx