Commit Graph

53559 Commits

Author SHA1 Message Date
Mike Reed
554aabbaa8 Prepare flag to hide setFilterQuality
Bug: skia:7650
Change-Id: I9cfd6f87e2ca1eb5680e1ec83a029c6bfdbe7b2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370236
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-02-13 18:06:43 +00:00
Brian Osman
4f065e286d Revert "Performance experiment: Disable SkSL optimization in nanobench/skpbench"
This reverts commit 5ad759065d.

Reason for revert: Experiment concluded - got the data we need.

Original change's description:
> Performance experiment: Disable SkSL optimization in nanobench/skpbench
>
> Change-Id: I974571e7e0e9d0170f92b970d425d9ce530e312e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369716
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,brianosman@google.com,johnstiles@google.com

Change-Id: I68bc07e8a604abb77fe9c1f1dac794ab7b90b9e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370156
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-13 01:06:13 +00:00
John Stiles
80b02af6ba Fix assertion when arrays are double-declared.
Multi-dimensional arrays aren't legal in GLSL/SkSL, so this should be
caught and flagged as an error. The parser now verifies that a
variable's type isn't an array-type before accepting a `[` token to
open an array on the variable name.

This CL also refactors the IR generator's `convertArraySize` method to
make sure that various checks are made for all callers. Originally this
restructuring was used to verify array multi-dimensionality, but that
didn't detect errors inside struct declarations (which get no error
checking inside the IR generator) so the IR generator updates no longer
need to check the array dimensions.

Bug: skia:11322
Change-Id: Id33f4bdfb544019ddf995a8196c3c09cfe5a4525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369916
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-12 23:49:04 +00:00
Nathaniel Nifong
ba4c3086ba Move GPU locking logic into generic hardware profile
Change-Id: If130b47acdd7f7fc06daa1d4cb5938e4476e0171
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367776
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2021-02-12 23:01:08 +00:00
John Stiles
59e3456695 Avoid descending into Expressions unnecessarily.
We know expressions can't contain @if or @switch statements inside of
them, so we can avoid recursing into them and run this check slightly
faster.

Change-Id: I60cd6dd40ddda74f7af259fd13e5ea0779982384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370076
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-12 22:46:04 +00:00
John Stiles
8dabeac58c Improve error reporting for invalid var-decls.
We now interpret any statement of the form `Type identifier...` as a
var-declaration and report errors as such. Previously, if a var-decl
statement generated an error during parse, we'd report errors as if it
were an expression-statement, which meant that slightly-invalid code
could return out-of-context, misleading errors.

Bug: skia:11287
Change-Id: I2c6cf2984760eb34593c80cb30f8c4e007d42027
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370036
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-12 22:26:36 +00:00
Mike Reed
6e73404a78 Remove unused high-quality downgrade heuristic
Change-Id: I4c57f207497f6e701af517fe67c297e210c7ceae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369997
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-02-12 21:48:13 +00:00
Brian Osman
6c3b23fcf3 SkSL: Ensure struct declarations contain at least one member
Bug: skia:11314
Change-Id: I66476543462ae378a5bfb6cbd902dfa2f5fc45f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369917
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-12 20:57:56 +00:00
John Stiles
1f19ce2272 Reland "Remove deprecated form of SkRuntimeEffect::Make."
This reverts commit e89b50ae05.

Reason for revert: landed Android fix at http://ag/13544365 (master) and
http://ag/13554983 (sc-dev)

Original change's description:
> Android roll broke with a compilation error:
> frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get'
>     sk_sp<SkRuntimeEffect> effect = std::get<0>(result)
>
> Revert "Remove deprecated form of SkRuntimeEffect::Make."
>
> This reverts commit 1cda194366.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Remove deprecated form of SkRuntimeEffect::Make.
> >
> > Chromium has migrated to the new API at https://crrev.com/c/2675855.
> >
> > Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
>
> Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Stan Iliev <stani@google.com>

TBR=mtklein@google.com,brianosman@google.com,stani@google.com,johnstiles@google.com

Change-Id: I9d679013cb275dc80aaaa977b7f1f4da31f36d1e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369037
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-12 20:57:50 +00:00
Brian Salomon
2494942f0d Reland "Flush rather than copy pixels in GrSurfaceContext::writePixels."
This is a reland of 3b7a12bd66

