bevyengine / bevyengine/bevy

Asset processing causes UiImage to panic

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

Description

## Bevy version

0.14.2

## Relevant system information

cargo 1.83.0-nightly (80d82ca22 2024-09-27)
MacOS 15.0 (Apple Silicon)

```ignore
AdapterInfo { name: "Apple M3 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
```

## What you did

With `basis-universal` asset processing, I added a `UiImage` to a node:

```rust
UiImage::new(asset_server.load("example.png")),
```

## What went wrong

wgpu Panics

```
thread 'Compute Task Pool (1)' panicked at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/util/device.rs:174:26:
range end index 56912 out of range for slice of length 56784
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::slice::index::slice_end_index_len_fail
3: as core::slice::index::SliceIndex<[T]>>::index
at /Users/tam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:465:13
4: core::slice::index:: for [T]>::index
at /Users/tam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:16:9
5: ::create_texture_with_data
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/util/device.rs:174:26
6: bevy_render::renderer::render_device::RenderDevice::create_texture_with_data
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.14.2/src/renderer/render_device.rs:169:13
7: ::prepare_asset
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.14.2/src/texture/image.rs:906:23
8: bevy_render::render_asset::prepare_assets
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.14.2/src/render_asset.rs:375:15
9: core::ops::function::FnMut::call_mut
at /Users/tam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:166:5
10: core::ops::function::impls:: for &mut F>::call_mut
at /Users/tam/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:294:13
11: Out>>::run::call_inner
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:710:21
12: Out>>::run
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:713:17
13: as bevy_ecs::system::system::System>::run_unsafe
at /Users/tam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.14.2/src/system/function_system.rs:534:19
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `bevy_render::render_asset::prepare_assets`!
```

## Additional information

I've also tried loading the image with `ImageFormat::Basis` but I get the same error. `UiImage` works fine with asset processing disabled.

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.