Canvaskit doesn't build for webgpu

21 views
Skip to first unread message

Bruno Nicoletti

unread,
Nov 11, 2024, 3:08:39 PMNov 11
to skia-discuss
Hi,

Canvaskit doesn't build with webgpu enabled, even though the Makefile and the .gn file have flags, and the .cpp and .js have code for it. I built it via a 'make release_webgpu' command in the canvaskit directory.

Digging into it, the canvaskit BUILD.gn file never actually sets the "CK_ENABLE_WEBGPU" preprocessor macro. If I do set this it fails to compile the .cpp file as there are calls to unknown functions, for example....

../../modules/canvaskit/canvaskit_bindings.cpp:352:29: error: no member named 'MakeDawn' in 'GrDirectContext'
  352 |     return GrDirectContext::MakeDawn(device, options);

Is WebGPU support for canvaskit still a work in progress?

FWIW WebGL works happily when building as 'make release'.

My checkout is 11046fd10394ec5dbe996ec4eeabc7b3a74e8f1f

thanks

Bruno

William Candillon

unread,
Nov 11, 2024, 3:38:09 PMNov 11
to skia-discuss
I think that because CanvasKit is using Ganesh and Ganesh doesn't support WebGPU, it is not possible to make the two work together. I think one would have to write it's own WASM Skia build. 
I would love to learn what would be a good starting point for doing so. I'm also quite interested in using Skia on the Web with WebGPU. 

Kind regards,

William

Bruno Nicoletti

unread,
Nov 12, 2024, 7:50:29 AMNov 12
to skia-discuss
The build scripts turn off Ganesh if webgpu is specified and enables Graphite instead. So that's been taken care of.

Bruno Nicoletti

unread,
Nov 12, 2024, 8:07:47 AMNov 12
to skia-discuss
Digging around a bit more it looks like the webgpu is an incomplete work in progress. There are a whole bunch of missing functions it relies on, for example `GrDirectContext::MakeDawn` doesn't exist anywhere I can find in the code base.

There is a note that seems to imply the work is being left until an emscripten bindings are available for webgpu. In which case I'll just ignore it and rely on webgl for my own work.

Brian Salomon

unread,
Nov 12, 2024, 12:58:01 PMNov 12
to skia-d...@googlegroups.com
Ganesh (GrDirectContext, etc) does not support WebGPU. There was an incomplete implementation that has been deleted. The newer GPU backend, Graphite (skgpu::graphite::Context skgpu::graphite::Recorder, etc), does work on webgpu. However, there are no CanvasKit or other JS bindings provided with Skia.

Brian

-- 
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/skia-discuss/431578c3-2ef4-4c8d-b856-e0c3a68f79efn%40googlegroups.com.

Bruno Nicoletti

unread,
Nov 12, 2024, 1:26:55 PMNov 12
to skia-d...@googlegroups.com
Thank you. I might have a dig around at some point later on.

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/zwgonSRbmkQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/skia-discuss/3703B9A5-5DE6-4416-A571-30E46D01BEF4%40pentrek.com.
Reply all
Reply to author
Forward
0 new messages