Original change's description:
> Flush rather than copy pixels in GrSurfaceContext::writePixels.
>
> Speculative fix for:
>
> Bug: chromium:1171141
> Bug: chromium:1171188
> Change-Id: Ic9762f17652172e620c6bb59aa89e3bb6bc97659
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369318
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:1171141
Bug: chromium:1171188
Change-Id: I535c9e0252b73c5277b0257ea5cdcac92de53e70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369877
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2021-02-12 20:42:58 +00:00
Mike Klein
e76e47982b skvm float divides are meant to allow /0
In this case, unpremul() hits a divide-by-zero here,

    F32 invA = 1.0f / a

but then fixes it (and divide-by-tiny) after the fact,

    invA = select(invA < inf, invA, 0)

Bug: oss-fuzz:30887
Change-Id: Id2da801e04bd21df2138d3db110eedb238e28c43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369936
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-12 19:52:33 +00:00
Brian Salomon
725f158bcc Remove GrGpu::testingOnly_flushGpuAndSync
Submitting without additional flushing and syncing GPU/CPU is achievable
with public APIs. Moreover, this testing-only method bypasses code and
can lead to bugs.

Change-Id: I03bd0fa65e5ba88ba6181521947243ba84ab9696
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369876
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-12 19:33:59 +00:00
Adlai Holler
79426194de Pipe ReducedOpsTaskSplitting into skpbench.py
This ought to help!

Bug: skia:10877
Change-Id: I8265c26dc4146ab78c125f27b533915cfb61aae8
Cq-Include-Trybots: luci.skia.skia.primary:Perf-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Vulkan_ReduceOpsTaskSplitting_Skpbench,Perf-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_ReduceOpsTaskSplitting_Skpbench,Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-ASAN_ReduceOpsTaskSplitting_Vulkan
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369756
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-02-12 19:32:02 +00:00
Chris Dalton
3354f8c4f8 Simplify stroke join definitions in tessellation shaders
All of a join's information can fit in a single float value:

    Negative => Round Join
    Zero     => Bevel Join
    Positive => Miter join, and the value is also the miter limit

Bug: chromium:1172543
Bug: skia:10419
Change-Id: I50bd822a735987cf21537164267d00e3f34badc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369457
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-02-12 19:26:58 +00:00
John Stiles
381dd5721f Remove ternary Lvalue support in SPIR-V.
Ternaries are not assignable in GLSL/SkSL. This code should never have
been reached; no tests are affected.

Change-Id: I7d0139531062c27d7af395553e0d225247a70b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369878
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-12 19:26:57 +00:00
Mike Klein
28698696f1 revise how we handle invalid configs
Move the contrast pin to Make() so it affects all implementations.

Bug: oss-fuzz:30859
Change-Id: Iaf7854701bc6a148976f653066d7bf8f27080d2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369698
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-02-12 16:46:37 +00:00
Brian Osman
5ad759065d Performance experiment: Disable SkSL optimization in nanobench/skpbench
Change-Id: I974571e7e0e9d0170f92b970d425d9ce530e312e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369716
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-12 16:02:25 +00:00
John Stiles
bb1505f2ab Move static-switch and static-if tests out of scanCFG.
We don't need to do these tests every time we run CFG optimization; we
can do them once at the end of optimization, as a separate step.

Change-Id: If0e72fbacb938b62387fd2ffdbf34d1153bf3bd4
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369481
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-12 15:32:32 +00:00
Herb Derby
1526444aa4 Allocator for GrTextBlobs
This allocator is made specifically to handle the memory after
the class of a textblob. It is lighter weight than ArenaAlloc,
easier to calculate needed memory.

Change-Id: Ie9f94e08e2ffd4041712dd3025296a830e940eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356317
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-12 15:30:36 +00:00
John Stiles
ec24154521 Fix SPIR-V bug with swizzled out parameters.
The CL at http://review.skia.org/366399 introduced a bug with
LValue::getPointer. Specifically, getPointer used to return zero when
no pointer is available. (This happens when the LValue is a swizzle.)
That CL changed the error code to -1. However, it did not fix up all
the call sites that checked the return value of getPointer().

This CL fixes up those call sites to use -1 consistently, and adds
TODOs in spots which do not check the result from getPointer() at all
(instead assuming it cannot fail). This will allow swizzled out-
parameters to work in SPIR-V as they did before. (Except in intrinsics,
where they seem to have been broken all along, but those are now marked
with a TODO at least.)

Note that we still do not fully emulate GLSL semantics for out
parameters, as out-parameters should only be copied back to the original
variable at the end of the function call to be fully GLSL compliant.

(This CL also replaces a tuple with a named struct for readability.)

Change-Id: I708dc7a69296a4244ba9ceb85c3e68d1f331bbc9
Bug: skia:11052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368618
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-12 15:21:27 +00:00
Michael Ludwig
b604452761 Delete deprecated blur filter header
This also deletes the type conversions between the legacy
tile mode and SkTileMode and cleans up the serialization
logic around that just a little bit.

Bug: skia:11230
Change-Id: If404a73e13f42055a0fe7638dcd9f58cf7e9b896
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368243
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-12 13:49:45 +00:00
skia-autoroll
3370d68067 Roll Dawn from 7e80cce1a906 to d44159c23c10 (3 revisions)
https://dawn.googlesource.com/dawn.git/+log/7e80cce1a906..d44159c23c10

2021-02-11 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from c2118b0dcb2a to dc9d3e0cd5f2 (11 revisions)
2021-02-11 senorblanco@chromium.org Enable more tests on OpenGL and OpenGL ES backends.
2021-02-11 cwallez@chromium.org Reland "Vulkan: Fallback to XCB for Xlib surfaces"

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from c2118b0dcb2a to dc9d3e0cd5f2

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dawn-skia-autoroll
Please CC kainino@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn
Bug: None
Tbr: kainino@google.com
Change-Id: Ie7519444e56f84992edae8faa3eb4b72b3274cd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369584
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-02-12 05:44:46 +00:00
skia-autoroll
7755db63fe Roll Chromium from 897c00073839 to ede6daaf9f05 (402 revisions)
897c000738..ede6daaf9f

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/chromium-skia-autoroll
Please CC borenet@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Perf-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-CommandBuffer;skia/skia.primary:Test-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-CommandBuffer
Tbr: borenet@google.com
Change-Id: Ifa21804ee14aace583f897176e9b2bfa29ce91e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369616
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-02-12 05:39:30 +00:00
skia-autoroll
22363fe3da Roll ANGLE from cffe90b44a51 to cf8c71de559a (12 revisions)
cffe90b44a..cf8c71de55

2021-02-11 jmadill@chromium.org Supress failing capture/replay test.
2021-02-11 angle-autoroll@skia-public.iam.gserviceaccount.com Roll VK-GL-CTS from fd70e387953e to d8a8a5c337df (2 revisions)
2021-02-11 ynovikov@chromium.org Link angle_util statically into angle_system_info_test
2021-02-11 asully@chromium.org Only define test suites when TEST_Ps defined
2021-02-11 syoussefi@chromium.org Revert "GL: Cache the results of glGetString"
2021-02-11 jmadill@chromium.org Capture Tests: Add to CQ when script is changed.
2021-02-11 jmadill@chromium.org Capture Tests: Update path to capture/.
2021-02-11 jonahr@google.com GL: Do not support ETC1 textures on Desktop GL
2021-02-11 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 4dc6ccfad74a to c409714366e9 (3 revisions)
2021-02-11 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 95cbe3e024b0 to d671c89249af (511 revisions)
2021-02-11 lehoangq@gmail.com Metal: fix incorrect default viewport size with contentsScale>1
2021-02-11 angle-autoroll@skia-public.iam.gserviceaccount.com Roll VK-GL-CTS from 28d3d98b040d to fd70e387953e (1 revision)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/angle-skia-autoroll
Please CC borenet@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Release-ANGLE;skia/skia.primary:Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Debug-All-ANGLE;skia/skia.primary:Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Debug-All-ANGLE
Tbr: borenet@google.com
Change-Id: I9b3c4c8dcc91ab4e139f0684f280dd4b03070c6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369583
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-02-12 05:08:13 +00:00
Adlai Holler
c616e1c179 Remove the partial-flush machinery from GrResourceAllocator
Since review.skia.org/366716 this is unused and it makes our life
a whole lot simpler. And a little faster.

