Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when setting background color via Color::Lcha #8034

Closed
erdfern opened this issue Mar 10, 2023 · 1 comment · Fixed by #8040
Closed

Crash when setting background color via Color::Lcha #8034

erdfern opened this issue Mar 10, 2023 · 1 comment · Fixed by #8040
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Milestone

Comments

@erdfern
Copy link

erdfern commented Mar 10, 2023

Bevy version

0.10.0

[Optional] Relevant system information

rustc 1.68.0

SystemInfo { os: "Linux 22.0.4 Manjaro Linux", kernel: "5.15.94-1-MANJARO", cpu: "AMD Ryzen 7 2700X Eight-Core Processor", core_count: "8", memory: "15.6 GiB" }
AdapterInfo { name: "NVIDIA GeForce RTX 2070 SUPER", vendor: 4318, device: 7812, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "525.89.02", backend: Vulkan }

What you did

I set the background color in a project using Color::Lcha {...}.

Minimal example:

fn main() {
    App::new()
        .insert_resource(
            ClearColor(Color::Lcha {
                lightness: 80.,
                chroma: 20.,
                hue: 100.,
                alpha: 0.,
            }), /*.as_rgba() makes the problem go away */
        )
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

What went wrong

With great anticipation, I awaited the sight of a mesmerizing background color, one that would transport me to a world of beauty and wonder. Alas, my hopes were shattered as the app crashed before my very eyes, leaving me stranded in a void of disappointment and frustration.

Additional information

Console output:

2023-03-10T23:42:39.181041Z  INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-03-10T23:42:39.181279Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1    
2023-03-10T23:42:39.254333Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 2070 SUPER", vendor: 4318, device: 7812, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "525.89.02", backend: Vulkan }
2023-03-10T23:42:39.818207Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.0.4 Manjaro Linux", kernel: "5.15.94-1-MANJARO", cpu: "AMD Ryzen 7 2700X Eight-Core Processor", core_count: "8", memory: "15.6 GiB" }
thread '<unnamed>' panicked at 'internal error: entered unreachable code', /home/~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.10.0/src/color/mod.rs:1155:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (2)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /home/~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.10.0/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.0/src/task_pool.rs:376:49
thread 'Compute Task Pool (2)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.10.0/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/~/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.10.0/src/task_pool.rs:376:49

Converting the Lcha color to RGBA yielded the expected result, but I found the crash quit surprising, since all other variants of Color can be used to set the background color.

@erdfern erdfern added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 10, 2023
@james7132 james7132 added A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Mar 11, 2023
@james7132 james7132 added this to the 0.10.1 milestone Mar 11, 2023
@payload
Copy link
Contributor

payload commented Mar 11, 2023

There is a wrong return value in Color::as_rgba_linear. I make a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants