Skip to content

Commit

Permalink
Improve workaround for wgpu's gles texture type inference
Browse files Browse the repository at this point in the history
* Remove unnecessary feature flag (`atlas`) from WebGL2 section
  • Loading branch information
teohhanhui committed Sep 3, 2024
1 parent ac311b0 commit 55bb289
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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

0 comments on commit 55bb289

Please sign in to comment.