Bug: skia:10877
Change-Id: Ib7205bae57ce282f0e4f33c7c780a4c3e5159ea5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369436
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-11 23:35:39 +00:00
Herb Derby
b33140ac7d allocation system for properly aligned bytes
GrBagOfBytes parcels out bytes with a given size and alignment.
It is very careful about checking all values coming so that
no calculations overflows.

If the current block is not big enough to satisfy the request
bytes, a new block will be allocated to satisfy the
requested bytes.

Change-Id: If7b5e812f903b51ba4936605cd0dc298dda8821a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368117
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-02-11 23:17:28 +00:00
Florin Malita
26af11c867 [skottie] Fix sphere lighting shader
Clamp s_base to avoid negative pow arguments.

Fixes rendering issues on Mac/Win.

Change-Id: I5176ffa6150ec430c2ab72115b74fd7ede5f5934
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369482
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-11 23:15:02 +00:00
Brian Osman
f67199e1a7 Enforce runtime effect's isOpaque on the GPU backend
CPU already does this. Forcing it this way ensures that optimizations
related to opaqueness are correct.

Change-Id: Iaec3990ec0102b4c11f942774361239d3583adfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369323
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-11 22:55:08 +00:00
Dominik Röttsches
691a794bee Support COLRv1 color fonts
Implement support for COLRv1 color gradient vector forms. COLR v1 is an
extension to the OpenType COLR tables that introduces support for
gradients, transforms and compositing. [1]

COLRv1 fonts contain an OpenType COLR table with format v1. In a COLR v1
table, glyphs are defined by a directed, acyclic graph of Paint
operations. The task for the Skia implementation is to extract the COLR
v1 information from the font using FreeType's COLRv1 API, then traverse
the glyph graph and translate information from the font into Skia
operations on SkCanvas.

Care needs to be taken for transformations to work correctly. FreeType
sends a top level transform that includes the scaling from font units to
actual glyph size, as well as optional transforms configured on FreeType
using FT_Set_Transform. This is set up as the starting transform at the
beginning of drawing a COLRv1 glyph. At the stage of setting a clip for
a PaintGlyph operation, the glyph outline is retrieved from FreeType
unscaled and untransformed. Since the starting transformation is applied
to the SkCanvas, the unscaled glyph is properly scaled and positioned.

Similarly, computing the initial bounding box for the COLRv1 glyph needs
to consider transformations. COLRv1 glyphs have a base glyph entry in
the glyf table which can use a minimum of two points for defining a
bounding box. This bounding box is an imaged rectangle enclosing those
two points at the identity transform. We need to compute the bounding
box scaled, but at identity transform, then make a rectangle from it,
that we then transform so that we get a large enough area to paint
in. If those two points from the glyf table would be transformed first,
then we would compute the bounding box, the resulting bounding box ends
up too small.

As a test font, add a version of the samples-glyf_colr_1.ttf from [2]
with one glyph added for testing PaintColrGlyph functionality and
compositions.

Add a basic GM test that produces color glyphs untransformed, with
skew and with rotation and combinations of those.

[1] https://github.com/googlefonts/colr-gradients-spec/
[2] https://github.com/googlefonts/color-fonts

Bug: skia:11264
Change-Id: I8357cd0c7ac0039bb2eac18f21fa343bf61871eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300558
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-02-11 22:51:13 +00:00
Ethan Nicholas
11a15b1181 added SkSL DSL uniform support
Change-Id: I42c9aa76318ed744ba1390733bb0bd33413ebf29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362499
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 22:03:56 +00:00
Greg Daniel
9408a6170b Final bits of vulkan buffer memory optimizations.
This moves transfer upload buffers to the new better specific memory
usage and removes the CPU buffer used on android for writing to gpu
buffers. The later will hopefully have some perf wins.

Bug: skia:11207
Change-Id: I581e179b155bdadcae5d3f881b5a479338e01240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369479
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-02-11 21:52:12 +00:00
John Stiles
d6a5f449d8 Migrate PermitInvalidStaticTests flag to Program::Settings.
This will make it accessible from the IR generator (in a future CL) and
is more in line with how we typically manage settings.

Change-Id: I478d617119cba079d1124b2b9c26d5573c7d6ae3
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369480
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-11 21:41:33 +00:00
Ethan Nicholas
bf79dff9d8 SkSL DSL struct support
Change-Id: I68eb7be8e46454d95bb4a6a9743c923d093c9ba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368857
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 21:36:42 +00:00
Mike Klein
2af98b2822 high-contrast filter as runtime
I think this is good to go.

