Porting WebGL Shaders to WebGPU
construct.net
Porting WebGL Shaders to WebGPU
1–10 of 64 posts
Re: Porting WebGL Shaders to WebGPU
#2Re: Porting WebGL Shaders to WebGPU
#3Re: Porting WebGL Shaders to WebGPU
#4Re: Porting WebGL Shaders to WebGPU
#5The confusion with `let` and `var` does seem confusing from a JS perspective, but it seems to be so that you can have the same mental model between WGSL and SPIR-V: https://github.com/gpuweb/gpuweb/issues/2207
Re: Porting WebGL Shaders to WebGPU
#6Re: Porting WebGL Shaders to WebGPU
#7Is there any advantage at this point in time to port a game to WebGPU? Is it going to run faster, or have broader browser support in the future?
There are some feature differences, like how WebGPU has compute shaders.
Re: Porting WebGL Shaders to WebGPU
#8[0] https://github.com/magcius/noclip.website/blob/e15f8045cf262... [1] https://github.com/gfx-rs/naga/
Re: Porting WebGL Shaders to WebGPU
#9Is there any advantage at this point in time to port a game to WebGPU? Is it going to run faster, or have broader browser support in the future?
WebGPU will not ship in all browsers for some time, and when it does it will not have have wider hardware support than WebGL 2. It has the potential to be faster in some cases, but the difference is unlikely to matter for most. The big draw of WebGPU should be compute shader support, though it is definitely possible to do compute work in WebGL 2 either with transform feedback or just regular shaders.
Re: Porting WebGL Shaders to WebGPU
#10I took a very different approach for porting my WebGPU shaders over: I have far too many shaders to port (sometimes pretty massive ones! [0]), so I used Naga [1] at to runtime-translate my GLSL shaders to WGSL. I had to get involved a bit upstream to fix quite a few different bugs in the implementation, but once I got it working I was really happy with the result. It's quite fast, it compiles to a pretty light-weight…