You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mono/skia: Graphite-on-WebGPU patches for Emscripten
Threads Skia's Graphite/Dawn backend through Emscripten's bundled
WebGPU shim (-sUSE_WEBGPU=1) so it links cleanly into libSkiaSharp.a
under is_canvaskit=true. Five surgical edits:
* include/c/sk_graphite_dawn.h + src/c/sk_graphite_dawn.cpp -- new
sk_graphite_dawn_backend_texture_new C entry point that wraps a
caller-supplied WGPUTexture (e.g. canvas.getContext('webgpu')
.getCurrentTexture()) via BackendTextures::MakeDawn. The wrapper
does not retain or release the WGPUTexture; any SkSurface/SkImage
that wraps it will retain for its own lifetime.
* src/gpu/graphite/dawn/DawnCaps.cpp -- guard YCbCr/biplanar texture
formats (R8BG8Biplanar420Unorm, R10X6BG10X6Biplanar420Unorm,
R8BG8A8Triplanar420Unorm, OpaqueYCbCrAndroid, DualSourceBlending,
TextureFormatsTier1) under #if !defined(__EMSCRIPTEN__). These
wgpu::TextureFormat enum values do not exist in Emscripten's
bundled webgpu_cpp.h and would fail to compile.
* src/gpu/graphite/dawn/DawnBuffer.cpp -- replace SKGPU_LOG(...) macro
with explicit SKGPU_LOG_D / SKGPU_LOG_E; Emscripten's preprocessor
rejects the macro form in this position.
* third_party/dawn/BUILD.gn -- skip the native Dawn CMake build AND
the libdawn_combined.a link step when is_canvaskit=true. On
Emscripten the wgpu_* symbols are provided by -sUSE_WEBGPU=1 at
the consumer's final link step; building native Dawn for WASM is
both unnecessary and breaks (the Dawn CMake build assumes desktop
toolchains).
Build prerequisite (out-of-tree): externals/dawn requires one extra
#include in third_party/externals/dawn/include/tint/tint.h --
'src/tint/api/common/bindings.h'. Dawn isn't a git submodule of skia
(it is checked out via DEPS), so we cannot land that patch here.
Apply it separately if a fresh DEPS sync is needed and Dawn pre-m146.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments