How are shaders represented in WebAssembly?

245 views Asked by At

I've been looking into how shaders are compiled into WebAssembly, but I can't seem to find any examples. Ideally I am looking for an example that spits out a .wast with the shader compiled.

Does anyone know where I could find some examples (that hopefully create the intermediary .wast files)?

1

There are 1 answers

0
JF Bastien On BEST ANSWER

WebAssembly currently talks to the web platform exclusively through JavaScript. Interacting with the GPU is therefore done from WebAssembly by calling imported JavaScript functions, or by having JavaScript functions read the WebAssembly.Memory which the program fills with information needed to draw things.

Shaders therefore work exactly the same way they do for JavaScript.