bevy/crates/bevy_render
66OJ66 c6d774029c Fix panic whilst loading UASTC encoded ktx2 textures (#9158)
# Objective

Fixes #9121

Context:
- `ImageTextureLoader` depends on `RenderDevice` to work out which
compressed image formats it can support
- `RenderDevice` is initialised by `RenderPlugin`
- https://github.com/bevyengine/bevy/pull/8336 made `RenderPlugin`
initialisation async
- This caused `RenderDevice` to be missing at the time of
`ImageTextureLoader` initialisation, which in turn meant UASTC encoded
ktx2 textures were being converted to unsupported formats, and thus
caused panics

## Solution

- Delay `ImageTextureLoader` initialisation

---

## Changelog

- Moved `ImageTextureLoader` initialisation from `ImagePlugin::build()`
to `ImagePlugin::finish()`
- Default to `CompressedImageFormats::NONE` if `RenderDevice` resource
is missing

---------

Co-authored-by: 66OJ66 <hi0obxud@anonaddy.me>
2023-08-09 18:02:54 -07:00
..
macros Release 0.11.0 (#9080) 2023-07-09 08:43:47 +00:00
src Fix panic whilst loading UASTC encoded ktx2 textures (#9158) 2023-08-09 18:02:54 -07:00
Cargo.toml Release 0.11.0 (#9080) 2023-07-09 08:43:47 +00:00