Skip to content

When using 2D and 3D cameras, moving the 2D UI camera to a nondefault render layer causes a crash on Wasm #19167

Open
@janhohenheim

Description

@janhohenheim

Bevy version

0.16.0

Relevant system information

AdapterInfo { name: "AMD Radeon RX 7900 XTX (RADV NAVI31)", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 25.0.3", backend: Vulkan }

What you did

See #19166 for the exact setup.

What went wrong

On Wasm, when reloading the game multiple times and running around the spotlights, I sometimes get

panicked at /home/hhh/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_render-0.16.0/src/render_phase/mod.rs:779:40:
index out of bounds: the len is 0 but the index is 0

The offending line is https://github.com/bevyengine/bevy/blob/v0.16.0/crates/bevy_render/src/render_phase/mod.rs#L779

UnbatchableBinnedEntityIndexSet::Dense(dynamic_offsets) => {
    dynamic_offsets[entity_index].clone()
}

Additional information

You can see this for yourself by cloning https://github.com/janhohenheim/foxtrot/tree/nondefault-ui-cam (note the branch), running bevy run web, and running a bit around.
If it does not happen, refresh the page or reload the level by pressing Escape and try again.
On my Firefox on Fedora, I get the crash in about 1:8 tries.
Note that the crash is not instant, but happens after walking around the light for about 10 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorO-WebSpecific to web (WASM) buildsP-CrashA sudden unexpected crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions