4 ms·
Main advantage of WebGPU is compute shader support, which allows to move more work from the CPU to the GPU with much less hassle than WebGL2, and it also moves
by flohofwoe 3y ago
Main advantage of WebGPU is compute shader support, which allows to move more work from the CPU to the GPU with much less hassle than WebGL2, and it also moves most state management from the 'render phase' into the 'initialization phase' (at the cost that almost all state is baked into immutable objects, so you better know upfront all state combinations you're going to need later during rendering).
Don't expect an automatic jump in performance when naively porting well-optimized WebGL code to WebGPU though, currently WebGPU is still in the "make it work" phase, and not yet in the "make it fast" phase. Some high-frequency calls currently have much higher overhead in WebGPU than comparable calls in WebGL2. Case in point, this 'microbenchmark' demo is slower in WebGPU than WebGL2 (in Chrome at least, haven't tested elsewhere yet):
WebGPU version: https://floooh.github.io/sokol-webgpu/drawcallperf-sapp.html https://floooh.github.io/sokol-webgpu/drawcallperf-sapp.html
WebGL2 version: https://floooh.github.io/sokol-html5/drawcallperf-sapp.html https://floooh.github.io/sokol-html5/drawcallperf-sapp.html