[canvaskit] Performance tuning of GL calls
Don't check glerror on texture creation. Initialize before texSubImage2D calls, especially for drawPath (dramatic Firefox improvement). Bug: skia: Change-Id: Iec39fd84fffb886e5ecccf782fe75d419e4255d0 Reviewed-on: https://skia-review.googlesource.com/c/177893 Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
b3907a8424
commit
a96ec09599
@ -23,6 +23,7 @@ debug:
|
|||||||
mkdir -p ./canvaskit/bin
|
mkdir -p ./canvaskit/bin
|
||||||
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
|
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
|
||||||
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
|
||||||
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./canvaskit/bin
|
||||||
|
|
||||||
debug_cpu:
|
debug_cpu:
|
||||||
# Does an incremental build where possible.
|
# Does an incremental build where possible.
|
||||||
@ -30,6 +31,7 @@ debug_cpu:
|
|||||||
mkdir -p ./canvaskit/bin
|
mkdir -p ./canvaskit/bin
|
||||||
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
|
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
|
||||||
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
|
||||||
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./canvaskit/bin
|
||||||
|
|
||||||
profile:
|
profile:
|
||||||
./compile.sh profiling
|
./compile.sh profiling
|
||||||
|
@ -20,17 +20,19 @@ source $EMSDK/emsdk_env.sh
|
|||||||
EMCC=`which emcc`
|
EMCC=`which emcc`
|
||||||
EMCXX=`which em++`
|
EMCXX=`which em++`
|
||||||
|
|
||||||
RELEASE_CONF="-Oz --closure 1 --llvm-lto 3 -DSK_RELEASE --pre-js $BASE_DIR/release.js"
|
RELEASE_CONF="-Oz --closure 1 --llvm-lto 3 -DSK_RELEASE --pre-js $BASE_DIR/release.js \
|
||||||
EXTRA_CFLAGS="\"-DSK_RELEASE\""
|
-DGR_GL_CHECK_ALLOC_WITH_GET_ERROR=0"
|
||||||
|
EXTRA_CFLAGS="\"-DSK_RELEASE\", \"-DGR_GL_CHECK_ALLOC_WITH_GET_ERROR=0\","
|
||||||
if [[ $@ == *debug* ]]; then
|
if [[ $@ == *debug* ]]; then
|
||||||
echo "Building a Debug build"
|
echo "Building a Debug build"
|
||||||
EXTRA_CFLAGS="\"-DSK_DEBUG\""
|
EXTRA_CFLAGS="\"-DSK_DEBUG\""
|
||||||
RELEASE_CONF="-O0 --js-opts 0 -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 -g3 \
|
RELEASE_CONF="-O0 --js-opts 0 -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 -g4 \
|
||||||
-DPATHKIT_TESTING -DSK_DEBUG --pre-js $BASE_DIR/debug.js"
|
--source-map-base /node_modules/canvaskit/bin/ -DSK_DEBUG --pre-js $BASE_DIR/debug.js"
|
||||||
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_debug"}
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_debug"}
|
||||||
elif [[ $@ == *profiling* ]]; then
|
elif [[ $@ == *profiling* ]]; then
|
||||||
echo "Building a build for profiling"
|
echo "Building a build for profiling"
|
||||||
RELEASE_CONF="-O3 --source-map-base /node_modules/canvaskit/bin/ --profiling -g4 -DSK_RELEASE --pre-js $BASE_DIR/release.js"
|
RELEASE_CONF="-O3 --source-map-base /node_modules/canvaskit/bin/ --profiling -g4 -DSK_RELEASE \
|
||||||
|
--pre-js $BASE_DIR/release.js -DGR_GL_CHECK_ALLOC_WITH_GET_ERROR=0"
|
||||||
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_profile"}
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_profile"}
|
||||||
else
|
else
|
||||||
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm"}
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm"}
|
||||||
|
@ -113,7 +113,16 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::toTextureProxy(GrContext* context, SkBacki
|
|||||||
// have pending IO.
|
// have pending IO.
|
||||||
surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
|
surfaceFlags |= GrInternalSurfaceFlags::kNoPendingIO;
|
||||||
}
|
}
|
||||||
|
auto clearFlag = kNone_GrSurfaceFlags;
|
||||||
|
// In a WASM build on Firefox, we see warnings like
|
||||||
|
// WebGL warning: texSubImage2D: This operation requires zeroing texture data. This is slow.
|
||||||
|
// WebGL warning: texSubImage2D: Texture has not been initialized prior to a partial upload,
|
||||||
|
// forcing the browser to clear it. This may be slow.
|
||||||
|
// Setting the initial clear seems to make those warnings go away and offers a substantial
|
||||||
|
// boost in performance in Firefox. Chrome sees a more modest increase.
|
||||||
|
#if IS_WEBGL==1
|
||||||
|
clearFlag = kPerformInitialClear_GrSurfaceFlag;
|
||||||
|
#endif
|
||||||
return context->contextPriv().proxyProvider()->createTextureProxy(
|
return context->contextPriv().proxyProvider()->createTextureProxy(
|
||||||
std::move(img), kNone_GrSurfaceFlags, 1, SkBudgeted::kYes, fit, surfaceFlags);
|
std::move(img), clearFlag, 1, SkBudgeted::kYes, fit, surfaceFlags);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user