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

Using Surface Tool with Parallel.For Crashes #73035

Open
ghost opened this issue Feb 10, 2023 · 3 comments
Open

Using Surface Tool with Parallel.For Crashes #73035

ghost opened this issue Feb 10, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Feb 10, 2023

Godot version

4.0 release candidate 1

System information

Windows 10, Vulkan Rendering, Radeon RX 6600

Issue description

Hello,

Firstly thanks for this beautiful game engine. I switched from 3.5.1 to 4.0 and trying to use surface tool in a parallel for. In 3.5.1 i was successful using it for creating runtime meshes. However it seems to crash in 4.0. Also intersecting a ray in a thread throws errors in debug too. Is this intended or am i missing something? I have included a sample project.

Thanks in advance.

Steps to reproduce

Create a simple Node3D scene.
Add a Camera3D and a StaticBody3D in scene.
Attach a C# script to StaticBody3D.
Try to generate a mesh inside _Process function via a function using Surface Tool with Parallel.For

Minimal reproduction project

sample.zip

@Zireael07
Copy link
Contributor

Neither physics nor OpenGL shaders are thread safe AFAIK

@Calinou
Copy link
Member

Calinou commented Feb 10, 2023

See #56524 and #70325.

@ghost
Copy link
Author

ghost commented Feb 10, 2023

In case anyone wonders;
I slightly modified my code, moving surface tool out of any parallel or threads. However, reaching the stateSpace in parallel was still problematic, crashing the engine. I placed mutexes where necessarry. Problem seems to be solved.

Is there any way to make local copies of the stateSpace so that threads can use?

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

No branches or pull requests

3 participants