I have written am Import plugin that I am using to import larger scenes into Godot. However I am facing some issues trying to optimize the plugin. Especially trying to use multiple threads during the import.
Since there are 4 independent steps during the import process, creating different parts of the scene, the logical Idea to speed up the import process was to use multiple threads to parallelize the workload. The problem is that at least
SurfaceTool::commit, ArrayMesh::_new and ResourceLoader::load all deadlock when the editor thread is blocked by the import plugin. Note that when launching the whole import process in a separate thread and directly returning from the import method in the Plugin the deadlock does not occur however the import itself also does not work correctly in that case.
Steps to reproduce
Write an import plugin.
Create a separate thread.
Call SurfaceTool::commit, ArrayMesh::_new or ResourceLoader::load in the new thread while the import thread is still locked in your import method.
Godot version
3.3.3, 3.3.4
System information
Windows 10, Ubuntu 20.4 LTS
Issue description
I have written am Import plugin that I am using to import larger scenes into Godot. However I am facing some issues trying to optimize the plugin. Especially trying to use multiple threads during the import.
Since there are 4 independent steps during the import process, creating different parts of the scene, the logical Idea to speed up the import process was to use multiple threads to parallelize the workload. The problem is that at least
SurfaceTool::commit
,ArrayMesh::_new
andResourceLoader::load
all deadlock when the editor thread is blocked by the import plugin. Note that when launching the whole import process in a separate thread and directly returning from theimport
method in the Plugin the deadlock does not occur however the import itself also does not work correctly in that case.Steps to reproduce
SurfaceTool::commit
,ArrayMesh::_new
orResourceLoader::load
in the new thread while the import thread is still locked in your import method.Minimal reproduction project
No response