Fix GL loading bug in wasm debugger.

Seems this was fixed in canvaskit, but overlooked in debugger.

Change-Id: I326b809628a8531a521a6246e65798d37dcce1b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314457
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Nathaniel Nifong 2020-09-02 15:40:37 -04:00 committed by Skia Commit-Bot
parent 2753b12ff5
commit 0f7aa54e43
3 changed files with 21 additions and 3 deletions

View File

@ -36,6 +36,9 @@ else
fi
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
BUILTIN_FONT="$BASE_DIR/fonts/NotoMono-Regular.ttf.cpp"
# Generate the font's binary file (which is covered by .gitignore)
@ -45,6 +48,7 @@ python tools/embed_resources.py \
--output $BASE_DIR/fonts/NotoMono-Regular.ttf.cpp \
--align 4
GN_GPU="skia_enable_gpu=true skia_gl_standard = \"webgl\""
GN_GPU_FLAGS="\"-DSK_DISABLE_LEGACY_SHADERCONTEXT\","
WASM_GPU="-lEGL -lGL -lGLESv2 -DSK_SUPPORT_GPU=1 -DSK_GL \
-DSK_DISABLE_LEGACY_SHADERCONTEXT --pre-js $BASE_DIR/cpu.js --pre-js $BASE_DIR/gpu.js"
@ -103,7 +107,7 @@ echo "Compiling bitcode"
skia_use_system_zlib=false\
skia_use_vulkan=false \
skia_use_zlib=true \
skia_enable_gpu=true \
${GN_GPU} \
skia_enable_tools=false \
skia_enable_skshaper=false \
skia_enable_ccpr=false \
@ -118,17 +122,18 @@ ${NINJA} -C ${BUILD_DIR} libskia.a libdebugcanvas.a
export EMCC_CLOSURE_ARGS="--externs $BASE_DIR/externs.js "
echo "Generating final debugger wasm and javascript"
echo "Generating final wasm"
# 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.
${EMCXX} \
EMCC_DEBUG=1 ${EMCXX} \
$RELEASE_CONF \
-I. \
-Ithird_party/icu \
-Ithird_party/skcms \
-DSK_DISABLE_AAA \
-DSK_FORCE_8_BYTE_ALIGNMENT \
-std=c++17 \
$WASM_GPU \
--pre-js $BASE_DIR/helper.js \
@ -141,6 +146,7 @@ ${EMCXX} \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORT_NAME="DebuggerInit" \
-s FORCE_FILESYSTEM=0 \
-s FILESYSTEM=0 \
-s MODULARIZE=1 \
-s NO_EXIT_RUNTIME=1 \
-s STRICT=1 \

View File

@ -1,4 +1,10 @@
/*
* This file defines SkpDebugPlayer, a class which loads a SKP or MSKP file and draws it
* to an SkSurface with annotation, and detailed playback controls. It holds as many DebugCanvases
* as there are frames in the file.
*
* It also defines emscripten bindings for SkpDebugPlayer and other classes necessary to us it.
*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
@ -401,6 +407,10 @@ sk_sp<GrContext> MakeGrContext(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context)
}
// setup GrContext
auto interface = GrGLMakeNativeInterface();
if (!interface) {
SkDebugf("failed to make GrGLMakeNativeInterface\n");
return nullptr;
}
// setup contexts
sk_sp<GrContext> grContext(GrContext::MakeGL(interface));
return grContext;

View File

@ -44,6 +44,7 @@ namespace {
}, true);
void drawArrow(SkCanvas* canvas, const SkPoint& a, const SkPoint& b, const SkPaint& paint) {
canvas->translate(0.5, 0.5);
canvas->drawLine(a, b, paint);
canvas->save();
canvas->translate(b.fX, b.fY);
@ -52,6 +53,7 @@ namespace {
// arrow head
canvas->drawPath(arrowHead, paint);
canvas->restore();
canvas->restore();
}
} // namespace