skia2/experimental
Kevin Lubick 262dfbafb4 [experimental] Add WebGPU demo (built with Bazel)
This uses the Bazel rule wasm_cc_binary, which is defined
in @emsdk [1]

Note that wasm_cc_binary does not have a linkopts argument
defined, so we instead put any emcc options in the cc_binary
target.

This works around a few bugs in the emsdk Bazel rules:
 - https://github.com/emscripten-core/emsdk/issues/907
 - https://github.com/emscripten-core/emsdk/issues/807

Prior to PS 5, this CL tried a different way to bring in
the toolchain, a more manual way outlined in [2].

A similar approach (modifying the .bazelrc and specifying
the toolchain directly) might be necessary at some point,
but can probably still be done using the @emsdk Bazel rules
and --config=wasm.

To update the version of emscripten used, we just need to
update the parameter in the WORKSPACE call to emsdk_emscripten_deps().

The example/index.html file in this CL does exactly the same
as [3], except the WebGPU calls are made from C++ via WASM.
I made heavy use of these examples [4], [5] while exploring
APIs. What was also useful was looking at the emscripten
source headers [6], [7], [8], [9].

I also learned a lot about WebGPU from [10].

[1] 3891e7b04b/bazel/emscripten_toolchain/wasm_cc_binary.bzl
[2] https://hackernoon.com/c-to-webassembly-using-bazel-and-emscripten-4him3ymc
[3] 206c1f3f7e/demos.skia.org/demos/webgpu/index.html
[4] https://github.com/kainino0x/webgpu-cross-platform-demo
[5] https://github.com/Twinklebear/wgpu-cpp-starter
[6] 5e6c74153b/system/include/emscripten/html5_webgpu.h
[7] 5e6c74153b/system/include/webgpu/webgpu.h
[8] 5e6c74153b/system/include/webgpu/webgpu_cpp.h
[9] 5e6c74153b/src/library_html5_webgpu.js (L24)
[10] https://alain.xyz/blog/raw-webgpu

Change-Id: Iff33b72e7265200b2caacbc03e5fcc06a650b56b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457396
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-10-12 18:34:55 +00:00
..
c-api-example Fix C API example, ensure the C API example is built in CI 2020-12-15 16:38:42 +00:00
docs runs some sample animations side by side in canvas and svg 2015-11-16 13:36:08 -08:00
documentation Update references to master branch 2021-05-21 15:18:16 +00:00
ffmpeg Remove ableist language 2021-06-16 21:37:21 +00:00
graphite [graphite] Remove the skpu::geom namespace 2021-10-12 17:55:07 +00:00
lowp-basic Rewrite #includes to satisfy presubmit. 2021-10-01 18:31:26 +00:00
minimal_ios_mtl_skia_app roll gn to latest 2021-01-15 15:34:00 +00:00
pvg add pvg experiment 2018-11-02 15:35:21 +00:00
skottiekit [infra] Deduplicate serve.py 2021-10-12 11:42:50 +00:00
skrive Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
sktext Font resolution just started 2021-09-27 16:25:50 +00:00
sorttoy Rename experimental app to 'sorttoy' 2021-07-01 19:11:26 +00:00
tools Add sleep option to web_to_(skp|mskp) shell scripts. 2020-06-19 19:06:29 +00:00
tskit [infra] Deduplicate serve.py 2021-10-12 11:42:50 +00:00
wasm-skp-debugger [infra] Deduplicate serve.py 2021-10-12 11:42:50 +00:00
webgpu-bazel [experimental] Add WebGPU demo (built with Bazel) 2021-10-12 18:34:55 +00:00
xform Reland "Simplify SkRasterClip now that it's only intersect/diff" 2021-08-31 18:16:31 +00:00
xps_to_png experimental/xps_to_png: pass in DPI as program argument 2016-11-14 15:39:09 +00:00