StarArawn / bevy_ecs_tilemap

A tilemap rendering crate for bevy which is more ECS friendly.
MIT License
863 stars 191 forks source link

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

Open teoxoy opened 1 year ago

teoxoy commented 1 year ago

https://github.com/StarArawn/bevy_ecs_tilemap/blob/3171dcb02bf3ef0183727d507005cfd354e708c6/src/render/texture_array_cache.rs#L151-L152

The current workaround is incomplete, count should not be 1 or divisible by 6.

See https://github.com/gfx-rs/wgpu/issues/3124#issuecomment-1447875760 for more context.

StarArawn commented 1 year ago

https://github.com/StarArawn/bevy_ecs_tilemap/blob/3171dcb02bf3ef0183727d507005cfd354e708c6/src/render/texture_array_cache.rs#L151-L152

The current workaround is incomplete, count should not be 1 or divisible by 6.

See gfx-rs/wgpu#3124 (comment) for more context.

I'm not sure why count shouldn't be 1 or divisible by 6? It also looks like wgpu hasn't implemented a fix yet.

rparrett commented 1 year ago

I have been meaning to test this more with opengl on the desktop, but I think that on webgl2 our users aren't really affected by this because they need to use the atlas feature to avoid another bug anyway.

I attempted this earlier, but I think there are some other criteria that had me scratching my head at the time: https://github.com/gfx-rs/wgpu/blob/9dc834a0ac694d576a584a89f72733a0bb2f4485/wgpu-hal/src/lib.rs#L884

teoxoy commented 1 year ago

I'm not sure why count shouldn't be 1 or divisible by 6?

Since we might use GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP or GL_TEXTURE_CUBE_MAP_ARRAY based on this heuristic instead of the intended GL_TEXTURE_2D_ARRAY.

rparrett commented 10 months ago

I think that the other bug I alluded to https://github.com/gfx-rs/wgpu/issues/3197 has been fixed. It doesn't seem totally necessary to use the atlas feature now, so we should probably take a look at this again.