Render To Texture Example Panics on WebGL
Description Attempting to run the render-to-texture example using WebGPU seems to panic on the client-side:
It appears that the returned adapter is None.
Repro steps
Clone the repo on the trunk branch, then run cargo xtask run-wasm --bin render-to-texture.
Expected vs observed behavior
Adapter to not be None, and example to run.
Extra materials
Platform Arch Linux, Rust v1.70.0
This appears to be an issue with your WebGPU implementation. Note the warning "failed to create WebGPU context provider". WebGPU isn't supported on linux on chrome yet, so if you want to run the examples, you need to run them with --features webgl
I'm getting the same error even with --features webgl: (cargo xtask run-wasm --bin render-to-texture --features webgl)
Ah fun, alright :)
Could you check to make sure https://webglreport.com/?v=2 reports no problem with webgl2?
Seems happy:
Oh, the reason is that render-to-texture only works with WebGPU right now.
I see, so is there no way to get an adapter with compatible_surface set to None on linux?
Same issue here on Linux Mint 21.2 and Chrome 117.0.5938.132.
On WebGL2, we need to get the WebGL2RenderingContext from a canvas, so you need to register a canvas surface with us before you enumerate adapters so we have a WebGL2RenderingContext to pull from.
This example does not do this, so only works on WebGPU.
Makes sense, I can confirm that after enabling experimental WebGPU support (brave --enable-unsafe-webgpu --enable-features=Vulkan,UseSkiaRenderer) the example works fine.
I have modified render_to_texture example and it works fine with WebGL. I had to pretty much just lower required limits and use a canvas for the adapter request.