[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>
This commit is contained in:
Kevin Lubick 2022-02-01 08:08:47 -05:00
parent 1def701690
commit 102dbf9c43
22 changed files with 93 additions and 104 deletions

View File

@ -129,7 +129,7 @@ echo "Compiling bitcode"
cxx=\"${EMCXX}\" \
ar=\"${EMAR}\" \
extra_cflags_cc=[\"-frtti\"] \
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
extra_cflags=[\"-sMAIN_MODULE=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
\"-DSK_DISABLE_EFFECT_DESERIALIZATION\",
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
@ -204,6 +204,5 @@ ${EMCXX} \
-sNO_EXIT_RUNTIME=1 \
-sSTRICT=1 \
-sINITIAL_MEMORY=128MB \
-s WARN_UNALIGNED=1 \
-sWASM=1 \
-o $BUILD_DIR/skottiekit.js

View File

@ -70,7 +70,7 @@ echo "Compiling bitcode"
cxx=\"${EMCXX}\" \
ar=\"${EMAR}\" \
extra_cflags_cc=[\"-frtti\"] \
extra_cflags=[\"-s\", \"MAIN_MODULE=1\",
extra_cflags=[\"-sMAIN_MODULE=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
\"-DSK_ENABLE_DUMP_GPU\", \"-DSK_DISABLE_LEGACY_SHADERCONTEXT\",

View File

@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:2.0.20_v1'
DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:3.1.3_v1'
INNER_BUILD_SCRIPT = '/SRC/skia/infra/canvaskit/build_canvaskit.sh'

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/pathkit:/OUT",
"gcr.io/skia-public/emsdk-base:2.0.20_v1",
"gcr.io/skia-public/emsdk-base:3.1.3_v1",
"/SRC/skia/infra/pathkit/build_pathkit.sh",
"debug",
"asm.js"

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/pathkit:/OUT",
"gcr.io/skia-public/emsdk-base:2.0.20_v1",
"gcr.io/skia-public/emsdk-base:3.1.3_v1",
"/SRC/skia/infra/pathkit/build_pathkit.sh",
"asm.js"
],

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/canvaskit:/OUT",
"gcr.io/skia-public/canvaskit-emsdk:2.0.20_v1",
"gcr.io/skia-public/canvaskit-emsdk:3.1.3_v1",
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
"debug"
],

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/pathkit:/OUT",
"gcr.io/skia-public/emsdk-base:2.0.20_v1",
"gcr.io/skia-public/emsdk-base:3.1.3_v1",
"/SRC/skia/infra/pathkit/build_pathkit.sh",
"debug"
],

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/canvaskit:/OUT",
"gcr.io/skia-public/canvaskit-emsdk:2.0.20_v1",
"gcr.io/skia-public/canvaskit-emsdk:3.1.3_v1",
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
"cpu"
],

View File

