mesh2d example panics on macOS
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
# Summary
`cargo run --example mesh2d` compiles bevy successfully but panics upon run.
## Environment
- Bevy 0.12.0
- cargo 1.74.0 (ecb9851af 2023-10-18)
- macOS 12.7
### Adapter
```ignore
AdapterInfo { name: "Intel Iris Pro Graphics", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
```
## Other examples tested
### bevy
- `cargo run --example 2d_gizmos` works out-of-the-box.
- `cargo run --example mesh2d_manual` fails with the same "bevy_render/src/pipelined_rendering.rs" panic.
- `3d_gizmos`, `3d_shapes`, `3d_viewport_to_world` also panic.
### wgpu
- `cargo run --bin wgpu-examples water` works out-of-the-box.
## Other things tried
- As [recommended in the cheatbook](https://bevy-cheatbook.github.io/pitfalls/build-errors.html#clear-the-cargo-state), I ran `rm -rf target Cargo.lock && cargo run --example 2d_mesh`. It fails.
# Panic
Here's the full console output from `cargo run --example mesh2d`:
```ignore
Finished dev [unoptimized + debuginfo] target(s) in 0.58s
Running `target/debug/examples/mesh2d`
2023-12-02T21:43:50.122253Z INFO bevy_render::renderer: AdapterInfo { name: "Intel Iris Pro Graphics", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
2023-12-02T21:43:50.800731Z INFO bevy_winit::system: Creating new window "App" (0v0)
2023-12-02T21:43:50.937406Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 12.7 ", kernel: "21.6.0", cpu: "Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz", core_count: "4", memory: "16.0 GiB" }
2023-12-02T21:43:51.627927Z ERROR log: Shader translation error for stage ShaderStages(VERTEX | FRAGMENT): new_render_pipeline_state: "Compiler encountered an internal error"
2023-12-02T21:43:51.627987Z ERROR log: Please report it to https://github.com/gfx-rs/naga
2023-12-02T21:43:51.628043Z ERROR log: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (0)' panicked at /Users/eric/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:3056:5:
wgpu error: Validation Error
Caused by:
In Device::create_render_pipeline
note: label = `transparent_mesh2d_pipeline`
Internal error in ShaderStages(VERTEX | FRAGMENT) shader: new_render_pipeline_state: "Compiler encountered an internal error"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
thread 'main' panicked at crates/bevy_render/src/pipelined_rendering.rs:145:45:
called `Result::unwrap()` on an `Err` value: RecvError
```
Notice that the ERROR log asks for a report in gfx-rs. Please let me know if this is truly a gfx-rs issue and I'll move it there. I'm posting this here because the use of `direct.rs` leads me to believe that Bevy tried to load DirectX support rather than, what I assume is more appropriate for my macOS workstation, the Metal graphics lib. However, notice that the AdapterInfo indicates Bevy is targeting Metal.
So, with that working theory, I'm posting here. Please let me know if I can provide other diagnostic info. The full traceback is [backtrace.log](https://github.com/bevyengine/bevy/files/13537503/backtrace.log).
## Related issues
- https://github.com/bevyengine/bevy/issues/10840 produces the following identical console output:
```
In Device::create_render_pipeline
note: label = `transparent_mesh2d_pipeline`
```
Contributor guide
Research direction
Reproduce the failure with `cargo run --example mesh2d` and compare it with `mesh2d_manual` and the working examples listed in the report. Start at `crates/bevy_render/src/pipelined_rendering.rs` and inspect the `transparent_mesh2d_pipeline` creation error alongside the wgpu/Naga shader translation output. Done means the affected macOS examples run without the reported panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100