Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
fonts/ | 23-Nov-2023 | - | 4 | 2 | ||
future_apis/ | 23-Nov-2023 | - | 81 | 57 | ||
htmlcanvas/ | 23-Nov-2023 | - | 2,229 | 1,843 | ||
npm_build/ | 23-Nov-2023 | - | 8,185 | 4,655 | ||
tests/ | 23-Nov-2023 | - | 6,074 | 4,848 | ||
wasm_tools/ | 23-Nov-2023 | - | 488 | 237 | ||
.gitignore | D | 23-Nov-2023 | 124 | 5 | 5 | |
BUILD.gn | D | 23-Nov-2023 | 1.9 KiB | 56 | 53 | |
CHANGELOG.md | D | 23-Nov-2023 | 38.5 KiB | 808 | 658 | |
Makefile | D | 23-Nov-2023 | 4.1 KiB | 124 | 92 | |
README.md | D | 23-Nov-2023 | 6.5 KiB | 140 | 104 | |
WasmCommon.h | D | 23-Nov-2023 | 1.3 KiB | 45 | 23 | |
canvaskit_bindings.cpp | D | 23-Nov-2023 | 99.7 KiB | 2,043 | 1,757 | |
catchExceptionNop.js | D | 23-Nov-2023 | 474 | 14 | 6 | |
color.js | D | 23-Nov-2023 | 6.8 KiB | 201 | 146 | |
compile.sh | D | 23-Nov-2023 | 11.9 KiB | 411 | 340 | |
compile_gm.sh | D | 23-Nov-2023 | 7.7 KiB | 260 | 201 | |
cpu.js | D | 23-Nov-2023 | 4.7 KiB | 112 | 71 | |
debug.js | D | 23-Nov-2023 | 79 | 5 | 4 | |
externs.js | D | 23-Nov-2023 | 29.3 KiB | 1,170 | 935 | |
font.js | D | 23-Nov-2023 | 10.6 KiB | 288 | 218 | |
gm.js | D | 23-Nov-2023 | 1.5 KiB | 50 | 40 | |
gm_bindings.cpp | D | 23-Nov-2023 | 12.5 KiB | 363 | 266 | |
gpu.js | D | 23-Nov-2023 | 4.9 KiB | 110 | 77 | |
helper.js | D | 23-Nov-2023 | 6.8 KiB | 244 | 121 | |
interface.js | D | 23-Nov-2023 | 45.4 KiB | 1,181 | 847 | |
karma.conf.js | D | 23-Nov-2023 | 3.1 KiB | 94 | 48 | |
karma.google3.conf.js | D | 23-Nov-2023 | 1.3 KiB | 22 | 10 | |
matrix.js | D | 23-Nov-2023 | 17.4 KiB | 535 | 383 | |
memory.js | D | 23-Nov-2023 | 12.6 KiB | 376 | 225 | |
package.json | D | 23-Nov-2023 | 481 | 23 | 22 | |
paragraph.js | D | 23-Nov-2023 | 12.3 KiB | 301 | 235 | |
paragraph_bindings.cpp | D | 23-Nov-2023 | 26 KiB | 646 | 518 | |
paragraph_bindings_gen.cpp | D | 23-Nov-2023 | 4.9 KiB | 102 | 77 | |
particles.js | D | 23-Nov-2023 | 2.5 KiB | 72 | 48 | |
particles_bindings.cpp | D | 23-Nov-2023 | 6.6 KiB | 181 | 139 | |
pathops.js | D | 23-Nov-2023 | 439 | 18 | 15 | |
postamble.js | D | 23-Nov-2023 | 127 | 3 | 1 | |
preamble.js | D | 23-Nov-2023 | 376 | 9 | 1 | |
release.js | D | 23-Nov-2023 | 205 | 6 | 3 | |
rt_shader.js | D | 23-Nov-2023 | 2.2 KiB | 45 | 27 | |
serve.py | D | 23-Nov-2023 | 508 | 21 | 9 | |
skottie.js | D | 23-Nov-2023 | 5.2 KiB | 145 | 96 | |
skottie_bindings.cpp | D | 23-Nov-2023 | 15.2 KiB | 387 | 304 | |
skp.js | D | 23-Nov-2023 | 594 | 18 | 14 | |
util.js | D | 23-Nov-2023 | 370 | 19 | 10 | |
viewer_bindings.cpp | D | 23-Nov-2023 | 2.7 KiB | 73 | 60 |
README.md
1# Prerequisites 2 3To compile CanvasKit, you will first need to [install `emscripten`][1]. This 4will set the environment `EMSDK` (among others) which is required for 5compilation. Which version should you use? [`/infra/wasm-common/docker/emsdk-base/Dockerfile`][2] 6shows the version we build and test with. We try to keep this up-to-date. 7 8[1]: https://emscripten.org/docs/getting_started/downloads.html 9[2]: https://github.com/google/skia/blob/master/infra/wasm-common/docker/emsdk-base/Dockerfile 10 11This document also assumes you have followed the instructions to download Skia and its deps 12<https://skia.org/user/download>. 13 14## MacOS specific notes 15Make sure you have Python3 installed, otherwise the downloading emscripten toolchain 16can fail with errors about SSL certificates. <https://github.com/emscripten-core/emsdk/pull/273> 17 18See also <https://github.com/emscripten-core/emscripten/issues/9036#issuecomment-532092743> 19for a solution to Python3 using the wrong certificates. 20 21# Compile and Run Local Example 22 23``` 24make release # make debug is much faster and has better error messages 25make local-example 26``` 27 28This will print a local endpoint for viewing the example. You can experiment 29with the CanvasKit API by modifying `./npm_build/example.html` and refreshing 30the page. For some more experimental APIs, there's also `./npm_build/extra.html`. 31 32For other available build targets, see `Makefile` and `compile.sh`. 33For example, building a stripped-down version of CanvasKit with no text support or 34any of the "extras", one might run: 35 36 ./compile.sh no_skottie no_particles no_font 37 38Such a stripped-down version is about half the size of the default release build. 39 40# Unit tests, performance tests, and coverage. 41 42To run unit tests and compute test coverage on a debug gpu build 43 44``` 45make debug 46make test-continuous 47``` 48 49This reads karma.conf.js, and opens a chrome browser and begins running all the test 50in `test/` it will detect changes to the tests in that directory and automatically 51run again, however it will automatically rebuild and reload canvaskit. Closing the 52chrome window will just cause it to re-opened. Kill the karma process to stop continuous 53monitoring for changes. 54 55The tests are run with whichever build of canvaskit you last made. be sure to also 56test with `release`, `debug_cpu`, and `release_cpu`. testing with release builds will 57expose problems in closure compilation and usually forgotten externs. 58 59## Coverage 60 61Coverage will be automatically computed when running test-continuous locally. Note that 62the results will only be useful when testing a debug build. Open 63`coverage/<browser version>/index.html` For a summary and detailed line-by-line result. 64 65## Measuring Performance 66 67We use puppeteer to run a Chrome browser to gather performance data in a consistent way. 68See //tools/perf-canvaskit-puppeteer for more. 69 70## Adding tests 71 72The tests in `tests/` are grouped into files by topic. 73Within each file there are `describe` blocks further organizing the tests, and within those 74`it()` functions which test particular behaviors. `describe` and `it` are jasmine methods 75which can both be temporarily renamed `fdescribe` and `fit`. Which causes jasmine to only those. 76 77We have also defined `gm` which is a method for defining a test which draws something to a canvas 78that is shapshotted and reported to gold.skia.org, where you can compare it with the snapshot at 79head. 80 81## Testing from Gerrit 82 83When submitting a CL in gerrit, click "choose tryjobs" and type canvaskit to filter them. 84select all of them, which at the time of this writing is four jobs, for each combination 85of perf/test gpu/cpu. 86 87The performance results are reported to perf.skia.org 88gold results are reported to gold.skia.org 89 90Coverage is not measured while running tests this way. 91 92# Inspecting output WASM 93 94The `wasm2wat` tool from [the WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt) 95can be used to produce a human-readable text version of a `.wasm` file. 96 97The output of `wasm2wat --version` should be `1.0.13 (1.0.17)`. This version has been checked to 98work with the tools in `wasm_tools/SIMD/`. These tools programmatically inspect the `.wasm` output 99of a CanvasKit build to detect the presence of [wasm SIMD](https://github.com/WebAssembly/simd) 100operations. 101 102# Infrastructure Playbook 103 104When dealing with CanvasKit (or PathKit) on our bots, we use Docker. Check out 105$SKIA_ROOT/infra/wasm-common/docker/README.md for more on building/editing the 106images used for building and testing. 107 108## Updating the version of Emscripten we build/test with 109 110This presumes you have updated emscripten locally to a newer version of the 111sdk and verified/fixed any build issues that have arisen. 112 113 1. Edit `$SKIA_ROOT/infra/wasm-common/docker/emsdk-base/Dockerfile` to install 114 and activate the desired version of Emscripten. 115 2. Edit `$SKIA_ROOT/infra/wasm-common/docker/Makefile` to have `EMSDK_VERSION` be 116 set to that desired version. If there is a suffix that is not `_v1`, reset 117 it to be `_v1`. If testing the image later does not work and edits are made 118 to the emsdk-base Dockerfile to correct that, increment to `_v2`,`_v3`, etc 119 to force the bots to pick up the new image. 120 3. In `$SKIA_ROOT/infra/wasm-common/docker/`, run `make publish_emsdk_base` 121 4. Edit `$SKIA_ROOT/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile` to be based 122 off the new version from step 2. CanvasKit has its own docker image because 123 it needs a few extra dependencies to build with font support. 124 5. Edit `$SKIA_ROOT/infra/canvaskit/docker/Makefile` to have the same version 125 from step 2. It's easiest to keep the `emsdk-base` and `canvaskit-emsdk` versions 126 be in lock-step. 127 6. In `$SKIA_ROOT/infra/canvaskit/docker/`, run `make publish_canvaskit_emsdk`. 128 7. In `$SKIA_ROOT/infra/bots/recipe_modules/build/`, update `canvaskit.py` 129 and `pathkit.py` to have `DOCKER_IMAGE` point to the desired tagged Docker 130 containers from steps 2 and 5 (which should be the same). 131 8. In `$SKIA_ROOT/infra/bots/task_drivers/compile_wasm_gm_tests.go`, update dockerImage 132 to refer to the desired Docker containers from steps 2 and 5. 133 9. In `$SKIA_ROOT/infra/bots/`, run `make train` to re-train the recipes. 134 10. Optional: Run something like `git grep 1\\.38\\.` in `$SKIA_ROOT` to see if 135 there are any other references that need updating. 136 11. Upload a CL with all the changes. Run all Test.+CanvasKit, Perf.+Puppeteer, 137 Test.+PathKit, Perf.+PathKit jobs to make sure the new builds pass all 138 tests and don't crash the perf harnesses. 139 12. Send out CL for review. Feel free to point the reviewer at these steps. 140