bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.1k stars 3.56k forks source link

WGPU Panic when there's a transmission material in scene and camera is switched #12445

Open franklinblanco opened 7 months ago

franklinblanco commented 7 months ago

Bevy version

0.13

Relevant system information

cargo 1.77.0-nightly (1ae631085 2024-01-17)

AdapterInfo { name: "Apple M1 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

What you did

I Spawned a Cube mesh and gave it the following StandardMaterial:

materials.add(StandardMaterial {
        base_color: Color::Rgba { red: 0.455, green: 1.0, blue: 0.905, alpha: 1.0 },
        specular_transmission: 0.95,
        diffuse_transmission: 0.0,
        thickness: 1.8,
        ior: 1.0,
        perceptual_roughness: 0.05,
        reflectance: 0.5,
        ..default()
});

Then, I clicked my keybind for opening the bevy_editor_pls once, all good, then I clicked the keybind again, which takes me out of the inspector view, and then once again, and then I get a panic.

I did this a couple of times and can confirm, it always happens the second time.

Note: This only seems to happen when I move around with the camera and do

What went wrong

This is the error message in the console:

ERROR log: Handling wgpu errors as fatal by default    
thread '<unnamed>' panicked at <REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/backend/wgpu_core.rs:3009:5:
wgpu error: Validation Error

Caused by:
    In CommandEncoder::copy_texture_to_texture
    Copy error
    Source format (Rgba8UnormSrgb) and destination format (Rgba16Float) are not copy-compatible (they may only differ in srgb-ness)

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!
thread 'Compute Task Pool (1)' panicked at <REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.13.0/src/pipelined_rendering.rs:49:67:
called `Result::unwrap()` on an `Err` value: RecvError
thread 'main' panicked at  <REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.11/src/platform_impl/macos/app_state.rs:387:33:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Additional information

I'm attempting to replicate this in a small repo I can upload. I'll add a comment if I get it. But meanwhile I thought I could report on this! Video Demo, the end of the video is when it panicked.

https://github.com/bevyengine/bevy/assets/72827992/b8ec5cf7-c070-4f6c-ae53-a5b8f3380c72

Thanks to the bevy devs for your hard work!

franklinblanco commented 7 months ago

Since I haven't been able to replicate the Bug anywhere else, I'll attach a video of what happens when I remove the material.

https://github.com/bevyengine/bevy/assets/72827992/e481aec0-d1dc-488c-b136-d4a8ea39d34e