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

Improve workaround for wgpu's gles texture type inference #557

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ After that's installed and configured, run:
#### WebGL2

```bash
cargo run --target wasm32-unknown-unknown --example animation --features atlas
cargo run --target wasm32-unknown-unknown --example animation
```

**Note**: You **must** use the `atlas` feature when targeting the web with WebGL2. See [#283](https://github.com/StarArawn/bevy_ecs_tilemap/issues/283).

#### WebGPU

WebGPU is not yet well [supported](https://caniuse.com/webgpu) by many browsers.
Expand Down
8 changes: 6 additions & 2 deletions src/render/texture_array_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@ impl TextureArrayCache {
let (count, tile_size, _, _, filter, format) =
self.meta_data.get(texture).unwrap();

// Fixes weird cubemap bug.
let count = if *count == 6 { count + 1 } else { *count };
// Fixes issue where wgpu's gles texture type inference fails.
let count = if *count == 1 || count % 6 == 0 {
count + 1
} else {
*count
};

let gpu_texture = render_device.create_texture(&TextureDescriptor {
label: Some("texture_array"),
Expand Down
Loading