@ -23,7 +23,7 @@
"[START_DIR]/cache/work:/SRC",
"--volume",
"[START_DIR]/cache/docker/pathkit:/OUT",
"gcr.io/skia-public/emsdk-base:2.0.20_v1",
"gcr.io/skia-public/emsdk-base:3.1.3_v1",
"/SRC/skia/infra/pathkit/build_pathkit.sh"
],
"env": {

View File

@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:2.0.20_v1'
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:3.1.3_v1'
INNER_BUILD_SCRIPT = '/SRC/skia/infra/pathkit/build_pathkit.sh'
def compile_fn(api, checkout_root, _ignore):

View File

@ -20,7 +20,7 @@ import (
"go.skia.org/infra/task_driver/go/td"
)
const dockerImage = "gcr.io/skia-public/canvaskit-emsdk:2.0.10_v2"
const dockerImage = "gcr.io/skia-public/canvaskit-emsdk:3.1.3_v1"
const innerBuildScript = "/SRC/infra/canvaskit/build_gmtests.sh"
func main() {

View File

@ -1,4 +1,4 @@
EMSDK_VERSION=2.0.20_v1
EMSDK_VERSION=3.1.3_v1
publish_canvaskit_emsdk:
docker build -t canvaskit-emsdk ./canvaskit-emsdk/

View File

@ -1,7 +1,7 @@
# A Docker image that augments the Emscripten SDK Docker image
# with anything needed to build Canvaskit
# with anything needed to build CanvasKit
FROM gcr.io/skia-public/emsdk-base:2.0.20_v1
FROM gcr.io/skia-public/emsdk-base:3.1.3_v1
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
libfreetype6-dev

View File

@ -1,4 +1,4 @@
EMSDK_VERSION=2.0.20_v1
EMSDK_VERSION=3.1.3_v1
# Can check CHROME_VERSION with
# docker run karma-chrome-tests /usr/bin/google-chrome-stable --version

View File

@ -1,4 +1,4 @@
FROM emscripten/emsdk:2.0.20
FROM emscripten/emsdk:3.1.3
RUN apt update && apt install -y python

View File

@ -16,6 +16,7 @@ BASE_LINKOPTS = [
"-sWASM",
"-sMAX_WEBGL_VERSION=2",
"-sFORCE_FILESYSTEM=0",
"-sDYNAMIC_EXECUTION=0",
"-sFILESYSTEM=0",
]

View File

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Surface factories always produce a surface with an attached color space. Specifying `null` to
`CanvasKit.MakeWebGLCanvasSurface` or calling any factory that does not take a color space
will now create a surface with a color space of `CanvasKit.ColorSpace.SRGB`.
- We now build/ship with emscripten 3.1.3.
- Internal calls no longer use dynamic dispatch (skbug.com/12795).
### Fixed
- Supplying textures via `Surface.makeImageFromTextureSource` should not cause issues with

View File

@ -15,8 +15,8 @@ is reasonable.
Be sure to both install **and** activate the correct version. For example:
```
./emsdk install 2.0.20
./emsdk activate 2.0.20
./emsdk install 3.1.3
./emsdk activate 3.1.3
```
This document also assumes you have followed the instructions to download Skia and its deps
@ -61,13 +61,13 @@ make debug
make test-continuous
```
This reads karma.conf.js, and opens a chrome browser and begins running all the test
This reads karma.conf.js, and opens a Chrome browser and begins running all the test
in `test/` it will detect changes to the tests in that directory and automatically
run again, however it will automatically rebuild and reload canvaskit. Closing the
run again, however it will automatically rebuild and reload CanvasKit. Closing the
chrome window will just cause it to re-opened. Kill the karma process to stop continuous
monitoring for changes.
The tests are run with whichever build of canvaskit you last made. be sure to also
The tests are run with whichever build of CanvasKit you last made. be sure to also
test with `release`, `debug_cpu`, and `release_cpu`. testing with release builds will
expose problems in closure compilation and usually forgotten externs.
@ -95,7 +95,7 @@ head.
## Testing from Gerrit
When submitting a CL in gerrit, click "choose tryjobs" and type canvaskit to filter them.
When submitting a CL in gerrit, click "choose tryjobs" and type CanvasKit to filter them.
select all of them, which at the time of this writing is four jobs, for each combination
of perf/test gpu/cpu.

View File

@ -285,7 +285,7 @@ echo "Compiling bitcode"
--args="cc=\"${EMCC}\" \
cxx=\"${EMCXX}\" \
ar=\"${EMAR}\" \
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
extra_cflags=[\"-s\", \"MAIN_MODULE=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
${GN_GPU_FLAGS}
@ -344,14 +344,6 @@ export EMCC_CLOSURE_ARGS="--externs $BASE_DIR/externs.js "
echo "Generating final wasm"
# Disable '-s STRICT=1' outside of Linux until
# https://github.com/emscripten-core/emscripten/issues/12118 is resovled.
STRICTNESS="-s STRICT=1"
if [[ `uname` != "Linux" ]]; then
echo "Disabling '-s STRICT=1'. See: https://github.com/emscripten-core/emscripten/issues/12118"
STRICTNESS=""
fi
# Emscripten prefers that the .a files go last in order, otherwise, it
# may drop symbols that it incorrectly thinks aren't used. One day,
# Emscripten will use LLD, which may relax this requirement.
@ -411,7 +403,8 @@ EMCC_DEBUG=1 ${EMCXX} \
-sFILESYSTEM=0 \
-sMODULARIZE=1 \
-sNO_EXIT_RUNTIME=1 \
-sDYNAMIC_EXECUTION=0 \
-sINITIAL_MEMORY=128MB \
-sWASM=1 \
$STRICTNESS \
-sSTRICT=1 \
-o $BUILD_DIR/canvaskit.js

View File

@ -89,7 +89,7 @@ echo "Compiling bitcode"
cxx=\"${EMCXX}\" \
ar=\"${EMAR}\" \
extra_cflags_cc=[\"-frtti\"] \
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
extra_cflags=[\"-sMAIN_MODULE=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
${GN_GPU_FLAGS}
@ -161,14 +161,6 @@ SKIA_DEFINES="
-DSK_UNICODE_AVAILABLE \
-DSK_ENABLE_SVG"
# Disable '-s STRICT=1' outside of Linux until
# https://github.com/emscripten-core/emscripten/issues/12118 is resovled.
STRICTNESS="-s STRICT=1"
if [[ `uname` != "Linux" ]]; then
echo "Disabling '-s STRICT=1'. See: https://github.com/emscripten-core/emscripten/issues/12118"
STRICTNESS=""
fi
GMS_TO_BUILD="gm/*.cpp"
TESTS_TO_BUILD="tests/*.cpp"
@ -244,5 +236,5 @@ EMCC_DEBUG=1 ${EMCXX} \
-sNO_EXIT_RUNTIME=1 \
-sINITIAL_MEMORY=256MB \
-sWASM=1 \
$STRICTNESS \
-sSTRICT=1 \
-o $BUILD_DIR/wasm_gm_tests.js

View File

@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Now compile with emsdk 2.0.20
- Now compile with emsdk 3.1.3
- Internal calls no longer use dynamic dispatch (skbug.com/12795)
## [0.7.0] 2019-07-20

View File

@ -49,7 +49,7 @@ fi
# Use -O0 for larger builds (but generally quicker)
# Use -Oz for (much slower, but smaller/faster) production builds
export EMCC_CLOSURE_ARGS="--externs $BASE_DIR/externs.js "
RELEASE_CONF="-Oz --closure 1 -s EVAL_CTORS=1 -DSK_RELEASE"
RELEASE_CONF="-Oz --closure 1 -DSK_RELEASE"
# It is very important for the -DSK_RELEASE/-DSK_DEBUG to match on the libskia.a, otherwise
# things like SKDEBUGCODE are sometimes compiled in and sometimes not, which can cause headaches
# like sizeof() mismatching between .cpp files and .h files.
@ -93,8 +93,8 @@ echo "Compiling bitcode"
--args="cc=\"${EMCC}\" \
cxx=\"${EMCXX}\" \
ar=\"${EMAR}\" \
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\",
\"-s\", \"MAIN_MODULE=1\",
extra_cflags=[
\"-sMAIN_MODULE=1\",
${EXTRA_CFLAGS}
] \
is_debug=false \
@ -120,6 +120,7 @@ $WASM_CONF \
-sMODULARIZE=1 \
-sNO_EXIT_RUNTIME=1 \
-sNO_FILESYSTEM=1 \
-sDYNAMIC_EXECUTION=0 \
-sSTRICT=1 \
$OUTPUT \
$BASE_DIR/pathkit_wasm_bindings.cpp \