Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game quits after rendering calls on main rendering device if multithreaded rendering is enabled #78786

Closed
joemarshall opened this issue Jun 28, 2023 · 1 comment · Fixed by #78794

Comments

@joemarshall
Copy link
Contributor

Godot version

v4.1.beta3.official [ada712e]

System information

Godot v4.1.beta3 - Windows 10.0.22621 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2080 with Max-Q Design (NVIDIA; 31.0.15.3161) - Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 Threads)

Issue description

I am using the main renderingdevice to do offscreen drawing to a texture. If I use the same code on a local rendering device created using RenderingServer.create_local_rendering_device(), it works fine, but the moment I do anything on the main rendering device (from RenderingServer.get_rendering_device() ), my code will run for one or two frames, then the game quits silently.

I've narrowed it down with a passthrough shader and no actual draw calls - just any call to draw_list_begin and draw_list_end, and it dies.

If you use single threaded renderingdevice, it works.

I feel like this is a good test of the stability of the vulkan multithreading ( see godotengine/godot-proposals#7163 ) - if we want to allow multithreaded use of a single renderingdevice, then this should work.

Steps to reproduce

Hit play on the project below. It will hopefully print out before, inside, after, then silently quit. Does on mine at least, on dev builds and on 4.1b3. If you set rendering to single-threaded (safe or unsafe), then it works happily.

Minimal reproduction project

crashtest.zip

@Calinou
Copy link
Member

Calinou commented Jun 28, 2023

I can confirm this on 4.1.dev d95b516 (Linux, GeForce RTX 4090 with NVIDIA 535.54.03).

Backtrace:

true
before
inside
after
before
inside
after
ERROR: Condition "draw_list_current_subpass >= draw_list_subpass_count - 1" is true. Returning: INVALID_FORMAT_ID
   at: draw_list_switch_to_next_pass (drivers/vulkan/rendering_device_vulkan.cpp:7474)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "draw_list_current_subpass >= draw_list_subpass_count - 1" is true. Returning: INVALID_FORMAT_ID
   at: draw_list_switch_to_next_pass (drivers/vulkan/rendering_device_vulkan.cpp:7474)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_render_pipeline (drivers/vulkan/rendering_device_vulkan.cpp:7127)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7201)
ERROR: Condition "!dl" is true.
   at: draw_list_bind_index_array (drivers/vulkan/rendering_device_vulkan.cpp:7274)
ERROR: Condition "!dl" is true.
   at: draw_list_set_push_constant (drivers/vulkan/rendering_device_vulkan.cpp:7308)
ERROR: Condition "!dl" is true.
   at: draw_list_draw (drivers/vulkan/rendering_device_vulkan.cpp:7326)
ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
   at: propagate_notification (./scene/main/node.cpp:2208)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.rc.custom_build (d95b516d312a9f3930a96c0fdd51cf975345f16f)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x3db70) [0x7f62ec25fb70] (??:0)
[2] /lib64/libnvidia-glcore.so.535.54.03(+0x18ab0fe) [0x7f62b84ab0fe] (??:0)
[3] /lib64/libnvidia-glcore.so.535.54.03(+0x18add01) [0x7f62b84add01] (??:0)
[4] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x49ab61b] (/home/hugo/Documents/Git/godotengine/godot/drivers/vulkan/rendering_device_vulkan.cpp:7635)
[5] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9476440] (/home/hugo/Documents/Git/godotengine/godot/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp:1037 (discriminator 1))
[6] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9280f72] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_rd/renderer_scene_render_rd.cpp:1042)
[7] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x8fba9b8] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_scene_cull.cpp:3316 (discriminator 4))
[8] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x8fa35ef] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_scene_cull.cpp:2589 (discriminator 1))
[9] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x90033fb] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:212 (discriminator 1))
[10] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9003a9b] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:279)
[11] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x90098d4] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:729)
[12] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9073618] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:92)
[13] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907663d] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:354)
[14] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x910665c] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:322)
[15] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x3380ecc] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:374)
[16] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x3381037] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:414)
[17] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907673b] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:373)
[18] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907666c] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:363)
[19] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a730d6] (/home/hugo/Documents/Git/godotengine/godot/./core/os/thread.cpp:63)
[20] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91bf3] (/usr/include/c++/13/bits/invoke.h:61)
[21] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91abc] (/usr/include/c++/13/bits/invoke.h:97)
[22] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91977] (/usr/include/c++/13/bits/std_thread.h:292)
[23] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a8eb26] (/usr/include/c++/13/bits/std_thread.h:299)
[24] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a8ca32] (/usr/include/c++/13/bits/std_thread.h:244)
[25] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0xa5f50e3] (msdf-error-correction.cpp:?)
[26] /lib64/libc.so.6(+0x8c907) [0x7f62ec2ae907] (??:0)
[27] /lib64/libc.so.6(+0x112870) [0x7f62ec334870] (??:0)
-- END OF BACKTRACE --
================================================================

With V-Sync disabled in the project settings, the exact log can be different:

true
before
inside
after
before
inside
after
before
inside
after
before
inside
after
before
inside
after
before
inside
after
ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
   at: propagate_notification (./scene/main/node.cpp:2208)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.rc.custom_build (d95b516d312a9f3930a96c0fdd51cf975345f16f)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x3db70) [0x7f0ed125fb70] (??:0)
[2] /lib64/libnvidia-glcore.so.535.54.03(+0x18ab0fe) [0x7f0e9d6ab0fe] (??:0)
[3] /lib64/libnvidia-glcore.so.535.54.03(+0x18add01) [0x7f0e9d6add01] (??:0)
[4] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x49ab61b] (/home/hugo/Documents/Git/godotengine/godot/drivers/vulkan/rendering_device_vulkan.cpp:7635)
[5] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9476440] (/home/hugo/Documents/Git/godotengine/godot/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp:1037 (discriminator 1))
[6] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9280f72] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_rd/renderer_scene_render_rd.cpp:1042)
[7] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x8fba9b8] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_scene_cull.cpp:3316 (discriminator 4))
[8] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x8fa35ef] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_scene_cull.cpp:2589 (discriminator 1))
[9] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x90033fb] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:212 (discriminator 1))
[10] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9003a9b] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:279)
[11] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x90098d4] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/renderer_viewport.cpp:729)
[12] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9073618] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:92)
[13] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907663d] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:354)
[14] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x910665c] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:322)
[15] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x3380ecc] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:374)
[16] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x3381037] (/home/hugo/Documents/Git/godotengine/godot/./core/templates/command_queue_mt.h:414)
[17] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907673b] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:373)
[18] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x907666c] (/home/hugo/Documents/Git/godotengine/godot/./servers/rendering/rendering_server_default.cpp:363)
[19] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a730d6] (/home/hugo/Documents/Git/godotengine/godot/./core/os/thread.cpp:63)
[20] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91bf3] (/usr/include/c++/13/bits/invoke.h:61)
[21] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91abc] (/usr/include/c++/13/bits/invoke.h:97)
[22] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a91977] (/usr/include/c++/13/bits/std_thread.h:292)
[23] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a8eb26] (/usr/include/c++/13/bits/std_thread.h:299)
[24] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0x9a8ca32] (/usr/include/c++/13/bits/std_thread.h:244)
[25] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.editor.x86_64() [0xa5f50e3] (msdf-error-correction.cpp:?)
[26] /lib64/libc.so.6(+0x8c907) [0x7f0ed12ae907] (??:0)
[27] /lib64/libc.so.6(+0x112870) [0x7f0ed1334870] (??:0)
-- END OF BACKTRACE --
================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants