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

Make RID allocation thread-safe when using Jolt Physics #100342

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Dec 12, 2024

It seems that I had missed the fact that Godot's RID_PtrOwner wasn't thread-safe by default, and as a result the experimental thread-safety when using the Jolt physics server wasn't so safe after all. This is because RID-allocating methods (e.g. box_shape_create) are called directly regardless of thread, as opposed to being queued up in the command buffer of PhysicsServer3DWrapMT, so anything done within them must be thread-safe.

This PR resolves this by simply enabling the thread-safety of all RID_PtrOwner used in JoltPhysicsServer3D.

(Thanks to @Zylann for pointing this out!)

@mihe mihe requested a review from a team as a code owner December 12, 2024 23:51
@mihe mihe changed the title Make RID allocation thread-safe when using Jolt Physics Make RID allocation thread-safe when using Jolt Physics Dec 13, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Dec 13, 2024
@Repiteo Repiteo merged commit b68675e into godotengine:master Dec 13, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 13, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants