Commit Graph

27 Commits

Author SHA1 Message Date
Kevin Lubick
c13cd6479d Reland "Build CanvasKit using GN/Ninja"
This is a reland of ecac712bec

Changes (best viewed comparing PS1 to latest)
 - Use emsdk 3.1.3 which includes important bug fixes
 - Remove unnecessary steps in compile.sh
 - Fix use of various gn args.
 - Avoid conflicts with Flutter's GN symbols
 - Add/update docs
 - Make activate-emsdk script compatible with our infra.

Original change's description:
> Build CanvasKit using GN/Ninja
>
> Build with
>
> ./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
>
> or
>
> ./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
>
> Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I601712a8953c2799fa029e782e097905b95e6b59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507717
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-15 16:31:10 +00:00
Kevin Lubick
a59af6e4f2 Revert "Build CanvasKit using GN/Ninja"
This reverts commit ecac712bec.

Reason for revert: possibly breaking flutter, definitely breaking docker wasm builds

Original change's description:
> Build CanvasKit using GN/Ninja
>
> Build with
>
> ./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
>
> or
>
> ./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
>
> Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I04dbb3b1cff7511064f603d7dc7c8a4168bf0d56
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507616
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-11 13:35:19 +00:00
Harry Terkelsen
ecac712bec Build CanvasKit using GN/Ninja
Build with

./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'

or

./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'

Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-11 13:05:44 +00:00
Kevin Lubick
b59e38d379 Reland "[pathkit] Increase default memory size and allow growth"
This is a reland of 5268f9d562

Original change's description:
> [pathkit] Increase default memory size and allow growth
>
> Change-Id: Ib403708a8cbdcb85512c341c093d1c1fe342d2b3
> Bug: skia:8216
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502778
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

Bug: skia:8216
Change-Id: I8b63fe28c785ef2fc4fc08cc6b9a076bed34040a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503825
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-03 18:23:17 +00:00
Kevin Lubick
ec4b8f1d05 Revert "[pathkit] Increase default memory size and allow growth"
Revert submission 502817

Reason for revert: Failing tests
Reverted Changes:
I64226b571:[pathkit] Reorganize to be more like CanvasKit
Ib403708a8:[pathkit] Increase default memory size and allow g...

Change-Id: Ia5d8c24dd61807cb24342d55d8541e459280d429
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503740
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
2022-02-03 16:03:10 +00:00
Kevin Lubick
5268f9d562 [pathkit] Increase default memory size and allow growth
Change-Id: Ib403708a8cbdcb85512c341c093d1c1fe342d2b3
Bug: skia:8216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502778
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-03 15:40:56 +00:00
Kevin Lubick
102dbf9c43 [canvaskit] Disable dynamic execution
This required an update to emscripten, due to there being
a few bug fixes regarding the non-dynamic code and the
Closure compiler/minifier.

Change-Id: Icc922bd98cdd52a6923a9367da3747dac2b897b3
Bug: skia:12795
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492916
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 13:15:22 +00:00
Kevin Lubick
f32ad08ac4 [infra] Deduplicate serve.py
Change-Id: I25bd987faedd7e9c322bcec487ab07583bad6b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458197
Reviewed-by: Erik Rose <erikrose@google.com>
2021-10-12 11:42:50 +00:00
Kevin Lubick
29104528cc [infra] Port serve.py from Python2 to 3
These scripts are useful when testing WebAssembly locally
because the mimetype impacts how the binaries are loaded.

The porting was achieved by doing the following:
python -m lib2to3 -w -n serve.py


Change-Id: I09673fa881339a9b157c5fc993e190766efcd85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443884
Reviewed-by: Erik Rose <erikrose@google.com>
2021-08-31 15:28:19 +00:00
Kevin Lubick
2c08814f36 [pathkit] update to build with emsdk 2.0.6
Change-Id: I8df13d592abcd7e2b396250293b57037d2b4b774
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324117
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-10-08 17:26:32 +00:00
Mike Klein
45f36b5b55 ignore SK_DISABLE_READBUFFER
Its effect is small and we want to rely on SkReadBuffer being available.

Size changes:

    - canvaskit uncompressed: 6,864,481 --> 6,864,481  (  no change  )
    - canvaskit   compressed: 2,667,117 --> 2,667,117  (  no change  )
    -   pathkit uncompressed:   329,187 -->   330,679  (+ 1.5K, +0.5%)
    -   pathkit   compressed:   134,158 -->   134,672  (+ 0.5K, +0.4%)
    -   flutter             : 1,302,108 --> 1,322,568  (+20.0K, +1.6%)

The Flutter change is the biggest mystery, as bloaty only pegs
SkReadBuffer as 3.9K.  The rest must come from other files including
SkReadBuffer.h not being able to see and inline away SkReadBuffer
routines?  Feels like SK_DISABLE_EFFECT_DESERIALIZATION isn't trimming
enough?

PS 4-6 have an idea to push SK_DISABLE_EFFECT_DESERIALIZATION further.

Change-Id: Ifda3ccb82dd0636cfed6bb826fb185a7bca2cbe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295061
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-09 16:16:57 +00:00
Kevin Lubick
d1285b131b Upgrade CanvasKit emscripten to version 1.39.16.
Changes are largely mechanical.  Non-mechanical changes to support newer
versions of emscripten are enumerated below, in format ${EMSCRIPTEN_VERSION}:
${RELEVANT_CHANGE}.

- 1.39.9: TOTAL_MEMORY has been renamed INITIAL_MEMORY.
- 1.39.12: passing of linker flags to wasm-ld has changed in a way that requires
  supplying `--no-entry` to avoid error message "wasm-ld: error: entry symbol
  not defined (pass --no-entry to suppress): main".
- 1.39.16: The factory function created by using `MODULARIZE` build option now
  returns a Promise instead of the module instance.  As such, the ready.js
  workaround is removed.  Note this is a breaking API change for CanvasKit,
  which now uses just `then()` and not `ready().then()`.
- 1.38.33: `emsdk install` hasn't required the `-64bit` suffix on version names
  since `1.38.33`, so we remove them.  E.g. `emsdk install sdk-1.39.6-64bit`
  simply becomes `emsdk install sdk-1.39.16`.

cf. https://github.com/emscripten-core/emscripten/blob/master/ChangeLog.md

Bug: NONE
Change-Id: Iabec4bd5ad7db2e0715ad42c2e4cf7d67b192b4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291182
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-21 14:18:48 +00:00
Kevin Lubick
e17862a71e Fix wasm builds
After the update to emscripten 1.39.6, source maps don't
work on ASMJS builds and debugger needed the same change
of the default MAIN_MODULE setting as canvaskit and pathkit.

Change-Id: Ifb920dee998ae41fd500adca587b1ad20cfef584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267076
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-28 19:03:49 +00:00
Kevin Lubick
f76da63fbd [canvaskit] Update build script to support latest Emscripten
Add workaround for https://github.com/emscripten-core/emscripten/issues/10072

Note to reviewer, please check out the steps I added
in canvaskit/README.md to document this process.

Bug: skia:9816
Change-Id: Idbe7ff08ac62f4f4d70e656384831b8d24c4a684
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266941
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-28 15:41:58 +00:00
Kevin Lubick
fa5a138170 [canvaskit] Update to build with emscripten 1.38.47
Bug: skia:9052
Change-Id: Ic1aec2c9b8ace556f5b77862582894f59fd26b64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247302
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-09 15:08:10 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Mike Klein
ba201aea74 make -Werror or /WX optional, off by default
Most external users complain about -Werror,
and I've heard anecdotally that devs find it annoying too.

This turns it off by default, but keeps it on the bots.

Change-Id: I6e87c92215261ebf6e961f816177386d5d58f28e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209787
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-23 20:39:34 +00:00
Brian Osman
c3186302bd Add skcms directory to public includes
skcms is part of Skia's public API now. This attempts to recognize that,
and pave the way for moving the header to another location more easily
in a follow up CL, or - at a minimum - for clients that redistribute
Skia as a library + includes to relocate the skcms.h header as part of
that.

Change-Id: I15da63b0d4ab8916a71fb7e6ab3656db87252707
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209640
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-22 20:32:23 +00:00
Kevin Lubick
09d022cbb8 [pathkit] build with newer emscripten
Bug: skia:
Change-Id: I5576ec94cae42dd0e03079321e61f71292350808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206389
Reviewed-by: Eric Boren <borenet@google.com>
2019-04-08 13:56:18 +00:00
Kevin Lubick
275eaff3be [pathkit] Add .ready() to initialize
See https://github.com/kripken/emscripten/issues/5820 and
https://skia-review.googlesource.com/c/skia/+/181177 for more context.

(Problem was discovered in CanvasKit, and this ports the same fix to
PathKit).

Bug: skia:
Change-Id: Ic8b2fb399210631a571595a5b3d11d1736c00def
Reviewed-on: https://skia-review.googlesource.com/c/181178
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-01-04 19:58:22 +00:00
Kevin Lubick
e805b243f6 Tweak to compile flags
Bug: skia:
Change-Id: I067fa83e1a07b244bec71ed4f95c144dc7e2edc1
Reviewed-on: https://skia-review.googlesource.com/c/161143
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-10 19:10:26 +00:00
Kevin Lubick
8e9750d3c5 Add CanvasKit build
Building CanvasKit uses very similar logic to PathKit, so there
was a fair amount of copy/paste/customize.

Fixes the name of skia.js/wasm -> canvaskit.js/wasm and
adds a package.json to formally track versions.

Also move PathKit helper scripts to align better.

Docs-Preview: https://skia.org/?cl=160463
Bug: skia:
Change-Id: Ie75b30592dcc4d520dca41f6f5579006aaa8849b
Reviewed-on: https://skia-review.googlesource.com/c/160463
Reviewed-by: Eric Boren <borenet@google.com>
2018-10-09 13:56:56 +00:00
Kevin Lubick
cbcff385c1 Have pathkit use libpathkit.a for faster builds
Of note, it is very important for the -DSK_RELEASE/-DSK_DEBUG
to match between libskia.a and the WASM bindings, otherwise
things like SKDEBUGCODE are sometimes compiled in and sometimes
not, which can cause headaches like sizeof() mismatching between
.cpp files and .h files.

Bug: skia:
Change-Id: Id6ef58c44a7c10014a243b36708e0891514f6008
Reviewed-on: https://skia-review.googlesource.com/158341
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-02 13:27:29 +00:00
Kevin Lubick
217056c048 [CanvasKit] Implement some basic Canvas/Surface things.
drawText is having issues in a release build.  Skottie sometimes
asserts in debug mode. This possibly has something to do with
memory alignment - like https://skia-review.googlesource.com/c/skia/+/155980
helped fix.

Patchset 9 shows off integrating Skia drawing to
an HTML canvas using Ganesh.

To see it locally, set up https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
and then set $EMSDK to be that directory.  Then run

   make clean
   make local-example

and navigate to http://localhost:8000/skia-wasm/example.html

Patchset 20 shows off Skottie animating directly to a Canvas.

Docs-Preview: https://skia.org/?cl=153882
Bug: skia:
Change-Id: I2ad2f4ffac00925ee901982ccbaeb7aa63b1ea23
Reviewed-on: https://skia-review.googlesource.com/153882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 12:03:55 +00:00
Mike Klein
0191ed8e87 Make listener lists threadsafe with a mutex.
PS1 reverts commit 6c8d242b14.
PS2 uses an SkMutex for thread safety.

Change-Id: I9318f92cc028844b3dc5a99a00282c2762057895
Reviewed-on: https://skia-review.googlesource.com/155060
Reviewed-by: Mike Klein <mtklein@google.com>
2018-09-18 15:46:26 +00:00
Kevin Lubick
774be5aa96 [PathKit] Add cubicYFromX
Docs-Preview: https://skia.org/?cl=152385
Bug: skia:8216
Change-Id: I0020e8d2d4e6e7c7de5c71ddf923a618659cde2c
Reviewed-on: https://skia-review.googlesource.com/152385
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-09-07 18:01:40 +00:00
Kevin Lubick
c7d057103e [PathKit] Move from experimental to modules
Add in Code of Conduct and Contributing.md as well.

Docs-Preview: https://skia.org/?cl=150901
Bug: skia:8216
Change-Id: Ia881124f653617ad0b7b91f40ba21de2c13220a6
Reviewed-on: https://skia-review.googlesource.com/150901
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-08-31 14:18:16 +00:00