Skip to content

Update to bevy 0.12 - #23

Open
ThierryBerger wants to merge 6 commits into
dimforge:masterfrom
ThierryBerger:bevy_0.11
Open

Update to bevy 0.12#23
ThierryBerger wants to merge 6 commits into
dimforge:masterfrom
ThierryBerger:bevy_0.11

Conversation

@ThierryBerger

@ThierryBerger ThierryBerger commented Aug 27, 2024

Copy link
Copy Markdown

The main objective is to update to bevy 0.14.

I did try to make the full jump, but 99+ errors were overwhelming, so I'm splitting the work for each bevy version: this PR focuses on bevy 0.12, I'll list good references here and in comments:

Details

There was a bug with the 3d rendering as of 95d22b7: ; see #23 (comment) for investigation thread.

Screencast.from.08-29-2024.12.05.00.PM.webm

Solved by passing the identity function rather than incorrect model matrix.

@ThierryBerger ThierryBerger changed the title Update to bevy 0.11 Update to bevy 0.12 Aug 27, 2024
const WGSL_PATH: &'static str = "src/third_party/rapier/shaders/instancing3d.wgsl";
shaders.set_untracked(
PARTICLE_SHADER_HANDLE,
const WGSL_PATH: &'static str = "../src/third_party/rapier/shaders/instancing3d.wgsl";

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don´t have an nvidia, and running from the root workspace fails, even with --no-default-features ; running the example works when launched from examples2d and examples3d though 👍 ; the downside is that I had to change that path.

If anyone knows how I could make it work from workspace, that´d be great :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hmm, I'm not sure.
Could you post the errors you're getting when you try from the workspace?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

cargo run --bin examples3d

Adding --no-default-features does yield the same result:

   Compiling arrayvec v0.7.6
   Compiling cust_raw v0.11.3
   Compiling cust v0.3.2
   Compiling simba v0.8.1
error: failed to run custom build command for `cust_raw v0.11.3`

Caused by:
  process didn't exit successfully: `/home/tb/Documents/tech/rust/sparkl/target/debug/build/cust_raw-13223537373503e0/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /home/tb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/find_cuda_helper-0.2.0/src/lib.rs:12:13:
  Could not find a cuda installation
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `cust v0.3.2`
cargo tree --no-default-features -e features -i cust_raw

cust_raw v0.11.3
└── cust_raw feature "default"
    └── cust v0.3.2
        ├── cust feature "bytemuck"
        │   └── cust feature "default"
        │       ├── parry2d v0.13.8
        │       │   ├── parry2d feature "cuda"
        │       │   │   └── sparkl2d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-kernels)
        │       │   ├── parry2d feature "cust"
        │       │   │   └── parry2d feature "cuda" (*)
        │       │   ├── parry2d feature "cust_core"
        │       │   │   └── parry2d feature "cuda" (*)
        │       │   ├── parry2d feature "default"
        │       │   │   ├── rapier2d v0.18.0
        │       │   │   │   ├── rapier2d feature "debug-render"
        │       │   │   │   │   └── rapier_testbed2d v0.18.0
        │       │   │   │   │       ├── rapier_testbed2d feature "default"
        │       │   │   │   │       │   ├── sparkl-examples-2d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples2d)
        │       │   │   │   │       │   └── sparkl2d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d)
        │       │   │   │   │       │       ├── sparkl2d feature "bevy"
        │       │   │   │   │       │       │   └── sparkl2d feature "graphics"
        │       │   │   │   │       │       │       └── sparkl2d feature "rapier-testbed"
        │       │   │   │   │       │       │           └── sparkl-examples-2d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples2d)
        │       │   │   │   │       │       ├── sparkl2d feature "bevy_ecs"
        │       │   │   │   │       │       │   └── sparkl2d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "bevy_egui"
        │       │   │   │   │       │       │   └── sparkl2d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "default"
        │       │   │   │   │       │       │   └── sparkl-examples-2d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples2d)
        │       │   │   │   │       │       ├── sparkl2d feature "dim2"
        │       │   │   │   │       │       │   └── sparkl2d feature "default" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "f32"
        │       │   │   │   │       │       │   └── sparkl2d feature "default" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "itertools"
        │       │   │   │   │       │       │   └── sparkl2d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "rapier_testbed2d"
        │       │   │   │   │       │       │   └── sparkl2d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl2d feature "serde"
        │       │   │   │   │       │       │   └── sparkl2d feature "serde-serialize"
        │       │   │   │   │       │       │       └── sparkl-examples-2d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples2d)
        │       │   │   │   │       │       └── sparkl2d feature "serde-serialize" (*)
        │       │   │   │   │       └── rapier_testbed2d feature "dim2"
        │       │   │   │   │           └── rapier_testbed2d feature "default" (*)
        │       │   │   │   ├── rapier2d feature "default"
        │       │   │   │   │   ├── rapier_testbed2d v0.18.0 (*)
        │       │   │   │   │   ├── sparkl-examples-2d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples2d)
        │       │   │   │   │   └── sparkl2d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d) (*)
        │       │   │   │   ├── rapier2d feature "dim2"
        │       │   │   │   │   └── rapier2d feature "default" (*)
        │       │   │   │   ├── rapier2d feature "f32"
        │       │   │   │   │   └── rapier2d feature "default" (*)
        │       │   │   │   ├── rapier2d feature "instant"
        │       │   │   │   │   └── rapier2d feature "profiler"
        │       │   │   │   │       └── rapier_testbed2d v0.18.0 (*)
        │       │   │   │   ├── rapier2d feature "profiler" (*)
        │       │   │   │   ├── rapier2d feature "serde"
        │       │   │   │   │   └── rapier2d feature "serde-serialize"
        │       │   │   │   │       └── rapier_testbed2d v0.18.0 (*)
        │       │   │   │   │       └── sparkl2d feature "serde-serialize" (*)
        │       │   │   │   └── rapier2d feature "serde-serialize" (*)
        │       │   │   └── sparkl2d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d) (*)
        │       │   ├── parry2d feature "dim2"
        │       │   │   └── parry2d feature "required-features"
        │       │   │       └── sparkl2d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-kernels)
        │       │   │       └── parry2d feature "default" (*)
        │       │   ├── parry2d feature "f32"
        │       │   │   └── parry2d feature "required-features" (*)
        │       │   ├── parry2d feature "required-features" (*)
        │       │   ├── parry2d feature "rustc-hash"
        │       │   │   └── parry2d feature "std"
        │       │   │       └── parry2d feature "default" (*)
        │       │   ├── parry2d feature "serde"
        │       │   │   └── parry2d feature "serde-serialize"
        │       │   │       ├── rapier2d feature "serde-serialize" (*)
        │       │   │       └── sparkl2d feature "serde-serialize" (*)
        │       │   ├── parry2d feature "serde-serialize" (*)
        │       │   ├── parry2d feature "slab"
        │       │   │   └── parry2d feature "std" (*)
        │       │   ├── parry2d feature "spade"
        │       │   │   └── parry2d feature "std" (*)
        │       │   └── parry2d feature "std" (*)
        │       ├── parry3d v0.13.8
        │       │   ├── parry3d feature "cuda"
        │       │   │   └── sparkl3d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-kernels)
        │       │   ├── parry3d feature "cust"
        │       │   │   └── parry3d feature "cuda" (*)
        │       │   ├── parry3d feature "cust_core"
        │       │   │   └── parry3d feature "cuda" (*)
        │       │   ├── parry3d feature "default"
        │       │   │   ├── rapier3d v0.18.0
        │       │   │   │   ├── rapier3d feature "debug-render"
        │       │   │   │   │   └── rapier_testbed3d v0.18.0
        │       │   │   │   │       ├── rapier_testbed3d feature "default"
        │       │   │   │   │       │   ├── sparkl-examples-3d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples3d)
        │       │   │   │   │       │   └── sparkl3d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d)
        │       │   │   │   │       │       ├── sparkl3d feature "bevy"
        │       │   │   │   │       │       │   └── sparkl3d feature "graphics"
        │       │   │   │   │       │       │       └── sparkl3d feature "rapier-testbed"
        │       │   │   │   │       │       │           └── sparkl-examples-3d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples3d)
        │       │   │   │   │       │       ├── sparkl3d feature "bevy_ecs"
        │       │   │   │   │       │       │   └── sparkl3d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "bevy_egui"
        │       │   │   │   │       │       │   └── sparkl3d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "default"
        │       │   │   │   │       │       │   └── sparkl-examples-3d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples3d)
        │       │   │   │   │       │       ├── sparkl3d feature "dim3"
        │       │   │   │   │       │       │   └── sparkl3d feature "default" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "f32"
        │       │   │   │   │       │       │   └── sparkl3d feature "default" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "graphics" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "itertools"
        │       │   │   │   │       │       │   └── sparkl3d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "rapier_testbed3d"
        │       │   │   │   │       │       │   └── sparkl3d feature "rapier-testbed" (*)
        │       │   │   │   │       │       ├── sparkl3d feature "serde"
        │       │   │   │   │       │       │   └── sparkl3d feature "serde-serialize"
        │       │   │   │   │       │       │       └── sparkl-examples-3d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples3d)
        │       │   │   │   │       │       └── sparkl3d feature "serde-serialize" (*)
        │       │   │   │   │       └── rapier_testbed3d feature "dim3"
        │       │   │   │   │           └── rapier_testbed3d feature "default" (*)
        │       │   │   │   ├── rapier3d feature "default"
        │       │   │   │   │   ├── rapier_testbed3d v0.18.0 (*)
        │       │   │   │   │   ├── sparkl-examples-3d v0.2.0 (/home/tb/Documents/tech/rust/sparkl/examples3d)
        │       │   │   │   │   └── sparkl3d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d) (*)
        │       │   │   │   ├── rapier3d feature "dim3"
        │       │   │   │   │   └── rapier3d feature "default" (*)
        │       │   │   │   ├── rapier3d feature "f32"
        │       │   │   │   │   └── rapier3d feature "default" (*)
        │       │   │   │   ├── rapier3d feature "instant"
        │       │   │   │   │   └── rapier3d feature "profiler"
        │       │   │   │   │       └── rapier_testbed3d v0.18.0 (*)
        │       │   │   │   ├── rapier3d feature "profiler" (*)
        │       │   │   │   ├── rapier3d feature "serde"
        │       │   │   │   │   └── rapier3d feature "serde-serialize"
        │       │   │   │   │       └── rapier_testbed3d v0.18.0 (*)
        │       │   │   │   │       └── sparkl3d feature "serde-serialize" (*)
        │       │   │   │   └── rapier3d feature "serde-serialize" (*)
        │       │   │   └── sparkl3d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d) (*)
        │       │   ├── parry3d feature "dim3"
        │       │   │   └── parry3d feature "required-features"
        │       │   │       └── sparkl3d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-kernels)
        │       │   │       └── parry3d feature "default" (*)
        │       │   ├── parry3d feature "f32"
        │       │   │   └── parry3d feature "required-features" (*)
        │       │   ├── parry3d feature "required-features" (*)
        │       │   ├── parry3d feature "rustc-hash"
        │       │   │   └── parry3d feature "std"
        │       │   │       └── parry3d feature "default" (*)
        │       │   ├── parry3d feature "serde"
        │       │   │   └── parry3d feature "serde-serialize"
        │       │   │       ├── rapier3d feature "serde-serialize" (*)
        │       │   │       └── sparkl3d feature "serde-serialize" (*)
        │       │   ├── parry3d feature "serde-serialize" (*)
        │       │   ├── parry3d feature "slab"
        │       │   │   └── parry3d feature "std" (*)
        │       │   ├── parry3d feature "spade"
        │       │   │   └── parry3d feature "std" (*)
        │       │   └── parry3d feature "std" (*)
        │       ├── sparkl2d-core v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-core)
        │       │   ├── sparkl2d-core feature "cuda"
        │       │   │   └── sparkl2d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-kernels)
        │       │   ├── sparkl2d-core feature "cust"
        │       │   │   └── sparkl2d-core feature "cuda" (*)
        │       │   ├── sparkl2d-core feature "cust_core"
        │       │   │   └── sparkl2d-core feature "cuda" (*)
        │       │   ├── sparkl2d-core feature "default"
        │       │   │   ├── sparkl2d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d) (*)
        │       │   │   └── sparkl2d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-kernels)
        │       │   ├── sparkl2d-core feature "dim2"
        │       │   │   └── sparkl2d-core feature "default" (*)
        │       │   ├── sparkl2d-core feature "f32"
        │       │   │   └── sparkl2d-core feature "default" (*)
        │       │   ├── sparkl2d-core feature "serde"
        │       │   │   └── sparkl2d-core feature "serde-serialize"
        │       │   │       └── sparkl2d feature "serde-serialize" (*)
        │       │   └── sparkl2d-core feature "serde-serialize" (*)
        │       ├── sparkl2d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl2d-kernels)
        │       ├── sparkl3d-core v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-core)
        │       │   ├── sparkl3d-core feature "cuda"
        │       │   │   └── sparkl3d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-kernels)
        │       │   ├── sparkl3d-core feature "cust"
        │       │   │   └── sparkl3d-core feature "cuda" (*)
        │       │   ├── sparkl3d-core feature "cust_core"
        │       │   │   └── sparkl3d-core feature "cuda" (*)
        │       │   ├── sparkl3d-core feature "default"
        │       │   │   ├── sparkl3d v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d) (*)
        │       │   │   └── sparkl3d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-kernels)
        │       │   ├── sparkl3d-core feature "dim3"
        │       │   │   └── sparkl3d-core feature "default" (*)
        │       │   ├── sparkl3d-core feature "f32"
        │       │   │   └── sparkl3d-core feature "default" (*)
        │       │   ├── sparkl3d-core feature "serde"
        │       │   │   └── sparkl3d-core feature "serde-serialize"
        │       │   │       └── sparkl3d feature "serde-serialize" (*)
        │       │   └── sparkl3d-core feature "serde-serialize" (*)
        │       └── sparkl3d-kernels v0.4.0 (/home/tb/Documents/tech/rust/sparkl/crates/sparkl3d-kernels)
        └── cust feature "default" (*)

Comment thread Cargo.toml Outdated
Comment thread src/third_party/rapier/point_cloud_render.rs Outdated
Comment thread src/third_party/rapier/point_cloud_render.rs Outdated
Comment thread src/third_party/rapier/point_cloud_render.rs Outdated
Comment on lines +126 to +127
distance: rangefinder
.distance_translation(&mesh_transforms.transform.translation),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@ThierryBerger
ThierryBerger marked this pull request as ready for review August 27, 2024 20:10
let msaa_key = MeshPipelineKey::from_msaa_samples(msaa.samples());

for (view, mut transparent_phase) in views.iter_mut() {
let view_matrix = view.transform.compute_matrix();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These changes are to have something more similar to official bevy example: https://github.com/bevyengine/bevy/blob/v0.12.1/examples/shader/shader_instancing.rs

Comment thread src/third_party/rapier/shaders/instancing3d.wgsl Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants