WebGPU needs you: write a WASM library for (web-)HLSL to SPIRV translation

WebGPU is a new work-in-progress web API for programming graphics and compute on GPU. It’s being designed in W3C community group by all major browser vendors.

We haven’t still reached the consensus on the shading language, and some parties are promoting WebHLSL to be specified and used as a primary digestion format. See the positions expressed in issues on Github: binary/SPIR-V versus text format.

We are looking for help on creating a WASM library that would translate the WebHLSL to SPIR-V, since our implementation is based on gfx-hal, which understands SPIR-V. This way, we could support both WebHLSL and SPIR-V digested into WebGPU. The library needs to be robust, small, and fast.

If you want to help, you’d probably need to know how to write Rust parser, and roughly how SPIR-V is structured. To start, one can treat WebHLSL as a regular HLSL until the specification is ready, at which point it would be nice to generate the grammar based on it. We’ll be happy to provide all necessary details.

6 Likes

What's the state of this one, Kvark? I'm familiar with GLSL, so I can pick up HLSL pretty quick. I've written 3D slicers, so a transpiler shouldn't be too heavy. I'm still fairly new with Rust, but getting better. Most importantly, I've got some time to spare.

Thank you for your interest!
We haven't made any progress on this. Besides, WebHLSL hasn't happened. Instead, there is WSL as described in the WebKit blog. The problem here is that we nigher know if WSL is here to say in the same shape it is now, nor whether it will be a part of WebGPU. So it's not clear at this point what should be done :confused:

So no point in chewing my way through WSL yet? Please feel free to assign me something that would be helpful. Ideally something I can develop some useful GPU skills with too.

I think so, yes.

The biggest sub-project that we've been struggling to kick off is Javelin. We need it to power both gfx-rs and our WebGPU implementation for generating platform-specific shaders as well as validating, transforming, and optimizing SPIR-V sources.

Current battlefield for Javelin is getting the Structured Representation in rspirv. See also our requirements. If you want to help, try getting familiar with rspirv code and check the open PRs for the current progress and discussions. Chime in to our underground gitter for discussion, we'll be happy to get you rolling!

2 Likes

Ok, I'll get up to speed on Javelin & see what I can do to move it forward. Thanks, Kvark.

2 Likes