Add WebGPU support
Likely through a wrapper on WebGPU using vGPU and GopherJS.
Web support has been implemented, but we still need WebGPU support for 3D. This will likely not be done in time for v2 because 3D on web is a relatively low-frequency use case and browser support for WebGPU is still about 28% (https://caniuse.com/webgpu).
WebGPU now has much higher support (71.41%), and it seems like the way to go not just for web but also for native platforms, as it will allow us to bypass a ton of Vulkan issues by using https://github.com/rajveermalviya/go-webgpu. We will look into implementing WebGPU now.
To summarize the situation:
- There are two existing Go WebGPU packages: https://github.com/rajveermalviya/go-webgpu and https://github.com/mokiat/wasmgpu
- The first one provides support for WebGPU on all native platforms (macOS, Windows, Linux, iOS, and Android)
- The second one provides support for WebGPU on the web using
syscall/js - Therefore, together these two provide all of the WebGPU support we need
- However, they have slightly different APIs, although they both appear to have the fundamentals intact
- Additionally, both appear to have some extra dependencies or questionable workspace module management decisions
- Therefore, we are probably best off forking the first one and implementing a compatible API with build tags for js in the same package based on the second one
- We could probably merge this back upstream, although it doesn't really appear to be maintained, so we could also just maintain a permanent fork if necessary
- If we are confident we are moving forward with WebGPU, I can add the js WebGPU package to the native one now as described above (this would fix https://github.com/rajveermalviya/go-webgpu/issues/250).
ok please proceed with that plan. I will continue to develop using go-webgpu for now.
I filed https://github.com/rajveermalviya/go-webgpu/pull/268, so the main remaining task for basic WebGPU support on all platforms is the wgpu branch.