3 ms·
WGSL is the shading language, which is technically not the same thing as WebGPU. WebGPU is the graphics API, which uses WGSL as its shading language. You can f
by ChadNauseam 3y ago
WGSL is the shading language, which is technically not the same thing as WebGPU. WebGPU is the graphics API, which uses WGSL as its shading language.
You can feel free to preprocess the files any way you like, it's just not something the browser does for you (imo the correct decision). WebGPU implementations like wgpu-rs let you use any shading language that compiles to SPIR-V. My feeling is that bespoke shading languages like WGSL and GLSL are on their way out, anyway. Things like rust-gpu that allow you to write your shader code in the same language as your application code are just so much more ergonomic.
- LoganDark 3y ago> WebGPU implementations like wgpu-rs wgpu isn't exactly an implementation of WebGPU, it's just based on WebGPU (heavily inspired).
- dlivingston 3y agoI was surprised to read your comment, despite ostensibly being familiar with wgpu. But sure enough (from the homepage): > wgpu is a safe and portable graphics library for Rust based on the WebGPU API. It is suitable for general purpose graphics and compute on the GPU. > Applications using wgpu run natively on Vulkan, Metal, DirectX 11/12, and OpenGL ES; and browsers via WebAssembly on WebGPU and WebGL2.
- LoganDark 3y agoTo be fair, > Applications using wgpu run natively on Vulkan, Metal, DirectX 11/12, and OpenGL ES; and browsers via WebAssembly on WebGPU and WebGL2. is not an argument against being WebGPU, as GPU drivers don't talk WebGPU directly (for now?), and WebGPU implementations are free to use whatever backend they please, as long as they provide the right API. However, wgpu is still only based on the WebGPU API, which makes the topic of backends irrelevant anyway~