WebGPU Viewer #2983
Conversation
Move ESSL, Vulkan GLSL, and WGSL generator sources into dedicated essl/, vk/, and wgsl/ subfolders under MaterialXGenGlsl. Update include paths in JavaScript bindings, Python bindings, unit tests, and MaterialXView.
Introduce GlslToWgsl helper that works with binding context and syntax support.
Add a WebGPU rendering path alongside the existing WebGL one. The viewer generates WGSL WgslShaderGenerator and routes it to Three.js TSL NodeMaterial. - mxtsladapter.js: mtlx WGSL -> TSL bridge - wgslmanifest.js: reflection manifest for wgsl shader
|
Hello @ashwinbhat! I'm really happy to see these steps forward for WebGPU support, which has long been a goal for MaterialX. I have some questions, though, that I think are worth working through before we commit to a direction, mostly about the scope of the PR and the long-term shape of the WGSL path:
|
Thanks for taking an initial look, it was draft PR to get some early input and possible more interested contributors 😉 The folder reorganization is independent from WebGPU and can be split up into a separate PR. The reorg is mainly for clarity while working with the code. Unlike other sibling generators, GLSL generator is getting extended to multiple targets. I found this a little confusing while onboarding new developers, and I think reorganizing will be helpful though not required. Regarding the bespoke transpiler for wgsl, I have the same concerns as you do and I would like to seek input from community.
I'll continue to explore other options that might be more acceptable and meet our desired goals. |
Reorganize GLSL based shader generators into sub folders.
Update WGSL shader generator to replace GLSL with wgsl. Introduce GlslToWgsl helper that works with binding context and syntax support.
Add a WebGPU rendering path alongside the existing WebGL one.
The viewer generates WGSL WgslShaderGenerator and routes it to Three.js TSL NodeMaterial.
This work is towards these issues:
#2558
#2751