HP van Braam 52f27370ab Fix a deadlock in CanvasRenderRD
RenderingServerDefault::_draw wants to get all of the materials. The threaded
loader is still loading the materials:

1) The main thread locks canvas_singleton->shader.mutex via
   RendererRD::Utilities::update_dirty_resources
    -> RendererRD::MaterialStorage::_update_queued_materials
      -> RendererCanvasRenderRD::CanvasMaterialData::update_parameters()
2) RendererCanvasRenderRD::CanvasMaterialData::update_parameters() wants
   to get the current shader via ShaderRD::version_get_shader. This
   eventually wants to wait on the load of that shader via
   WorkerThreadPool::wait_for_group_task_completion in
   ShaderRD::_compile_version_end

At this point the main thread is waiting for the threaded load to finish
loading the shader. Meanwhile in a thread not too far away the load is
progressing:

1) The loader is loading the tres in ResourceLoaderText::load which
   eventually wants to ShaderMaterial::set_shader
2) We eventually end up in RendererCanvasRenderRD::CanvasShaderData::set_code
3) set_code wants to lock canvas_singleton->shader.mutex to protect
   against concurrent compilation

At this point the main thread is waiting on the load to complete, but
holds "canvas_singleton->shader.mutex" via update_parameters(), and the
loader is waiting on "canvas_singleton->shader.mutex" in set_code.

Tragedy ensues etc.

To fix the problem we don't acquire the lock until after we're sure
we're done compiling the shader.

The same pattern exists in scene_shader_forward_clustered.cpp which
was created in the same commit as the code in the canvas singleton.

With this change the deadlock can no longer occur as set_code() can now run
concurrently with RenderingServerDefault::_draw() as the path where the
main thread waits on the workerthreadpool with
canvas_singleton->shader.mutex held can no longer occur.

Data integrity wise: previously you'd think that
canvas_singleton->shader.mutex would have protected against metadata
changes to uniforms, ubo_offsets, and texture_uniforms but set_code() used
to write to some of these (uniforms, ubo_size) without taking the lock with
no ill effects because the material isn't updated until the shader has loaded.

A similar pattern was found in scene_shader_forward_mobile.cpp and was
fixed in the same way.
2026-06-08 00:22:02 +02:00
2026-05-15 23:03:54 -07:00
2026-06-03 11:59:10 -07:00
2026-06-08 00:22:02 +02:00
2026-05-01 13:43:49 -05:00
2026-05-01 13:43:49 -05:00
2026-05-01 13:43:49 -05:00
2026-05-27 23:49:30 +02:00
2026-01-14 00:18:18 +01:00
2026-01-25 11:39:36 +01:00
2026-01-25 09:59:40 +01:00
2026-04-24 16:54:42 -05:00

Godot Engine

Godot Engine logo

2D and 3D cross-platform game engine

Godot Engine is a feature-packed, cross-platform game engine to create 2D and 3D games from a unified interface. It provides a comprehensive set of common tools, so that users can focus on making games without having to reinvent the wheel. Games can be exported with one click to a number of platforms, including the major desktop platforms (Linux, macOS, Windows), mobile platforms (Android, iOS), as well as Web-based platforms and consoles.

Free, open source and community-driven

Godot is completely free and open source under the very permissive MIT license. No strings attached, no royalties, nothing. The users' games are theirs, down to the last line of engine code. Godot's development is fully independent and community-driven, empowering users to help shape their engine to match their expectations. It is supported by the Godot Foundation not-for-profit.

Before being open sourced in February 2014, Godot had been developed by Juan Linietsky and Ariel Manzur for several years as an in-house engine, used to publish several work-for-hire titles.

Screenshot of a 3D scene in the Godot Engine editor

Getting the engine

Binary downloads

Official binaries for the Godot editor and the export templates can be found on the Godot website.

Compiling from source

See the official docs for compilation instructions for every supported platform.

Community and contributing

Godot is not only an engine but an ever-growing community of users and engine developers. The main community channels are listed on the homepage.

The best way to get in touch with the core engine developers is to join the Godot Contributors Chat.

To get started contributing to the project, see the contributing guide. This document also includes guidelines for reporting bugs.

Documentation and demos

The official documentation is hosted on Read the Docs. It is maintained by the Godot community in its own GitHub repository.

The class reference is also accessible from the Godot editor.

We also maintain official demos in their own GitHub repository as well as a list of awesome Godot community resources.

There are also a number of other learning resources provided by the community, such as text and video tutorials, demos, etc. Consult the community channels for more information.

Code Triagers Badge Translate on Weblate

S
Description
Custom Godot Build
Readme 1.8 GiB
2026-03-06 17:15:23 -05:00
Languages
C++ 91.4%
Java 1.9%
C# 1.9%
C 1.3%
GLSL 1.1%
Other 2.4%