Originally I had been careful to treat nullptr dst as gamma=2, but then
seeing the GPU impl treating all colorspaces as gamma=2 made me realize
it's can't be that important to preserve pixel-exact results here.  It's
not possible with a single codebase... in many situations the existing
CPU and GPU backends draw differently with identical settings.

Beyond that sort of obvious intentional difference, I've also tried to
port as few bugs forward from the old implementations as possible.  The
one I notice most clearly is in the GPU code,

    @if (invertBrightness) {
        color = half4(1) - color;
    }

which I think probably should be `color.rgb = 1 - color.rgb`, leaving
alpha alone.

Change-Id: I098cdced4772445c70ce4577bdd1c93c2e42824c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368276
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-02-11 21:18:08 +00:00
Brian Osman
8e756f379c Support structs in runtime effects
Uses the pipeline-stage callback mechanism. It mangles the type name
(with a test to verify that this works), and then calls defineStruct
with the entire SkSL struct definition string.

Bug: skia:10939
Change-Id: If14cf1b11faaa80ad8d4086cdacf68532bac43fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368809
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 21:09:15 +00:00
Brian Osman
f4738966f4 Replace settings values during IR conversion
This avoids creating a Setting object (only to then
replace it during optimization). More importantly,
it makes it possible to disable optimization without
leaving un-resolved settings in the IR.

Settings in the pre-load modules are still loaded
as Setting objects, and those are resolved during
the one-time optimization pass of those modules,
whether or not per-program optimization is run.

Change-Id: Idf560a49f936edc683463dc8a60771d0624b45d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369325
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-11 21:06:05 +00:00
Chris Dalton
b41676d598 Extract a subclass for binning stroke instances
This will make it easier to add "dynamic" attribs like stroke width or
color.

Bug: chromium:1172543
Bug: skia:10419
Change-Id: Ia8326c80fb2fe3ab630b03e9bfdc6368385176b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368956
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-02-11 20:50:50 +00:00
Michael Ludwig
820921e542 Rename SkXfermodeImageFilter to SkBlendImageFilter
Also deletes the old header under the deprecated name.

Bug: skia:11230
Change-Id: Iac42d2b980d3306a544077719ca62903a673210a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368242
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-11 20:39:25 +00:00
Ethan Nicholas
570506db41 Added DSL FP codeAppend function.
This also adds the relevant Start() / End() calls so that the DSL
is put into the correct state.

Change-Id: I844b0ab5dff06e3f7b0a69458bf4442a5da0f33e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364857
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 20:37:24 +00:00
Mike Klein
cb92744d3d SkColorFilters::WithWorkingFormat
https://docs.google.com/document/d/1z9ZODlZX4XXbfOjh2t1-1Z7FJcCCcOfbrEjiFzPE4vg/edit?usp=sharing&resourcekey=0-Io-07D1zm1yKMQN2UAiYBw

This approach lets us write color filters that want to work in
particular color spaces and alpha formats and adapt them to our normal
pipeline.  It should work with pre-canned and runtime effects, and we
can do the same sort of thing for shaders too.

Some features are designed for using this with the high-contrast filter:

   - ability to change working tf and gamut separately: as written the
     HC effect only wants to work in linear space without changing
     gamut, which is I bet will be a common desired mode.  But other
     effects may want to fully change the working color space, e.g. to
     sRGB or XYZ.

   - adapting the alpha type to unpremul is mostly a flourish: you could
     do it yourself in sksl, but we might as well do it if doing other
     transforms anyway (it's cheaper this way than doing it yourself),
     and this may make it easier to adapt non-runtime effects.
     (I bet most color filters actually want to be unpremul.)

I briefly also included a knob to control how this effect treats a
nullptr dst color space, but I've come back around to that not being a
parameter.  I think this is a situation where we know best.

New GM to demo.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I420e3a2aa648f314c019a98bfdcd44e810a3dac6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368336
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-02-11 19:44:33 +00:00
Chris Dalton
dfa91793f8 Remove GrStrokeIndirectTessellator::fResolveLevelForCircles
Stores it on the ResolveLevelCounter instead. This will allow
different paths to have different stroke widths.

Bug: chromium:1172543
Bug: skia:10419
Change-Id: I0ff68b7287027a22d9374826b3c57290192489bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368937
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-02-11 19:14:59 +00:00
Mike Klein
ae8ba01835 further refine reruns
On batch failure we're rerunning every source in the batch, while we
really only need to rerun sources that we don't know succeeded.

If for example we run sources "foo", "bar", and "baz", and foo produces
a known hash, then bar crashes, we only need to rerun bar and baz.  The
batch run was enough to demonstrate foo's good.

Change-Id: I17634a6095906bcc2ad0bd33bb78eba000654b5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369456
Reviewed-by: Eric Boren <borenet@google.com>
2021-02-11 18:29:45 +00:00
Brian Salomon
a1e5f58cb0 Revert "Flush rather than copy pixels in GrSurfaceContext::writePixels."
This reverts commit 3b7a12bd66.

Reason for revert: metal command buffer assert?

Original change's description:
> Flush rather than copy pixels in GrSurfaceContext::writePixels.
>
> Speculative fix for:
>
> Bug: chromium:1171141
> Bug: chromium:1171188
> Change-Id: Ic9762f17652172e620c6bb59aa89e3bb6bc97659
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369318
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,adlai@google.com

Change-Id: I5db0cfabb1396db3d4fe9f9c6809d5de72d6572f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1171141
Bug: chromium:1171188
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369476
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-11 18:06:42 +00:00
John Stiles
1b91c0e29b Fix use-after-free discovered by the fuzzer.
The optimization which replaces unnecessarily nested constructors is
creating a new constructor from whole cloth, obliterating the original
constructor and its arguments. This can invalidate the definition map.
For now, this is fixed by forcing a rescan when this optimization is
applied.

Change-Id: I8a46bccf3b6422282eaf95409cd4fa50b8ad3187
Bug: oss-fuzz:29994
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369324
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-11 17:52:43 +00:00
Chris Dalton
53ab360418 Don't forget to call putBackVertices from the stroke tessellator
Change-Id: I80652861841ec4f049336f1759c1c26a934c309a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369261
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-02-11 17:40:20 +00:00
Mike Klein
510e45c223 minor fm_driver tweaks
Move definition of Work struct until just before it's used,
and show one of the sources as an example at kickoff-level step.

These are just cosmetic/refactors.

Change-Id: Ib23b9379683b9867e097c8d68ef8736013719cee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369356
Reviewed-by: Eric Boren <borenet@google.com>
2021-02-11 17:33:06 +00:00
Mike Klein
0ebdb37b55 plumb errors up to mid-level steps
As is, on failure the top-level task fails correctly,
then the next level steps all confusingly look green,
then the next two levels down are correctly failed and red.

I think this is because worker(ctx) fails `ctx`, which we make like
this,

    ctx := startStep(w.Ctx, td.Props(strings.Join(w.Sources, " ")))

but nothing ever fails that `w.Ctx`.  This should fix that.

Compare trybot runs here with https://task-driver.skia.org/td/BMCjZbc5ki1cXbkM0oZp?ifNotFound=https%3A%2F%2Fchromium-swarm.appspot.com%2Ftask%3Fid%3D51aa8032a90a8810

Change-Id: Idfbd933b9027cac423a3a2cc5b0513c894d60e63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369265
Reviewed-by: Eric Boren <borenet@google.com>
2021-02-11 17:24:21 +00:00
Jorge Betancourt
1352d0e47d [canvaskit] perform audio asset lookup by layer id
Change-Id: Iac56d11a76be8d90df1159631a02f1713ece1bd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368938
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-02-11 17:11:00 +00:00
Florin Malita
80aa5b1365 [skottie] Add threshold effect
https://helpx.adobe.com/lv/after-effects/user-guide.html/lv/after-effects/using/stylize-effects.ug.html#threshold_effect

Bug: skia:11311
Change-Id: I9d726b4526f2bbe584f11c77ee2e6829e5148956
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369156
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-11 16:35:32 +00:00
Dominik Röttsches
eff697a78b Roll FreeType
60ba8fe9e7..54c5ad5c92

Includes changes required for COLR v1 support.

No changes to ftoption.h or ftmodule.h.

Change-Id: Id7fff0437144ad4e8318d8b462470bb0c4d6c02d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369336
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-02-11 16:26:52 +00:00