core icon indicating copy to clipboard operation
core copied to clipboard

Add WebGPU support

Open kkoreilly opened this issue 2 years ago • 1 comments

Likely through a wrapper on WebGPU using vGPU and GopherJS.

kkoreilly avatar Jun 27 '23 16:06 kkoreilly

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).

kkoreilly avatar Dec 25 '23 18:12 kkoreilly

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.

kkoreilly avatar Jul 26 '24 17:07 kkoreilly

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).

kkoreilly avatar Jul 26 '24 22:07 kkoreilly

ok please proceed with that plan. I will continue to develop using go-webgpu for now.

rcoreilly avatar Jul 26 '24 23:07 rcoreilly

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.

kkoreilly avatar Jul 28 '24 00:07 kkoreilly