bevyengine / bevyengine/bevy

WGPU renderer panics on `ColorMaterial` edition

Open
#2,679 3 comments 0 reactions 0 assignees View on GitHub
A-Assets A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.5.0

## Operating system & version

MacOS Big Sur

## What you did

Have a `ColorMaterial` like this:

```rust
let mat = materials.add(ColorMaterial {
color: Color::WHITE,
texture: asset_server.load("my_texture.png")
});
```

Edit the material removing the texture:

```
let material = materials.get_mut(mat.clone()).unwrap();
material.texture = None;
```

The texture is corretly removed.

Now edit the material back:

```
let material = materials.get_mut(mat.clone()).unwrap();
material.texture = Some(asset_server.load("my_texture.png"));
```

## What you expected to happen

The material should have its texture back

## What actually happened

The program panics:

```
thread 'main' panicked at 'TextureId(b6c3f65b-1c59-443d-8787-1dc9f6d9fa74)', /Users/Me/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.5.0/src/renderer/wgpu_render_resource_context.rs:554:52
```
or
```
thread 'Compute Task Pool (2)' panicked at 'TextureId(fb1f8e83-4b2b-42fd-9152-2842cd76effc)', /Users/Me/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_wgpu-0.5.0/src/renderer/wgpu_render_resource_context.rs:554:52
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.