Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index out of bounds error #3124

Closed
evanshabsove opened this issue Oct 19, 2022 · 3 comments
Closed

Index out of bounds error #3124

evanshabsove opened this issue Oct 19, 2022 · 3 comments
Labels
api: gles Issues with GLES or WebGL good first issue Good for newcomers help required We need community help to make this happen. type: bug Something isn't working

Comments

@evanshabsove
Copy link

Description
Hi there, I am trying to compile a bevy app I've built for wasm. When I run the file in the browser I get the following error in the console

panicked at 'index out of bounds: the len is 6 but the index is 6', /Users/macbook/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.13.2/src/gles/queue.rs:358:25

I'm just trying to figure out what could be going wrong, I've made a discussion thread in the Bevy github group as well

bevyengine/bevy#6302

Which has some additional information

Repro steps
You could try running my game (it's pretty basic and poor lol)

https://github.com/evanshabsove/chat_platformer

running bash run-wasm.sh should generate the file

Expected vs observed behavior
Game runs in browser as expected

Extra materials
Screenshots to help explain your problem.
Validation logs can be attached in case there are warnings and errors.
Zip-compressed API traces and GPU captures can also land here.

Platform
MacOS Monterey V 12.6, Graphics AMD Radeon Pro 5300M

@cwfitzgerald cwfitzgerald added type: bug Something isn't working help required We need community help to make this happen. good first issue Good for newcomers api: gles Issues with GLES or WebGL labels Oct 19, 2022
@tauseefk
Copy link

tauseefk commented Feb 28, 2023

@evanshabsove were you able to put together a workaround?
I just ran into the same problem trying to deploy my Bevy + WASM prototype with Trunk.
In the past I've used WASM pack and a separate web repo with a Git workflow to deploy on pages, however I'd prefer to save some time and let Trunk handle it so I can focus on actually building the game.

Right after posting this, I found a solution to the problem: https://github.com/janos-r/rusty-woods/blob/161403c14184b14f27981a58e1ba4f06650b22a3/Cargo.toml#L18
Enabling the atlas feature on bevy_ecs_tilemap for the wasm target fixed the problem. Hope that helps

@teoxoy
Copy link
Member

teoxoy commented Feb 28, 2023

On GLES, we force cube compatible textures to be cube textures since we need to infer the view type at creation time.

// HACK: detect a cube map; forces cube compatible textures to be cube textures
match (desc.is_cube_compatible(), desc.size.depth_or_array_layers) {
(false, 1) => (glow::TEXTURE_2D, false, false),
(false, _) => (glow::TEXTURE_2D_ARRAY, true, false),
(true, 6) => (glow::TEXTURE_CUBE_MAP, false, true),
(true, _) => (glow::TEXTURE_CUBE_MAP_ARRAY, true, true),
}

A possible solution for this is tracked by #1614.

@teoxoy
Copy link
Member

teoxoy commented Feb 28, 2023

I think for now this can be worked around in bevy_ecs_tilemap, opened StarArawn/bevy_ecs_tilemap#395.

Let's track progress on this front in #1614.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
Imberflur added a commit to IsseW/bevy_ecs_tilemap that referenced this issue Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: gles Issues with GLES or WebGL good first issue Good for newcomers help required We need community help to make this happen. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants