poor performance of stroked shapes in wasm

80 views
Skip to first unread message

Shawn Riordan

unread,
Feb 23, 2023, 12:36:04 PM2/23/23
to skia-discuss
I updated to Skia m104 and now stroked shapes are 1000x slower than before. FIlled shapes are fine.  Stroked shapes look fine, they just take forever to draw.  Even simple lines.

I don't use canvaskit, I use the libskia.a file, along with my own code.
Is there some emscriptend compile flag needed, that I am not using? Or not using correctly?

This is my shell script build line:

em++ \
-std=c++17 \
-Oz \
-fsanitize=address \
-DSK_FORCE_8_BYTE_ALIGNMENT \
-DSK_DISABLE_EFFECT_DESERIALIZATION \
-DSK_DISABLE_LEGACY_SHADERCONTEXT \
-DSKNX_NO_SIMD \
-DSK_DISABLE_AAA \
-DSK_RELEASE \
-DNDEBUG \
-DSK_ENABLE_SKSL \
-DSK_ENABLE_PRECOMPILE \
-DSK_GAMMA_APPLY_TO_A8 \
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 \
-DGR_TEST_UTILS=1 \
-DSKIA_IMPLEMENTATION=1 \
-DSK_SUPPORT_GPU=1 \
-s ASSERTIONS=1 \
-s LLD_REPORT_UNDEFINED \
-s EXPORTED_FUNCTIONS=['_malloc','_free'] \
-s FORCE_FILESYSTEM=0 \
-s FILESYSTEM=0 \
-s USE_WEBGL2=1 \
-s TOTAL_MEMORY=1024MB \
-s ALLOW_MEMORY_GROWTH=1 \
-fPIC \
-I$SKIA_DIR \
-I$SKIA_DIR/include \
-I$SKIA_DIR/include/gpu \
-I$SKIA_DIR/include/gpu/gl \
-I$SKIA_DIR/include/c \
-I$SKIA_DIR/include/config \
-I$SKIA_DIR/include/core \
-I$SKIA_DIR/include/pathops \
-I$SKIA_DIR/include/codec \
-I$SKIA_DIR/include/effects \
-I$SKIA_DIR/include/images \
-I$SKIA_DIR/include/ports \
-I$SKIA_DIR/include/private \
-I$SKIA_DIR/src/core \
-I$SKIA_DIR/src/sfnt \
-I$SKIA_DIR/src/gpu \
-I$SKIA_DIR/src/image \
-I$SKIA_DIR/include/utils \
-I$SKIA_DIR/src/utils \
-I$SKIA_DIR/include/views \
-I$SKIA_DIR/include/xml \
./mycode/foo.cpp \
$SKIA_DIR/out/canvaskit_wasm/libskia.a \
-lembind \
-lGL \
-o ./out/wasm/foo.js

I imagine that Skia is using geometry shaders for handling the stroked lines.  Making triangle meshes out of them.  Could there be some special flag needed to enable geometry shaders?

John Stiles

unread,
Feb 23, 2023, 12:58:43 PM2/23/23
to skia-d...@googlegroups.com
It looks like you are building with ASAN on. I can't imagine that's a 1000x slowdown, but it certainly incurs a speed penalty.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/079ec716-01f2-455f-b89c-7b1ce02a93b4n%40googlegroups.com.

Shawn Riordan

unread,
Feb 23, 2023, 1:19:50 PM2/23/23
to skia-discuss
Sir... You are a gentleman and a scholar.
That worked!
I will name my next dog after you.

Reply all
Reply to author
Forward
0 new messages