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

Fix math cross-platform determinism #145

Merged
merged 3 commits into from
Sep 3, 2023
Merged

Fix math cross-platform determinism #145

merged 3 commits into from
Sep 3, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Sep 2, 2023

Enables the libm feature for glam to support cross-platform deterministic math when enhanced-determinism is enabled.

Without the libm feature, our determinism test produces different snapshots across Windows, Ubuntu and MacOS. This can be seen as the CI failing in the second commit. Enabling libm makes the snapshots consistent across operating systems.

Our test is quite straightforward however, as it just spawns a stack of cubes that falls to the ground. It doesn't test if joints, spatial queries, sleeping etc. are deterministic. We should make the test more complex to cover these different cases and verify proper determinism.

Note that even if this does fix determinism for bevy_xpbd, it's still up to the users to make sure their own code is deterministic. We should add proper documentation and tips on determinism once it's verified to work for the engine itself.

@Jondolf Jondolf added the C-Enhancement New feature or request label Sep 2, 2023
Copy link
Contributor

@johanhelsing johanhelsing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are still unsolved determinism issues, but this is a step in the right direction :)

@Jondolf Jondolf changed the title Try to fix cross-platform determinism Fix math cross-platform determinism Sep 3, 2023
@Jondolf Jondolf marked this pull request as ready for review September 3, 2023 17:21
@Jondolf Jondolf merged commit 3427743 into main Sep 3, 2023
3 checks passed
@Jondolf Jondolf deleted the determinism branch September 3, 2023 17:24
RJ pushed a commit to RJ/avian that referenced this pull request Sep 25, 2023
Enables the libm feature for glam to support cross-platform deterministic math when enhanced-determinism is enabled.

This makes the snapshots produced by the cross-platform determinism test consistent across operating systems. The test is very simple however, so there might still be other determinism issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants