d1d4cbf2e4
My first drafts put caching inside SkVM.cpp, which I rejected for feeling a little too magic, and then in SkVMBuilder.cpp using a fingerprint of the skvm::Builder to skip Builder::done(). This version makes an explicit Key structure holding all the parameters that currently matter to the Blitter, and caches using that. This is nice because it can be done much more cheaply than running the JIT, and much more cheaply even than running the Builder. It also makes the parameterization of the Blitter explicit, which I like. This does sometimes create programs that are equivalent but have different keys, but that's not that common, and it's pretty harmless. E.g. today if the device colorType() is opaque or premul, we'll think those are different programs, but actually end up making the exact same calls to Builder. No big deal, and maybe even gives us a suggestion to do something when the destination is opaque to skip work. I've left that as a TODO followup. We really only need a small cache to get a good hit rate. Running all GMs in one process serially, we're now down to 22 calls to done() from >100K at head (and >500K yesterday). (Would be 13 if we treated opaque and premul the same.) There are two places I'd like to have used tryAcquire() on an SkSpinlock but the thread safety static analysis is wrong and prevents me. Left some TODOs. Change-Id: I83a365fc895720c76b56b0e5a78f4c673fcd9d64 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232817 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Herb Derby <herb@google.com> |
||
---|---|---|
animations | ||
bench | ||
bin | ||
build_overrides | ||
dm | ||
docker | ||
docs/examples | ||
example | ||
experimental | ||
fuzz | ||
gm | ||
gn | ||
include | ||
infra | ||
modules | ||
platform_tools | ||
resources | ||
samplecode | ||
site | ||
specs | ||
src | ||
tests | ||
third_party | ||
tools | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
.gn | ||
AUTHORS | ||
BUILD.gn | ||
codereview.settings | ||
CONTRIBUTING | ||
CQ_COMMITTERS | ||
DEPS | ||
go.mod | ||
go.sum | ||
LICENSE | ||
OWNERS | ||
PRESUBMIT.py | ||
public.bzl | ||
README | ||
README.chromium | ||
RELEASE_NOTES.txt | ||
whitespace.txt |
Skia is a complete 2D graphic library for drawing Text, Geometries, and Images. See full details, and build instructions, at https://skia.org.