Skip to content

Commit

Permalink
fix compilation for feature enhanced-determinism (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored Sep 23, 2024
1 parent 76357e3 commit 9e1113c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/rapier-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
run: cd crates/rapier_testbed2d; cargo check --verbose --features parallel;
- name: Check rapier_testbed3d --features parallel
run: cd crates/rapier_testbed3d; cargo check --verbose --features parallel;
- name: Check rapier_testbed2d --features enhanced-determinism
run: cd crates/rapier2d; cargo check --verbose --features enhanced-determinism;
- name: Check rapier_testbed3d --features enhanced-determinism
run: cd crates/rapier3d; cargo check --verbose --features enhanced-determinism;
- name: Check rapier-examples-2d
run: cargo check -j 1 --verbose -p rapier-examples-2d;
- name: Check rapier-examples-3d
Expand Down
7 changes: 6 additions & 1 deletion src/geometry/broad_phase_multi_sap/broad_phase_multi_sap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ impl BroadPhaseMultiSap {
* Actually remove the colliders proxies.
*/
for removed in removed_colliders {
if let Some(proxy_id) = self.colliders_proxy_ids.remove(removed) {
#[cfg(feature = "enhanced-determinism")]
let proxy_id = self.colliders_proxy_ids.swap_remove(removed);
#[cfg(not(feature = "enhanced-determinism"))]
let proxy_id = self.colliders_proxy_ids.remove(removed);

if let Some(proxy_id) = proxy_id {
if proxy_id != crate::INVALID_U32 {
self.proxies.remove(proxy_id);
}
Expand Down
3 changes: 3 additions & 0 deletions src/geometry/broad_phase_multi_sap/sap_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ impl SAPLayer {

// Check if we can actually delete this region.
if !region.contains_subproper_proxies() {
#[cfg(feature = "enhanced-determinism")]
let region_id = region_id.swap_remove();
#[cfg(not(feature = "enhanced-determinism"))]
let region_id = region_id.remove();

// We can delete this region. So we need to tell the larger
Expand Down
12 changes: 9 additions & 3 deletions src/pipeline/physics_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,17 @@ impl PhysicsPipeline {

// Apply some of delayed wake-ups.
self.counters.stages.user_changes.start();
for handle in impulse_joints
#[cfg(feature = "enhanced-determinism")]
let impulse_joints_iterator = impulse_joints
.to_wake_up
.drain(..)
.chain(multibody_joints.to_wake_up.drain(..));
#[cfg(not(feature = "enhanced-determinism"))]
let impulse_joints_iterator = impulse_joints
.to_wake_up
.drain()
.chain(multibody_joints.to_wake_up.drain())
{
.chain(multibody_joints.to_wake_up.drain());
for handle in impulse_joints_iterator {
islands.wake_up(bodies, handle.0, true);
}

Expand Down

0 comments on commit 9e1113c

Please sign in to comment.