Go to file
Mike Klein 0393505a2d opaque shaders and srcover -> src
Program caching makes whether or not this is safe a little subtle.  It
is safe and I've tried to explain the subtlety in comments in the new
non-virtual Shader program() hook that forces all opaque shaders to
opaque, and in comments in SkVMBlitter where we make use of isOpaque().

I think this is the tidiest way to get the optimization and safety,
though it is a little awkward to have to write epic cross-referenced
comments explaining first why it might not generally be safe to use
shader->isOpaque() to make decisions in the blitter, and then how we
actually have made it really quite safe.

Many tiny partial-coverage diffs from how coverage interacts differently
with SrcOver and Src, SrcOver folding coverage into the src color before
blending with dst, Src just lerping with dst.

This all comes together really quite magically, changing a program to
draw a solid opaque color from this,

    11 registers, 41 instructions:
    r0 = uniform32 arg(0) 0
    r1 = splat FF (3.5733111e-43)
    r2 = extract r0 8 r1
    r3 = splat 80 (1.793662e-43)
    r4 = extract r0 24 r1
    r5 = sub_i32 r1 r4
    r6 = extract r0 16 r1
    r0 = extract r0 0 r1
    loop:
    r7 = load32 arg(1)
    r8 = extract r7 8 r1
    r8 = mul_i32 r8 r5
    r8 = add_i32 r8 r3
    r9 = shr_i32 r8 8
    r9 = add_i32 r8 r9
    r9 = shr_i32 r9 8
    r9 = add_i32 r2 r9
    r8 = extract r7 0 r1
    r8 = mul_i32 r8 r5
    r8 = add_i32 r8 r3
    r10 = shr_i32 r8 8
    r10 = add_i32 r8 r10
    r10 = shr_i32 r10 8
    r10 = add_i32 r6 r10
    r9 = pack r10 r9 8
    r10 = extract r7 16 r1
    r10 = mul_i32 r10 r5
    r10 = add_i32 r10 r3
    r8 = shr_i32 r10 8
    r8 = add_i32 r10 r8
    r8 = shr_i32 r8 8
    r8 = add_i32 r0 r8
    r7 = extract r7 24 r1
    r7 = mul_i32 r7 r5
    r7 = add_i32 r7 r3
    r10 = shr_i32 r7 8
    r10 = add_i32 r7 r10
    r10 = shr_i32 r10 8
    r10 = add_i32 r4 r10
    r10 = pack r8 r10 8
    r10 = pack r9 r10 16
    store32 arg(1) r10

to this,

    4 registers, 9 instructions:
    r0 = uniform32 arg(0) 0
    r1 = splat FF (3.5733111e-43)
    r2 = extract r0 8 r1
    r3 = extract r0 16 r1
    r2 = pack r3 r2 8
    r0 = extract r0 0 r1
    r1 = pack r0 r1 8
    r1 = pack r2 r1 16
    loop:
    store32 arg(1) r1

Change-Id: Ic1e2ac1496252970743ef44b17908965bc73e384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252198
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-01 18:31:35 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Reland "Add variety of bulk API benchmarks" 2019-10-28 18:48:32 +00:00
bin roll GN 2019-09-26 20:34:17 +00:00
build_overrides Update Dawn backend to ToT. This is about 3 months of changes. 2019-10-15 22:26:38 +00:00
dm Rename functions in TestUtils.h 2019-10-25 00:36:28 +00:00
docker Fix usage of depot_tools in containers. 2019-10-14 19:38:40 +00:00
docs/examples docs/fiddle: add "incomplete" fiddle. 2019-10-11 18:22:34 +00:00
example Revert "add guard to switch to SkPathTypes" 2019-09-14 19:13:44 +00:00
experimental Reland "Minimal iOS app: Perform present subsequent to flush" 2019-10-14 18:32:37 +00:00
fuzz [fuzzing] Fix skdescriptor deserialize compile 2019-10-23 11:54:14 +00:00
gm paint color -> shader 2019-11-01 17:57:15 +00:00
gn add GM for exercising interesting paths in SkVMBlitter 2019-11-01 15:39:34 +00:00
include Add BT2020 (non-constant-luminance) YUV color space 2019-11-01 14:34:13 +00:00
infra [infra] Update git, make [Canvas|Path]Kit et al use git from CIPD 2019-11-01 13:40:23 +00:00
modules [canvaskit] Add tentative support for savelayerrec 2019-10-29 16:46:43 +00:00
platform_tools android_gdbserver: Don't fail when trying to locate nonexistent files 2019-09-16 16:28:33 +00:00
resources [skottie] Fix layer blend modes under mattes 2019-10-29 01:49:26 +00:00
samplecode Add helper to determine the index buffer that will be used 2019-10-28 16:36:02 +00:00
site [docs] Add skolo-builder to swarmingbots.md 2019-10-30 19:06:48 +00:00
specs [img-decode] Start on proposed new spec 2019-05-06 17:39:19 +00:00
src opaque shaders and srcover -> src 2019-11-01 18:31:35 +00:00
tests Use GrSurfaceProxyView for dst proxies. 2019-11-01 17:18:19 +00:00
third_party Dawn: roll to ToT. 2019-10-30 14:29:26 +00:00
tools tools/git-sync-deps: enforce commit hash in DEPS, not tags or branches 2019-11-01 17:22:40 +00:00
.clang-format restore .clang-format 2019-03-21 15:52:32 +00:00
.clang-tidy add google-build-namespaces to clang-tidy checks 2018-12-12 16:33:59 +00:00
.gitignore clean up some .gitignores 2019-05-15 19:55:45 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS build: fix compilation on macOS with 10.14 SDK 2019-10-30 20:18:58 +00:00
BUILD.gn refactor/layering: SkMalloc.cpp 2019-10-31 15:49:03 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Roll third_party/externals/angle2 841b01678c49..e96039218e9d (6 commits) 2019-11-01 11:44:13 +00:00
go.mod Update Go deps 2019-10-24 05:26:54 +00:00
go.sum Blacklist bulkrect benchmarks on chorizo 2019-10-28 22:04:15 +00:00
LICENSE BUG=skia:5602 2016-09-02 11:19:34 -07:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py Use urllib_request instead of urllib2 in PRESUBMIT. 2019-10-22 20:30:56 +00:00
public.bzl remove SkPicture_none.cpp 2019-08-16 14:52:25 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
RELEASE_NOTES.txt Add BT2020 (non-constant-luminance) YUV color space 2019-11-01 14:34:13 +00:00
whitespace.txt Whitespace test 2019-05-18 13:05:29 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.