Skip to content

Commit

Permalink
Fix math cross-platform determinism (Jondolf#145)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jondolf authored and RJ committed Sep 25, 2023
1 parent 23d8a74 commit 28f5ad1
Show file tree
Hide file tree
Showing 7 changed files with 1,495 additions and 16 deletions.
3 changes: 2 additions & 1 deletion crates/bevy_xpbd_2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ parallel = ["parry2d?/parallel", "parry2d-f64?/parallel"]
enhanced-determinism = [
"parry2d?/enhanced-determinism",
"parry2d-f64?/enhanced-determinism",
"glam/libm",
]
collider-from-mesh = ["bevy/bevy_render"]

Expand All @@ -36,14 +37,14 @@ bevy = { version = "0.11", default-features = false }
parry2d = { version = "0.13", optional = true }
parry2d-f64 = { version = "0.13", optional = true }
nalgebra = { version = "0.32", features = ["convert-glam024"] }
glam = { version = "0.24", features = ["approx"] }
derive_more = "0.99"
indexmap = "2.0.0"
fxhash = "0.2.1"

[dev-dependencies]
examples_common_2d = { path = "../examples_common_2d" }
approx = "0.5"
glam = { version = "0.24", features = ["approx"] }
insta = "1.0"
itertools = "0.10"

Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_xpbd_3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ f32 = ["dep:parry3d"]
f64 = ["dep:parry3d-f64"]
debug-plugin = ["bevy/bevy_gizmos"]
simd = ["parry3d?/simd-stable", "parry3d-f64?/simd-stable"]
parallel = ["parry3d?/parallel", "parry3d-f64?/parallel"]
enhanced-determinism = [
"parry3d?/enhanced-determinism",
"parry3d-f64?/enhanced-determinism",
"glam/libm",
]
parallel = ["parry3d?/parallel", "parry3d-f64?/parallel"]
collider-from-mesh = ["bevy/bevy_render"]

[lib]
Expand All @@ -36,6 +37,7 @@ bevy = { version = "0.11", default-features = false }
parry3d = { version = "0.13", optional = true }
parry3d-f64 = { version = "0.13", optional = true }
nalgebra = { version = "0.32", features = ["convert-glam024"] }
glam = { version = "0.24", features = ["approx"] }
derive_more = "0.99"
indexmap = "2.0.0"
fxhash = "0.2.1"
Expand All @@ -45,7 +47,6 @@ examples_common_3d = { path = "../examples_common_3d" }
benches_common_3d = { path = "../benches_common_3d" }
approx = "0.5"
criterion = { version = "0.4", features = ["html_reports"] }
glam = { version = "0.24", features = ["approx"] }
insta = "1.0"
itertools = "0.10"

Expand Down
Loading

0 comments on commit 28f5ad1

Please sign in to comment.