Webgl warning when performing buffer readback in web
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
main at commit `aa56d4831ac63f95e1fe158ec794d8fe53695063`
## \[Optional\] Relevant system information
```ignore
`AdapterInfo { name: "ANGLE (AMD, GFX1103_R1 (gfx1103_r1 LLVM 15.0.7), OpenGL 4.6)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "WebGL 2.0 (OpenGL ES 3.0 Chromium)", backend: Gl }`
```
## What you did
I have written a simplified version of the headless_renderer example that performs a readback from a render target to the main world and outputs a summary of what is in the buffer to the console. This is so I can test it on wasm.
## What went wrong
Both on chromium and firefox the example produces a webgl warning.
On chromium:
`performance warning: READ-usage buffer was read back without waiting on a fence. This caused a graphics pipeline stall.`
On firefox:
`WebGL warning: getBufferSubData: Reading from a buffer without checking for previous command completion likely causes pipeline stalls. Please use FenceSync.`
I was expecting no warning.
## Additional information
The example (`readback_wasm`) is available [on this fork](https://github.com/m-edlund/bevy/tree/minimal-wasm-readback-example), and includes a helper bash script that compiles the example to wasm and serves it.
The message from firefox implies that the [fenceSync()](https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/fenceSync) function should be used, but it seems there is no way to explicitly do this in wgpu.
Contributor guide
Assessment
This issue has not been assessed yet.