Graphite & emdawnwebgpu

71 views
Skip to first unread message

Oliver Larkin

unread,
Jan 4, 2026, 9:26:39 PMJan 4
to skia-d...@googlegroups.com
Hello,

what is the status of using graphite with dawn in the browser?

Thanks

Oli

null

unread,
Jan 6, 2026, 10:17:20 AMJan 6
to skia-discuss
Skia’s GraphiteDawn backend is enabled by default.  chrome://gpu should tell you.  

Oliver Larkin

unread,
Jan 8, 2026, 6:13:57 PMJan 8
to skia-discuss
what i mean is, is it currently possible to use skia graphite in a C++ app compiled to wasm via emscripten with wgpu in the browser.

Sowmyyy Reanz

unread,
Jan 9, 2026, 10:31:16 AMJan 9
to skia-discuss
Hi team, 
We also use skia in c++ and compiled to DLL or nuget package to render in windows with ganesh.
Does Graphite support multithreading? If so, how does it handle multithreaded execution? Is its behavior similar to Direct Context multithreading support?

Is it 100% stable to adopt for windows D3D12 now?
Which version of skia can be used for it now?
kindly share any documentation to read about it

Oliver Larkin

unread,
Jan 12, 2026, 2:34:31 AMJan 12
to skia-discuss
analysis of the problem courtesy of claude:

# Skia Graphite + Emscripten 4.x WebGPU Compatibility Issues


## Environment

- Skia: main branch (commit 487a994)

- Emscripten: 4.0.7 (bundled with Skia)

- Build config: `skia_enable_graphite=true`, `skia_use_dawn=true`, `skia_use_webgpu=true` for WASM target


## Problem Summary


When building Skia with Graphite for WASM, there are multiple WebGPU API mismatches between Skia's Dawn-based Graphite code and Emscripten's `webgpu.h` headers. The APIs have diverged as the WebGPU spec stabilized.


## Issue 1: Dawn/Tint CMake build missing `tint::Bindings` type


When Dawn builds for WASM via CMake, it disables all backend writers:

```

-DTINT_BUILD_SPV_WRITER=0

-DTINT_BUILD_MSL_WRITER=0

-DTINT_BUILD_HLSL_WRITER=0

-DTINT_BUILD_GLSL_WRITER=0

```


But `tint::Bindings` and `tint::ExternalTexture` (defined in `src/tint/api/common/bindings.h`) are only included via backend writer headers. Dawn native code (`TintUtils.h`) expects these types but they're not available.


**Fix**: Add `#include "src/tint/api/common/bindings.h"` to `include/tint/tint.h`


## Issue 2: WebGPU type renames


Skia's Graphite code uses old WebGPU type names that don't exist in Emscripten 4.x:


| Skia expects | Emscripten 4.x has |

|--------------|-------------------|

| `wgpu::ImageCopyBuffer` | `wgpu::TexelCopyBufferInfo` |

| `wgpu::ImageCopyTexture` | `wgpu::TexelCopyTextureInfo` |

| `wgpu::ShaderModuleWGSLDescriptor` | `wgpu::ShaderSourceWGSL` |

| `wgpu::RenderPassTimestampWrites` | `wgpu::PassTimestampWrites` |

| `wgpu::ComputePassTimestampWrites` | `wgpu::PassTimestampWrites` |

| `wgpu::VertexStepMode::VertexBufferNotUsed` | (removed) |


## Issue 3: Inverted `#ifdef` logic


In `DawnGraphiteUtils.cpp` and `DawnResourceProvider.cpp`, the compatibility code is backwards:


```cpp

#if defined(__EMSCRIPTEN__)

    wgpu::ShaderModuleWGSLDescriptor wgslDesc;  // OLD name - doesn't exist in Emscripten 4.x!

#else

    wgpu::ShaderSourceWGSL wgslDesc;  // NEW name

#endif

```


Emscripten 4.x uses the NEW names, not the old ones.


## Issue 4: `OnSubmittedWorkDone` API change


Old API (what Skia uses):

```cpp

queue.OnSubmittedWorkDone(callback, userdata);

```


New API (Emscripten 4.x):

```cpp

queue.OnSubmittedWorkDone(CallbackMode, callback, userdata);

```


## Files affected

- `src/gpu/graphite/dawn/DawnCommandBuffer.cpp`

- `src/gpu/graphite/dawn/DawnGraphiteUtils.cpp`

- `src/gpu/graphite/dawn/DawnResourceProvider.cpp`

- `src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp`

- `src/gpu/graphite/dawn/DawnQueueManager.cpp`

- `third_party/externals/dawn/include/tint/tint.h`


## Reproduction

```bash

# In Skia repo with Emscripten 4.0.7

gn gen out/wasm --args='target_os="wasm" skia_enable_graphite=true skia_use_dawn=true skia_use_webgpu=true skia_enable_ganesh=false'

ninja -C out/wasm

```


## Notes

- CanvasKit currently uses Ganesh, not Graphite, for WASM

- The Emscripten WebGPU headers follow the finalized WebGPU spec

- Dawn's native headers may still use older names for compatibility

Reply all
Reply to author
Forward
0 new messages