Skia with dawn

1,066 views
Skip to first unread message

sudo

unread,
Aug 23, 2023, 4:37:11 PM8/23/23
to skia-discuss
Hi, I'm a bit confused about how to use skia (M117) with dawn.

Passing only skia_use_dawn=true and trying to compile gives me this message:

ninja: error: obj/third_party/externals/dawn/src/dawn/native/webgpu_dawn_static.ninja:13: multiple rules generate obj/BUILD_DIR/gen/third_party/externals/dawn/src/dawn/native/webgpu_dawn.webgpu_dawn_native_proc.obj [-w dupbuild=err]

ninja: Entering directory `out/Static'

Any help would be appreciated.

John Stiles

unread,
Aug 25, 2023, 1:06:37 PM8/25/23
to skia-d...@googlegroups.com
Try invoking ninja like this:

    ninja -C out/Static -w dupbuild=warn

I also see the "multiple rules" message when I build Dawn, so that's normal. On my computer, it's a warning, not an error, and in practice it hasn't caused any issues (yet?). I'm not sure why you are seeing an error instead, but `-w dupbuild=warn` should let you ignore it.


--
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 on the web visit https://groups.google.com/d/msgid/skia-discuss/27ea8a63-0cb1-4c9b-b07a-9abc579e74c6n%40googlegroups.com.

sudo

unread,
Aug 25, 2023, 2:43:37 PM8/25/23
to skia-discuss
Thanks for your reply!

It seems like I at some point have moved depot_tools without updating PATH, and so a newer version of ninja got used instead. Now with PATH updated I also just get a warning and it compiles fine.

The new issue is creating the device needed by

`skgpu::graphite::ContextFactory::MakeDawn(...)`

First I try creating an instance:

`auto instance = wgpu::CreateInstance(); // program crashes`

```
// dawn_proc.c
// wgpu::CreateInstance calls this function
WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor) {
    return procs.createInstance(descriptor); // everything in procs is null and crash happens here
}
```

Any ideas what I'm doing wrong?

Also, judging by the recent commits, I take that M117 is the last version with dawn backend in ganesh?

John Stiles

unread,
Aug 25, 2023, 3:51:45 PM8/25/23
to skia-d...@googlegroups.com
Just searching the code, it looks like other places which do this first call `dawnProcSetProcs(&native::GetProcs());`.


sudo

unread,
Aug 27, 2023, 9:34:54 AM8/27/23
to skia-discuss
Nice, that worked, I followed this example just to confirm that something can be drawn and shown on screen.

So, this is where I'm at now using skia graphite:

I've created an SkSurface and want to render to screen.

How would I go about doing that?

John Stiles

unread,
Aug 30, 2023, 5:02:43 PM8/30/23
to skia-d...@googlegroups.com
That's a broad question. I would recommend looking at the built-in Viewer app that we ship with Skia. For instance, start with the GraphiteDawnWindowContext class (in tools/window) and set some breakpoints; see how it's used and where it's called.

Reply all
Reply to author
Forward
0 new messages