gfx-rs/wgpu-rs

hello-triangle example compiled for WASM panics

Closed this issue ยท 3 comments

OS: Windows 10 Version 20H2 (OS Build 19042.631)
Browser: Google Chrome Version 90.0.4400.0 (Official Build) canary (64-bit)

I followed the instructions to compile the hello-triangle example for WASM
https://github.com/gfx-rs/wgpu-rs/wiki/Running-on-the-Web-with-WebGPU-and-WebGL

Here is the panic I observed
hello-triangle.js:322 panicked at 'WGSL is not yet supported by the Web backend', src/backend/web.rs:1060:38

Please see the console log for details
localhost-1611789386151.log

Hi! ๐Ÿ‘‹ Thanks for reporting the issue!

We're currently moving our examples to use WGSL (WebGPU Shading Language) instead of SPIR-V, but WGSL isn't supported on the wasm backend yet. I think hello-triangle is the only one that has been converted on master so far, so running the other examples or your own code with SPIR-V should still work.

In the meantime you could do one of the following to get hello-triangle to work locally:

  • keep using master but load SPIR-V instead of WGSL
  • use the gecko branch or any commits that still uses SPIR-V
  • run examples besides hello-triangle

There's some more context in #679 (comment)

Hopefully this makes sense and we'll try to address this soon.

Thanks for the context, I see you were discussing breaking the other samples ๐Ÿ˜„. Also, thank you for the workarounds, and I'm excited to give WGSL a try when its ready!

Closing due to wgpu-rs -> wgpu migration and due to the likelihood of this being fixed. Please refile if this is still an issue.