You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To handle custom Resource formats, one needs to define ResourceFormatSaver and ResourceFormatLoader, and register them with ResourceSaver::add_resource_format_saver() and ResourceLoader::add_resource_format_loader() for the formats to be recognizable by Godot.
Unbeknownst to the user, registered GodotClasses can be used by Godot outside of the main thread, and it happens only when opening the project in the Godot Editor (or just on InitLevel::Editor - as the same happens also during export). Currently, I can confirm only usage of ResourceFormatLoader methods, but I can't say for sure that any other calls won't be made.
Methods in question:
ResourceFormatLoader::get_resource_uid()
ResourceFormatLoader::get_recognized_extensions()
ResourceFormatLoader::get_resource_type()
After thread-hardening with additional checks in #581, in practice, it means that any gdext-based project that provides ResourceFormatLoader will panic without the experimental-threads feature enabled.
Will try to provide a minimal example at a further date, currently I paste below the output produced by the locally-modified gd-props integration testing project.
While running the empty scene without entering Godot Editor in any way:
While running headless editor with --quit option (and during project export outputs seems to be analogous - EditorExportPlugin itself is running only on the main thread)
Depending on the outcome, we should maybe see if there's a way to support those without experimental-threads.
Basically, it doesn't matter when Godot runs on other threads, as long as Rust user code doesn't.
Maybe it's possible to isolate the latter somehow...
More concretely, we need to either:
prove that each occurrence of running Rust code from another thread is sound (because its data is isolated)
add the necessary safeguards to isolate such code, or defer execution to main where possible
To handle custom Resource formats, one needs to define
ResourceFormatSaver
andResourceFormatLoader
, and register them withResourceSaver::add_resource_format_saver()
andResourceLoader::add_resource_format_loader()
for the formats to be recognizable by Godot.Unbeknownst to the user, registered GodotClasses can be used by Godot outside of the main thread, and it happens only when opening the project in the Godot Editor (or just on
InitLevel::Editor
- as the same happens also during export). Currently, I can confirm only usage ofResourceFormatLoader
methods, but I can't say for sure that any other calls won't be made.Methods in question:
ResourceFormatLoader::get_resource_uid()
ResourceFormatLoader::get_recognized_extensions()
ResourceFormatLoader::get_resource_type()
After thread-hardening with additional checks in #581, in practice, it means that any
gdext
-based project that providesResourceFormatLoader
will panic without theexperimental-threads
feature enabled.Will try to provide a minimal example at a further date, currently I paste below the output produced by the locally-modified
gd-props
integration testing project.--quit
option (and during project export outputs seems to be analogous -EditorExportPlugin
itself is running only on the main thread)Browsing the project in the editor while some testing, all the methods seem to be called from the main thread.
The text was updated successfully, but these errors were encountered: