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

Bevy 0.10 Res<AssetServer>::load(...) Causes Panic Given Valid Path #8185

Closed
asb9189 opened this issue Mar 23, 2023 · 3 comments · Fixed by #9611
Closed

Bevy 0.10 Res<AssetServer>::load(...) Causes Panic Given Valid Path #8185

asb9189 opened this issue Mar 23, 2023 · 3 comments · Fixed by #9611
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Diagnostics Logging, crash handling, error reporting and performance analysis A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@asb9189
Copy link

asb9189 commented Mar 23, 2023

Bevy version

0.10

[Optional] Relevant system information

Rust version: cargo 1.68.1 (115f34552 2023-02-26)
OS: macOS Ventura 13.2.1
AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

What you did

I created a simple Bevy project and added an 'assets' directory that is a sibling of the 'src' directory. The structure is as follows:

  • ROOT
    • assets
      • Idle.png
    • src
    • target

What went wrong

A panic occurs when trying to fetch the "Idle.png" using asset_server.load("Idle.png"). Unfortunately, I am unable to make sense of the stack trace and haven’t been able to find anything else about this issue online.

  • what were you expecting?

I would expect the application to run (without crashing) and display my Idle.png (44x47) in the center of the screen.

  • what actually happened?

panic occurs during startup_system

Additional information

Project code:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup)
        .run();
}

fn setup(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
) {
    
    commands.spawn(Camera2dBundle::default());

    commands.spawn(SpriteBundle {
        texture: asset_server.load("Idle.png"), // Causes panic
        transform: Transform::from_translation(Vec3::new(0., 0., 0.)),
        ..default()
    });
}

Log:

Caused by:
    In Device::create_bind_group
      note: label = `sprite_material_bind_group`
    texture binding 0 expects sample type = Float { filterable: true }, but given a view with format = Rgba16Uint

', /Users/aleksei/.cargo/registry/src/{github}/wgpu-0.15.1/src/backend/direct.rs:3024:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (3)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', /Users/aleksei/.cargo/registry/src/{github}/bevy_ecs-0.10.0/src/schedule/executor/multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /Users/aleksei/.cargo/registry/src/{github}/bevy_tasks-0.10.0/src/task_pool.rs:376:49
thread 'Compute Task Pool (3)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /Users/aleksei/.cargo/registry/src/{github}/bevy_render-0.10.0/src/pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/aleksei/.cargo/registry/src/{github}/bevy_tasks-0.10.0/src/task_pool.rs:376:49
@asb9189 asb9189 added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Mar 23, 2023
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds A-Rendering Drawing game state to the screen A-Diagnostics Logging, crash handling, error reporting and performance analysis and removed S-Needs-Triage This issue needs to be labelled labels Mar 23, 2023
@alice-i-cecile
Copy link
Member

Hmm, that's not a very useful error message at all. It looks like your asset isn't being processed properly.

@tim-blackbird
Copy link
Contributor

16-bit pngs are not supported currently. See #7005

@asb9189
Copy link
Author

asb9189 commented Mar 30, 2023

Does the Bevy team plan on supporting 16-bit pngs in the near future? Is there anything I could be doing/using to use my pngs in the meantime? @devil-ira

The project I'm working on relies on a several 16-bit pngs.

github-merge-queue bot pushed a commit that referenced this issue Sep 6, 2023
# Objective

fix  #8185, #6710
replace #7005 (closed)

rgb and rgba 16 bit textures currently default to `Rgba16Uint`, the more
common use is `Rgba16Unorm`, which also matches the default type of rgb8
and rgba8 textures.

## Solution

Change default to `Rgba16Unorm`
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…9611)

# Objective

fix  bevyengine#8185, bevyengine#6710
replace bevyengine#7005 (closed)

rgb and rgba 16 bit textures currently default to `Rgba16Uint`, the more
common use is `Rgba16Unorm`, which also matches the default type of rgb8
and rgba8 textures.

## Solution

Change default to `Rgba16Unorm`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Diagnostics Logging, crash handling, error reporting and performance analysis 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