[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>
This commit is contained in:
parent
99dead9830
commit
f76da63fbd
@ -11,6 +11,7 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
|||||||
&& groupadd -g 2000 skia \
|
&& groupadd -g 2000 skia \
|
||||||
&& useradd -u 2000 -g 2000 skia
|
&& useradd -u 2000 -g 2000 skia
|
||||||
|
|
||||||
|
# TODO(kjlubick): Try a shallow clone of depot_tools
|
||||||
RUN cd /tmp \
|
RUN cd /tmp \
|
||||||
&& git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
|
&& git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:1.38.47_v1'
|
DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1'
|
||||||
INNER_BUILD_SCRIPT = '/SRC/skia/infra/canvaskit/build_canvaskit.sh'
|
INNER_BUILD_SCRIPT = '/SRC/skia/infra/canvaskit/build_canvaskit.sh'
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/pathkit:/OUT",
|
"[START_DIR]/cache/docker/pathkit:/OUT",
|
||||||
"gcr.io/skia-public/emsdk-base:1.38.47_v1",
|
"gcr.io/skia-public/emsdk-base:1.39.6_v1",
|
||||||
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
||||||
"debug",
|
"debug",
|
||||||
"asm.js"
|
"asm.js"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/pathkit:/OUT",
|
"[START_DIR]/cache/docker/pathkit:/OUT",
|
||||||
"gcr.io/skia-public/emsdk-base:1.38.47_v1",
|
"gcr.io/skia-public/emsdk-base:1.39.6_v1",
|
||||||
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
||||||
"asm.js"
|
"asm.js"
|
||||||
],
|
],
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/canvaskit:/OUT",
|
"[START_DIR]/cache/docker/canvaskit:/OUT",
|
||||||
"gcr.io/skia-public/canvaskit-emsdk:1.38.47_v1",
|
"gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1",
|
||||||
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
|
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
|
||||||
"debug"
|
"debug"
|
||||||
],
|
],
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/pathkit:/OUT",
|
"[START_DIR]/cache/docker/pathkit:/OUT",
|
||||||
"gcr.io/skia-public/emsdk-base:1.38.47_v1",
|
"gcr.io/skia-public/emsdk-base:1.39.6_v1",
|
||||||
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
"/SRC/skia/infra/pathkit/build_pathkit.sh",
|
||||||
"debug"
|
"debug"
|
||||||
],
|
],
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/canvaskit:/OUT",
|
"[START_DIR]/cache/docker/canvaskit:/OUT",
|
||||||
"gcr.io/skia-public/canvaskit-emsdk:1.38.47_v1",
|
"gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1",
|
||||||
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
|
"/SRC/skia/infra/canvaskit/build_canvaskit.sh",
|
||||||
"cpu"
|
"cpu"
|
||||||
],
|
],
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"[START_DIR]/cache/work:/SRC",
|
"[START_DIR]/cache/work:/SRC",
|
||||||
"--volume",
|
"--volume",
|
||||||
"[START_DIR]/cache/docker/pathkit:/OUT",
|
"[START_DIR]/cache/docker/pathkit:/OUT",
|
||||||
"gcr.io/skia-public/emsdk-base:1.38.47_v1",
|
"gcr.io/skia-public/emsdk-base:1.39.6_v1",
|
||||||
"/SRC/skia/infra/pathkit/build_pathkit.sh"
|
"/SRC/skia/infra/pathkit/build_pathkit.sh"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:1.38.47_v1'
|
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:1.39.6_v1'
|
||||||
INNER_BUILD_SCRIPT = '/SRC/skia/infra/pathkit/build_pathkit.sh'
|
INNER_BUILD_SCRIPT = '/SRC/skia/infra/pathkit/build_pathkit.sh'
|
||||||
|
|
||||||
def compile_fn(api, checkout_root, _ignore):
|
def compile_fn(api, checkout_root, _ignore):
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# is mounted at /OUT
|
# is mounted at /OUT
|
||||||
|
|
||||||
# For example:
|
# For example:
|
||||||
# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/canvaskit:/OUT gcr.io/skia-public/emsdk-base:1.38.47_v1 /SRC/infra/canvaskit/build_canvaskit.sh
|
# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/canvaskit:/OUT gcr.io/skia-public/emsdk-base:1.39.6_v1 /SRC/infra/canvaskit/build_canvaskit.sh
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
set -x
|
set -x
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EMSDK_VERSION=1.38.47_v1
|
EMSDK_VERSION=1.39.6_v1
|
||||||
|
|
||||||
publish_canvaskit_emsdk:
|
publish_canvaskit_emsdk:
|
||||||
docker build -t canvaskit-emsdk ./canvaskit-emsdk/
|
docker build -t canvaskit-emsdk ./canvaskit-emsdk/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# A Docker image that augments the Emscripten SDK Docker image
|
# 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:1.38.47_v1
|
FROM gcr.io/skia-public/emsdk-base:1.39.6_v1
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||||
libfreetype6-dev
|
libfreetype6-dev
|
@ -9,7 +9,7 @@
|
|||||||
# is mounted at /OUT
|
# is mounted at /OUT
|
||||||
|
|
||||||
# For example:
|
# For example:
|
||||||
# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/dockerpathkit:/OUT gcr.io/skia-public/emsdk-base:1.38.47_v1 /SRC/infra/pathkit/build_pathkit.sh
|
# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/dockerpathkit:/OUT gcr.io/skia-public/emsdk-base:1.39.6_v1 /SRC/infra/pathkit/build_pathkit.sh
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
set -x
|
set -x
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
EMSDK_VERSION=1.38.47_v1
|
EMSDK_VERSION=1.39.6_v1
|
||||||
|
|
||||||
# Can check CHROME_VERSION with
|
# Can check CHROME_VERSION with
|
||||||
# docker run karma-chrome-tests /usr/bin/google-chrome-stable --version
|
# docker run karma-chrome-tests /usr/bin/google-chrome-stable --version
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
# A Docker image that has the Emscripten SDK installed to /opt/emsdk
|
# A Docker image that has the Emscripten SDK installed to /opt/emsdk
|
||||||
# Use this image to compile C/C++ code to WASM.
|
# Use this image to compile C/C++ code to WASM.
|
||||||
|
# It has the Java Runtime to allow the use of the Closure JS compiler/minifier.
|
||||||
|
# TODO(kjlubick): add an ARG to make it easier to pass in the version number.
|
||||||
|
|
||||||
FROM gcr.io/skia-public/skia-build-tools:latest
|
FROM gcr.io/skia-public/skia-build-tools:latest
|
||||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||||
nodejs \
|
nodejs \
|
||||||
default-jre
|
default-jre
|
||||||
|
|
||||||
|
# TODO(kjlubick): Try a shallow clone
|
||||||
RUN cd /opt \
|
RUN cd /opt \
|
||||||
&& git clone https://github.com/emscripten-core/emsdk.git
|
&& git clone https://github.com/emscripten-core/emsdk.git
|
||||||
|
|
||||||
@ -13,9 +16,9 @@ WORKDIR /opt/emsdk
|
|||||||
|
|
||||||
RUN ./emsdk update-tags
|
RUN ./emsdk update-tags
|
||||||
|
|
||||||
RUN ./emsdk install sdk-1.38.47-64bit
|
RUN ./emsdk install sdk-1.39.6-64bit
|
||||||
|
|
||||||
RUN ./emsdk activate sdk-1.38.47-64bit
|
RUN ./emsdk activate sdk-1.39.6-64bit
|
||||||
|
|
||||||
RUN /bin/bash -c "source ./emsdk_env.sh"
|
RUN /bin/bash -c "source ./emsdk_env.sh"
|
||||||
|
|
||||||
|
@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- `SkSurface.drawOnce` for drawing a single frame (in addition to already existing
|
- `SkSurface.drawOnce` for drawing a single frame (in addition to already existing
|
||||||
`SkSurface.requestAnimationFrame` for animation logic).
|
`SkSurface.requestAnimationFrame` for animation logic).
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- We now compile/ship with Emscripten v1.39.6.
|
||||||
|
|
||||||
## [0.12.0] - 2020-01-22
|
## [0.12.0] - 2020-01-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -72,5 +72,5 @@ docker-compile:
|
|||||||
mkdir -p ${SKIA_ROOT}/out/canvaskit_wasm_docker
|
mkdir -p ${SKIA_ROOT}/out/canvaskit_wasm_docker
|
||||||
docker run --rm --volume ${SKIA_ROOT}:/SRC \
|
docker run --rm --volume ${SKIA_ROOT}:/SRC \
|
||||||
--volume ${SKIA_ROOT}/out/canvaskit_wasm_docker:/OUT \
|
--volume ${SKIA_ROOT}/out/canvaskit_wasm_docker:/OUT \
|
||||||
gcr.io/skia-public/canvaskit-emsdk:1.38.27_v1 \
|
gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1 \
|
||||||
/SRC/infra/canvaskit/build_canvaskit.sh
|
/SRC/infra/canvaskit/build_canvaskit.sh
|
||||||
|
@ -7,7 +7,7 @@ compilation.
|
|||||||
# Compile and Test Locally
|
# Compile and Test Locally
|
||||||
|
|
||||||
```
|
```
|
||||||
make release
|
make release # make debug is much faster and has better error messages
|
||||||
make local-example
|
make local-example
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -24,3 +24,41 @@ any of the "extras", one might run:
|
|||||||
Such a stripped-down version is about half the size of the default release build.
|
Such a stripped-down version is about half the size of the default release build.
|
||||||
|
|
||||||
[1]: https://emscripten.org/docs/getting_started/downloads.html
|
[1]: https://emscripten.org/docs/getting_started/downloads.html
|
||||||
|
|
||||||
|
|
||||||
|
# Infrastructure Playbook
|
||||||
|
|
||||||
|
When dealing with CanvasKit (or PathKit) on our bots, we use Docker. Check out
|
||||||
|
$SKIA_ROOT/infra/wasm-common/docker/README.md for more on building/editing the
|
||||||
|
images used for building and testing.
|
||||||
|
|
||||||
|
## Updating the version of Emscripten we build/test with
|
||||||
|
|
||||||
|
This presumes you have updated emscripten locally to a newer version of the
|
||||||
|
sdk and verified/fixed any build issues that have arisen.
|
||||||
|
|
||||||
|
1. Edit `$SKIA_ROOT/infra/wasm-common/docker/emsdk-base/Dockerfile` to install
|
||||||
|
and activate the desired version of Emscripten.
|
||||||
|
2. Edit `$SKIA_ROOT/infra/wasm-common/docker/Makefile` to have `EMSDK_VERSION` be
|
||||||
|
set to that desired version. If there is a suffix that is not `_v1`, reset
|
||||||
|
it to be `_v1`. If testing the image later does not work and edits are made
|
||||||
|
to the emsdk-base Dockerfile to correct that, increment to `_v2`,`_v3`, etc
|
||||||
|
to force the bots to pick up the new image.
|
||||||
|
3. In `$SKIA_ROOT/infra/wasm-common/docker/`, run `make publish_emsdk_base`
|
||||||
|
4. Edit `$SKIA_ROOT/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile` to be based
|
||||||
|
off the new version from step 2. CanvasKit has its own docker image because
|
||||||
|
it needs a few extra dependencies to build with font support.
|
||||||
|
5. Edit `$SKIA_ROOT/infra/canvaskit/docker/Makefile` to have the same version
|
||||||
|
from step 2. It's easiest to keep the `emsdk-base` and `canvaskit-emsdk` versions
|
||||||
|
be in lock-step.
|
||||||
|
6. In `$SKIA_ROOT/infra/canvaskit/docker/`, make `publish_canvaskit_emsdk`.
|
||||||
|
7. In `$SKIA_ROOT/infra/bots/recipe_modules/build/`, update `canvaskit.py`
|
||||||
|
and `pathkit.py` to have `DOCKER_IMAAGE` point to the desired tagged Docker
|
||||||
|
containers from steps 2 and 5 (which should be the same).
|
||||||
|
9. In `$SKIA_ROOT/infra/bots/`, run `make train` to re-train the recipes.
|
||||||
|
10. Optional: Run something like `git grep 1\\.38\\.` in `$SKIA_ROOT` to see if
|
||||||
|
there are any other references that need updating.
|
||||||
|
11. Upload a CL with all the changes. Run all Test.+CanvasKit, Perf.+CanvasKit,
|
||||||
|
Test.+PathKit, Perf.+PathKit jobs to make sure the new builds pass all
|
||||||
|
tests and don't crash the perf harnesses.
|
||||||
|
12. Send out CL for review. Feel free to point the reviewer at these steps.
|
@ -212,9 +212,10 @@ echo "Compiling bitcode"
|
|||||||
cxx=\"${EMCXX}\" \
|
cxx=\"${EMCXX}\" \
|
||||||
ar=\"${EMAR}\" \
|
ar=\"${EMAR}\" \
|
||||||
extra_cflags_cc=[\"-frtti\"] \
|
extra_cflags_cc=[\"-frtti\"] \
|
||||||
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\",
|
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
|
||||||
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
|
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
|
||||||
\"-DSK_DISABLE_EFFECT_DESERIALIZATION\",
|
\"-DSK_DISABLE_EFFECT_DESERIALIZATION\",
|
||||||
|
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
|
||||||
${GN_GPU_FLAGS}
|
${GN_GPU_FLAGS}
|
||||||
${GN_SKP_FLAGS}
|
${GN_SKP_FLAGS}
|
||||||
${EXTRA_CFLAGS}
|
${EXTRA_CFLAGS}
|
||||||
@ -275,12 +276,13 @@ ${EMCXX} \
|
|||||||
-Ithird_party/skcms \
|
-Ithird_party/skcms \
|
||||||
-Ithird_party/externals/icu/source/common/ \
|
-Ithird_party/externals/icu/source/common/ \
|
||||||
-DSK_DISABLE_AAA \
|
-DSK_DISABLE_AAA \
|
||||||
|
-DSK_FORCE_8_BYTE_ALIGNMENT \
|
||||||
$WASM_GPU \
|
$WASM_GPU \
|
||||||
$WASM_PATHOPS \
|
$WASM_PATHOPS \
|
||||||
$WASM_RT_SHADER \
|
$WASM_RT_SHADER \
|
||||||
$WASM_SKP \
|
$WASM_SKP \
|
||||||
$FONT_CFLAGS \
|
$FONT_CFLAGS \
|
||||||
-std=c++14 \
|
-std=c++17 \
|
||||||
--bind \
|
--bind \
|
||||||
--pre-js $BASE_DIR/preamble.js \
|
--pre-js $BASE_DIR/preamble.js \
|
||||||
--pre-js $BASE_DIR/helper.js \
|
--pre-js $BASE_DIR/helper.js \
|
||||||
|
@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Updated to emscripten 1.38.47
|
- Updated to emscripten 1.39.6
|
||||||
|
|
||||||
## [0.6.0] 2019-02-25
|
## [0.6.0] 2019-02-25
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
|
|||||||
HTML_SHELL=$BASE_DIR/shell.html
|
HTML_SHELL=$BASE_DIR/shell.html
|
||||||
BUILD_DIR=${BUILD_DIR:="out/pathkit"}
|
BUILD_DIR=${BUILD_DIR:="out/pathkit"}
|
||||||
mkdir -p $BUILD_DIR
|
mkdir -p $BUILD_DIR
|
||||||
|
# sometimes the .a files keep old symbols around - cleaning them out makes sure
|
||||||
|
# we get a fresh build.
|
||||||
|
rm -f $BUILD_DIR/*.a
|
||||||
|
|
||||||
# This expects the environment variable EMSDK to be set
|
# This expects the environment variable EMSDK to be set
|
||||||
if [[ ! -d $EMSDK ]]; then
|
if [[ ! -d $EMSDK ]]; then
|
||||||
@ -73,7 +76,7 @@ OUTPUT="-o $BUILD_DIR/pathkit.js"
|
|||||||
source $EMSDK/emsdk_env.sh
|
source $EMSDK/emsdk_env.sh
|
||||||
EMCC=`which emcc`
|
EMCC=`which emcc`
|
||||||
EMCXX=`which em++`
|
EMCXX=`which em++`
|
||||||
|
EMAR=`which emar`
|
||||||
|
|
||||||
# Turn off exiting while we check for ninja (which may not be on PATH)
|
# Turn off exiting while we check for ninja (which may not be on PATH)
|
||||||
set +e
|
set +e
|
||||||
@ -91,7 +94,9 @@ echo "Compiling bitcode"
|
|||||||
./bin/gn gen ${BUILD_DIR} \
|
./bin/gn gen ${BUILD_DIR} \
|
||||||
--args="cc=\"${EMCC}\" \
|
--args="cc=\"${EMCC}\" \
|
||||||
cxx=\"${EMCXX}\" \
|
cxx=\"${EMCXX}\" \
|
||||||
|
ar=\"${EMAR}\" \
|
||||||
extra_cflags=[\"-DSK_DISABLE_READBUFFER=1\",\"-s\", \"WARN_UNALIGNED=1\",
|
extra_cflags=[\"-DSK_DISABLE_READBUFFER=1\",\"-s\", \"WARN_UNALIGNED=1\",
|
||||||
|
\"-s\", \"MAIN_MODULE=1\",
|
||||||
${EXTRA_CFLAGS}
|
${EXTRA_CFLAGS}
|
||||||
] \
|
] \
|
||||||
is_debug=false \
|
is_debug=false \
|
||||||
@ -104,10 +109,8 @@ ${NINJA} -C ${BUILD_DIR} libpathkit.a
|
|||||||
|
|
||||||
echo "Generating WASM"
|
echo "Generating WASM"
|
||||||
|
|
||||||
${EMCXX} $RELEASE_CONF -std=c++14 \
|
${EMCXX} $RELEASE_CONF -std=c++17 \
|
||||||
-I. \
|
-I. \
|
||||||
-Ithird_party/skcms \
|
|
||||||
-std=c++14 \
|
|
||||||
--bind \
|
--bind \
|
||||||
--pre-js $BASE_DIR/helper.js \
|
--pre-js $BASE_DIR/helper.js \
|
||||||
--pre-js $BASE_DIR/chaining.js \
|
--pre-js $BASE_DIR/chaining.js \
|
||||||
|
@ -26,8 +26,17 @@
|
|||||||
*/
|
*/
|
||||||
class GrMemoryPool {
|
class GrMemoryPool {
|
||||||
public:
|
public:
|
||||||
|
#ifdef SK_FORCE_8_BYTE_ALIGNMENT
|
||||||
|
// This is an issue for WASM builds using emscripten, which had
|
||||||
|
// std::max_align_t = 16, but was returning pointers only aligned to 8
|
||||||
|
// bytes. https://github.com/emscripten-core/emscripten/issues/10072
|
||||||
|
// Since Skia does not use "long double" (16 bytes), we should be ok to
|
||||||
|
// force it back to 8 bytes until emscripten is fixed.
|
||||||
|
static constexpr size_t kAlignment = 8;
|
||||||
|
#else
|
||||||
// Guaranteed alignment of pointer returned by allocate().
|
// Guaranteed alignment of pointer returned by allocate().
|
||||||
static constexpr size_t kAlignment = alignof(std::max_align_t);
|
static constexpr size_t kAlignment = alignof(std::max_align_t);
|
||||||
|
#endif
|
||||||
// Minimum size this class will allocate at once.
|
// Minimum size this class will allocate at once.
|
||||||
static constexpr size_t kMinAllocationSize = 1 << 10;
|
static constexpr size_t kMinAllocationSize = 1 << 10;
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static bool legacy_shader_can_handle(const SkMatrix& inv) {
|
|||||||
const SkRect src = inv.mapRect(SkRect::MakeWH(max_dev_coord, max_dev_coord));
|
const SkRect src = inv.mapRect(SkRect::MakeWH(max_dev_coord, max_dev_coord));
|
||||||
|
|
||||||
// take 1/4 of max signed 32bits so we have room to subtract local values
|
// take 1/4 of max signed 32bits so we have room to subtract local values
|
||||||
const SkScalar max_fixed32dot32 = SK_MaxS32 * 0.25f;
|
const SkScalar max_fixed32dot32 = float(SK_MaxS32) * 0.25f;
|
||||||
if (!SkRect::MakeLTRB(-max_fixed32dot32, -max_fixed32dot32,
|
if (!SkRect::MakeLTRB(-max_fixed32dot32, -max_fixed32dot32,
|
||||||
+max_fixed32dot32, +max_fixed32dot32).contains(src)) {
|
+max_fixed32dot32, +max_fixed32dot32).contains(src)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user