Pipelined texture atlas crashing with wrong texture view format
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
Pipelined-rendering branch, commit bf19ddf1917a745dee938999dc96a65a86f91b70
## Operating system & version
Windows 10
## What you did
Using the pipelined_texture_example as an example, load a single image as a texture atlas from a grid.
Attempt to both draw the whole sheet, and a single item from the sheet, in following with the example.
## What you expected to happen
Like the example, it should have drawn and not crashed.
## What actually happened
The program crashed
```
Caused by:
In Device::create_bind_group
note: label = `sprite_material_bind_group`
texture binding 0 expects sample type = Float { filterable: false }, but given a view with format = Rg16Uint
```
## Additional information
It looks like when loading an `Image` they're automatically assigned a `TextureFormat` from the image format. But as far as I could tell, the sprite shader can only use a Texture in the right format.
(The example works because the image is the correct format.)
I was able to get it to run successfully by modifying `image_to_texture` in image_texture_conversion.rs to convert all loaded images to rgba8.
Edit: I checked, and the image from the example is loaded as `Rgba8UnormSrgb`.
When converting the image to get it to work, I used this (copied from the original code, but converting the image first instead of matching) instead:
```
let i = dyn_img.into_rgba8();
width = i.width();
height = i.height();
format = TextureFormat::Rgba8UnormSrgb;
data = i.into_raw();
```
Contributor guide
Assessment
This issue has not been assessed yet.