Skip to content

Panic in wgpu_render_pass #981

@msvbg

Description

@msvbg

Bevy version

This bug is confirmed to not occur on 6b004f7, but it does occur on f54eb12. The versions in between don't compile for me, but I'm assuming this issue is related to the recent rendering optimizations.

Operating system & version

macOS 10.14.6

What you did

Minimal repro:

use bevy::prelude::*;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_resource(Option::<Entity>::None)
        .add_startup_system(startup)
        .add_system(sys)
        .run();
}

fn startup(commands: &mut Commands, mut entity: ResMut<Option<Entity>>) {
    commands.spawn(SpriteBundle::default());
    *entity = commands.current_entity();
    commands.spawn(Camera2dBundle::default());
}

fn sys(
    mut meshes: ResMut<Assets<Mesh>>,
    mesh_query: Query<&Handle<Mesh>>,
    entity: Res<Option<Entity>>,
) {
    if let Some(entity) = *entity {
        let mesh = mesh_query.get(entity).unwrap();
        meshes.get_mut(mesh);
    }
}

What actually happened

The window opens and renders a gray screen briefly, before panicking with this error message:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /Users/martin.svanberg/.cargo/git/checkouts/bevy-f7ffde730c324c74/f54eb12/crates/bevy_wgpu/src/wgpu_render_pass.rs:44:66
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions