gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.

Home Page:https://wgpu.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy_texture_to_texture does not work correct in webGL2 with array textures.

StarArawn opened this issue · comments

commented

Description
When using copy_texture_to_texture with the webGL2 backend and array textures I get invalid data displayed. It's hard to tell exactly what is going wrong since I can't really debug the code. I tried SpectorJS but it does not show individual textures.

Repro steps
Clone:
https://github.com/StarArawn/bevy_ecs_tilemap

Run(wasm/webGL2/array texture):

cargo build --target wasm32-unknown-unknown --example iso_diamond --release
wasm-server-runner .\target\wasm32-unknown-unknown\release\examples\iso_diamond.wasm

Run(wasm/webGL2/atlas):

cargo build --target wasm32-unknown-unknown --example iso_diamond --release --features atlas
wasm-server-runner .\target\wasm32-unknown-unknown\release\examples\iso_diamond.wasm

Run(desktop)

cargo run --example iso_diamond

Expected vs observed behavior
Compare with the desktop or atlas versions and you can see the issue.

Extra materials
None

Platform
Chrome/WebGL2

commented

Here are some screenshots from render doc:
image
image
The actual textures as an atlas(converted to array texture with copy_texture_to_texture):
image

As you can see we actually get some data from the original texture. My hunch is that the memory accessed for the atlas texture are incorrect but I'm not even sure where to check within wgpu for webgl2 and copy_texture_to_texture?