Commit Graph

53152 Commits

Author SHA1 Message Date
Florin Malita
24df67d04e Reland "[svg] Plumb a ResourceProvider"
This is a reland of dd29e20904

Original change's description:
> [svg] Plumb a ResourceProvider
>
> ... for image loading.
>
> Update the SVG tools to pass local/FS resource providers.
>
> Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Tyler Denniston <tdenniston@google.com>

Change-Id: I28de60b299fc89f46b090812fc632105143fb6da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360607
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-01-27 21:12:23 +00:00
Tyler Denniston
e71f547302 [svg] Expand SkSVGIRI type
This CL adds a type enum to SkSVGIRI that will eventually be used to
distinguish between local fragments ('#frag-id'), non-local fragments
('/path/to/file.png') and data URIs ('data:image/png;base64,...').

To do so required a bit of refactoring of other types that previously
treated IRIs as basic strings. There are no functional changes in this
CL.

Change-Id: I8bf426f77c0779890bce74d2d243c09617f024c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360601
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-27 21:05:41 +00:00
John Stiles
b7f5e1b20d Fix SkSL test compilation on Windows.
The command-line length limit on Windows is very low (~8000 characters)
so it's infeasible to pass a large number of test files directly on the
command line. Fortunately, GN includes a built-in workaround.

Change-Id: I087fc00f11d81d84f677c2833406b4a6164ea6b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360716
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-01-27 20:17:28 +00:00
Kevin Lubick
2c3cec998f [canvaskit] Break up helper.js into smaller files
This will hopefully make some things easier to find/understand.
I have a few more ideas for breaking up other parts.

Bug: skia:11203
Change-Id: Ia54c13fd6e3c897e04a737b258f6e77c50a1aed3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356839
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-01-27 20:13:34 +00:00
Brian Salomon
9e8e2aa9c3 Remove SkImage_GpuBase::getTexture().
Part of effort to consolidate access to GPU SkImage texture proxies.

Bug: skia:11208
Change-Id: Icfcf6fea6be6f05220a5ddd1482f88dafe1cbd9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359836
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-01-27 19:19:20 +00:00
Florin Malita
64400d95d6 Revert "[svg] Plumb a ResourceProvider"
This reverts commit dd29e20904.

Reason for revert: breaking the G3 roll

Original change's description:
> [svg] Plumb a ResourceProvider
>
> ... for image loading.
>
> Update the SVG tools to pass local/FS resource providers.
>
> Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Tyler Denniston <tdenniston@google.com>

TBR=fmalita@chromium.org,fmalita@google.com,tdenniston@google.com

Change-Id: If5f9673f9ff40dd5f8a8f9cf8f46a4342f29f31f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360602
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-01-27 18:53:31 +00:00
John Stiles
9485b55b34 Code cleanup: reuse get_storage_class in writeGlobalVar.
Previously, we reimplemented get_storage_class almost verbatim in
writeGlobalVar. A few tiny tweaks allowed this logic to be deduplicated.

Change-Id: I9f7bb24c53f5249ea4e2e87ea8d18ff7b7150ed8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360598
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-01-27 18:51:50 +00:00
Adlai Holler
b4bcfb93c3 Add ReduceOpsTaskSplitting test bot, move perf bot
The perf bot on Pixel1 isn't worth much. Moved to pixel4xl since
it's one of the ones that still has some capacity.

Added a test bot that uses ASAN.

Bug: skia:10877
Change-Id: I04ac5d5c2359e38b88519e037f86911807daf32e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360417
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2021-01-27 18:45:20 +00:00
Adlai Holler
9202ebc7ad Fix reduceOpsTaskSplitting + image_from_yuv_textures
SkTHashMap->remove does not like if you try to remove
an entry that isn't in there. In that case, we don't
want to do anything.

Bug: skia:10877
Change-Id: Ib87aac7a132c78915ec18724f847c44c2c3efa80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360596
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2021-01-27 18:25:00 +00:00
Ben Wagner
dd9449c23b Add SkShaper::PurgeCaches.
Allows the user to signal that any global outstanding cached data should
be cleaned up to free resources.

Change-Id: I59d4bb2bbb4356920dea8caf912d9cb5f13014cf
Bug: skia:10763
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360079
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-01-27 17:50:30 +00:00
John Stiles
0ca2f599dd Code cleanup: update obsolete comment, remove macro.
Change-Id: Ia0bc034a9360c03d74d97923f4a963aaa09fb58e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360577
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-01-27 17:13:50 +00:00
Brian Osman
21f570769e Fix complex lvalues in SkSL-to-SkVM
The old code only handled swizzles as the outermost expression(s) in an
lvalue. The new code removes that restriction, and puts all the logic in
writeStore, which is the only place it needs to exist.

The newly added test asserted before, and now passes.

Bug: skia:11178
Change-Id: I8083d9d478ad4dc993cb963d34a97c10965831b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358956
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-27 16:51:20 +00:00
Brian Salomon
7d2757fc6d Implement SkImage::hasMipmaps() for GPU images
Step towards consolidating texture-backed SkImage proxy access.

Bug: skia:11208
Bug: skia:9570
Bug: skia:10411

Change-Id: Ica18a61bf59e6977addf58a9b4522859bc467ca2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359917
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-01-27 16:40:19 +00:00
Tyler Denniston
8eedcd2dea [svg] Partial implementation of feSpecularLighting
https://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement

Because a fair amount of functionality will be shared between
feSpecularLighting and feDiffuseLighting, this CL adds an intermediate
SkSVGFeLighting base class for common code.

The only light source type implemented in this CL is fePointLight, which
exercised by the filters-light-03 W3C test.

Bug: skia:10841
Change-Id: Icae26dedb1aae1cd25ba2db7c6468a243ebacbc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359756
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-27 16:14:29 +00:00
John Stiles
7b92897d62 Reland "Add SkSL for-loop control flow test to dm."
This reverts commit 578f1acbe8.

Reason for revert: updated test to pass on Mac Intel 5100/6000

Original change's description:
> Revert "Add SkSL for-loop control flow test to dm."
>
> This reverts commit a0c266283a.
>
> Reason for revert: failing on Mac Intel
>
> Original change's description:
> > Add SkSL for-loop control flow test to dm.
> >
> > While loops and do-while loops remain untested in dm, as they are not
> > supported in ES2 (and therefore not available in Runtime Effects).
> >
> > Change-Id: I2f1bfccccd571cc4ced096bc18ebbb9ecc9f9b4a
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359556
> > 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>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I45335d16a695644eaeb8a535298c0efcc616c1ce
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359840
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

Change-Id: I2dc6e870393708a12286658001b723f25a6aec4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359856
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-27 15:46:39 +00:00
Julia Lavrova
d20a1097e8 Round unresolved font blocks to grapheme edges
I had to stage the change with SK_PARAGRAPH_GRAPHEME_EDGES because of
some google3 tests.
Bug: skia:11196

Change-Id: Ic45e43e6c69f649c6bc0fedcc6f303891139b85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359566
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-01-27 15:39:09 +00:00
Ethan Nicholas
d6b26e5f06 added DSL Modifiers
Change-Id: Ie1b0b8068b487905691b20e318c7898653763a25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359757
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-27 14:28:29 +00:00
Florin Malita
dd29e20904 [svg] Plumb a ResourceProvider
... for image loading.

Update the SVG tools to pass local/FS resource providers.

Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-27 14:10:09 +00:00
Brian Osman
fa71ffaedb Reland "Fix field access and indexing of complex expressions"
Evaluating either kind of expression now works like all other
expressions - evaluate the inner part, then work with the resulting
values. Added unit tests for both of these that previously failed.

With this change, writeVariableExpression is only used for
VariableReference expressions, so adjust that, too.

Reland now safe, after fix to Value::operator[]

This reverts commit 1ea6d6051e.

Bug: skia:11178
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker
Change-Id: I14782fcdfef33a47a46334447c5847976721b21f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359564
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-27 14:05:39 +00:00
Brian Osman
f932c692e5 Rewrite operator[] to avoid gcc-8 codegen bug
An upcoming change to SkVMGenerator triggers a gcc-8 x86-only bug. This
change prevents that, by limiting the conversions back and forth from
size_t to int (particularly here, where the original value is also
stored using a bitfield).

Change-Id: Ie7f8f3322dd387b0627ab2b2325ce7d82ce6be39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359563
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-27 14:04:29 +00:00
Brian Osman
22cc3be64b Implement all public intrinsics directly in VM generator
It's very easy to add intrinsics to the VM generator this way, (and
there are others that can't be written in SkSL itself), so this makes
everything consistent.

Bug: skia:10913
Change-Id: I1fcd0047136459f1f6aee2cf4fd87e875edb7e3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348879
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-27 12:55:29 +00:00
skia-autoroll
a78376bf2a Roll ANGLE from 9bbcd86ae719 to 4921e4573c8b (6 revisions)
9bbcd86ae7..4921e4573c

2021-01-27 syoussefi@chromium.org Vulkan: Avoid unnecessary pipeline rebinds
2021-01-27 syoussefi@chromium.org Make glmark2 benchmark output parsing more resilient
2021-01-26 jonahr@google.com GL: Remove in-thread link status check from parallel link path.
2021-01-26 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from dbc46e43978b to 0ba7f6930e7e (8 revisions)
2021-01-26 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 413f7cb17c77 to ea1f7d10db1f (6 revisions)
2021-01-26 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 8378a463e1a2 to 70020e670c0f (434 revisions)

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 nifong@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: nifong@google.com
Change-Id: If4ef182064962a52a0407ade4aee3f233b318e83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360177
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-27 06:19:48 +00:00
skia-autoroll
b2a8dc4355 Roll SwiftShader from ea1f7d10db1f to aec0826aba0d (1 revision)
https://swiftshader.googlesource.com/SwiftShader.git/+log/ea1f7d10db1f..aec0826aba0d

2021-01-26 amaiorano@google.com VulkanBenchmarks: split out benchmark classes into separate files

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/swiftshader-skia-autoroll
Please CC nifong@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:Test-Debian10-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader
Bug: None
Tbr: nifong@google.com
Change-Id: Ied659c3efa03a2f7c740e4e80a052bd248e5f731
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360139
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-27 05:44:58 +00:00
skia-autoroll
99c2e708b4 Roll Dawn from b3177d418e3b to 2df77f432584 (10 revisions)
https://dawn.googlesource.com/dawn.git/+log/b3177d418e3b..2df77f432584

2021-01-26 rharrison@chromium.org Removing old WebGPU SPIR-V behaviour test
2021-01-26 dsinclair@chromium.org Fixup texture type name.
2021-01-26 senorblanco@chromium.org Skip StorageTextureTests.WriteonlyStorageTextureIn*Shader on OpenGL ES.
2021-01-26 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from be610ba987f5 to a6b9a8eb2fdc (17 revisions)
2021-01-26 senorblanco@chromium.org Skip SamplerFilterAnisotropicTest.SlantedPlaneMipmap on OpenGL ES.
2021-01-26 senorblanco@chromium.org Skip failing MultipleWriteThenMultipleReadTests.OneBuffer on OpenGL ES.
2021-01-26 senorblanco@chromium.org Skip failing TextureFormat tests on SwANGLE.
2021-01-26 senorblanco@chromium.org Fix glFramebufferTextureLayer warnings generated by ANGLE
2021-01-26 senorblanco@chromium.org Skip failing multisampling tests on SwANGLE.
2021-01-26 bclayton@google.com Migrate from tint::ast::Module to tint::Program

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from be610ba987f5 to a6b9a8eb2fdc

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 sarahmashay@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: sarahmashay@google.com
Change-Id: I214199b8e24c43f677602961e9eb3d2416438840
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360141
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-27 05:16:48 +00:00
skia-autoroll
b3c7d0362b Roll Chromium from ef43b16d47e3 to cf3471ec8c7c (436 revisions)
ef43b16d47..cf3471ec8c

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 nifong@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: nifong@google.com
Change-Id: I776b9bd9b3b10594a2f50ba3b4f639804946bdec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360138
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-27 05:13:48 +00:00
John Stiles
4d6310ab20 Support half4 return values from main() in the SPIR-V code generator.
This creates a helper function, _entrypoint, which invokes main() and
assigns its result into sk_FragColor. We also make sure to prevent
sk_FragColor from being dead-stripped from the code during IR
generation.

At present this is useful for allowing our SkSL test shaders to compile.

Change-Id: I2d7fab0e1959a77778ffdb18ca569e869bcaeece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358525
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-27 02:46:03 +00:00
John Stiles
b41d5bb3a7 Add helper uniforms to Runtime Effect tests.
This lets us use descriptive names like `colorRed` and `colorGreen`
instead of `half4(1,0,0,1)` and `half4(0,1,0,1)`. It also lets us use
actual unknown values instead of synthesizing sorta-kinda-unknowns by
calling sqrt.

Change-Id: I61481c33b7ff42182955777b05cfa5fcc13e0efc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359567
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-27 00:53:46 +00:00
John Stiles
d8fc95dc02 Add default uniform set value to SkSL Program settings.
This allows uniforms to be specified without an explicit `layout(set=N)`
modifier. They will assume a default set value instead.

This turns out to fix a handful of tests in Metal/SPIR-V which were
written with GLSL in mind, or adapted from real generated GLSL code, and
didn't have layout information specified on their uniforms. It will also
make it easier to write SkSL tests using uniforms that can compile
either as a runtime effect or as plain Metal/SPIR-V code.

Change-Id: Id79ec06f278b913a45c09c2e6211195dc98b42c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359838
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-27 00:52:16 +00:00
Ben Wagner
1604ad6b48 Clean up ParagraphCache::abandon.
This makes ParagraphCache::abandon just forward to
ParagraphCache::reset. This removes re-entering fParagraphMutex and an
empty loop.

Change-Id: I1f31474ec4e381c71e6eba062ba572a1c29d1a6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359839
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-01-27 00:41:56 +00:00
Ben Wagner
e24127ce05 Directly measure CoreText weight mapping.
CoreText reports weight on a [-1.0, 1.0] scale with 0 being 'regular'.
Unfortunately the mapping from the [1, 1000] scale more commonly used
is not uniform and also varies between system fonts and fonts created
from data. For system fonts the NSFontWeight values will be used if
available, but there is no corresponding API for fonts created from
data. Previously the values for fonts created from data were hardcoded,
but the values have changed again recently. Directly read these values
by varying the weight in the font data, creating a CTFontDescriptor from
this data, and then using the value reported by CoreText.

Bug: skia:11176
Change-Id: I071e2ff7ac3f676c8395b13aa82dde7a97fdf2ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358535
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-01-27 00:15:16 +00:00
Florin Malita
131decbf41 [svg] Fix node factories order
TBR=
Change-Id: I622581de30dd290b858fe99ece3ae85fd15a0c2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359918
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-01-26 23:14:23 +00:00
Mike Reed
b64c26d56b Don't copy when we can copy+and+transform at once
Change-Id: Ic4f77d91cc8c4f9d475c632932855f71505b9ff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359837
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-26 23:01:21 +00:00
John Stiles
6742d13cbe Add tests for int overloads of various intrinsics.
Checking each variation can occasionally shake out extra bugs--for
instance, the mix intrinsic in SPIR-V breaks when adding coverage for
its various overloads here. (See skia:11222; this will be addressed in
a separate CL.)

Change-Id: I2c3ca7523e59d4c6cce25a70e081a558afedfb87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359758
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-01-26 22:49:20 +00:00
Ben Wagner
056bd0dd98 Fix leak of X window title.
Running 'viewer' on Linux with an ASan build produced LSan reports about
leaking textproperty.value. The documentation for
XStringListToTextProperty states that it is up to the user to free the
XTextProperty::value returned with XFree.

In addition, check the return value of XStringListToTextProperty for
failure.

Change-Id: I0db45d3d94f7c8126049c6a343b1aa121f9a7523
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357597
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-01-26 21:44:38 +00:00
Tyler Denniston
32b3089618 [svg] Add light source classes and lighting-color pres attr
https://www.w3.org/TR/SVG11/filters.html#LightSourceDefinitions

The three classes represent light source elements that will eventually
be used for feSpecularLighting and feDiffuseLighting. Currently they are
unused.

Also added the (currently unused) lighting-color presentation attribute.

Bug: skia:10841
Change-Id: Ic7824671662b8cd88cf627affc54173d5e881b7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359557
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-01-26 21:36:34 +00:00
John Stiles
578f1acbe8 Revert "Add SkSL for-loop control flow test to dm."
This reverts commit a0c266283a.

Reason for revert: failing on Mac Intel

Original change's description:
> Add SkSL for-loop control flow test to dm.
>
> While loops and do-while loops remain untested in dm, as they are not
> supported in ES2 (and therefore not available in Runtime Effects).
>
> Change-Id: I2f1bfccccd571cc4ced096bc18ebbb9ecc9f9b4a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359556
> 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>

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

Change-Id: I45335d16a695644eaeb8a535298c0efcc616c1ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359840
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-26 21:35:45 +00:00
John Stiles
3744bd6b8d Fix GLSL/Metal codegen of unbraced empty blocks.
Previously, we would emit nothing at all, but that is not actually
valid if the Block is a child statement (e.g. the body of a loop).
Now we emit braces for empty blocks, even if the block was unscoped.

Change-Id: I456a8d7d306a3e59d85e39f80b9f15fe3347ea19
Bug: skia:11218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359562
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-01-26 21:18:36 +00:00
Brian Salomon
be1084b5d9 Reland "Write pixels goes through GrRenderTask system."
This reverts commit 1eea1ea8c1.

Reason for revert: fixed implicit copy cons

Original change's description:
> Revert "Write pixels goes through GrRenderTask system."
>
> This reverts commit 27efe6cb1e.
>
> Reason for revert: wasm compile
>
> Original change's description:
> > Write pixels goes through GrRenderTask system.
> >
> > The specific motivation is to remove some uses of GrResourceProvider
> > making textures with data in lazy callbacks. But it's a general
> > improvement that could allow use cases like writePixels in DDL
> > recordings.
> >
> > Bug: skia:11204
> >
> > Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,adlai@google.com
>
> Change-Id: I116caf1e4dd9015270b9d4f810bd26e0e30a6497
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11204
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359559
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

# Not skipping CQ checks because this is a reland.

Bug: skia:11204
Change-Id: I7d8f92415995f03301ffb147500d972e6bd17640
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359561
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-26 21:18:35 +00:00
Chris Dalton
70a0d2cc4f Rewrite GrPathTessellateOp without inner fan triangulation
Adds a new op, GrPathStencilFillOp, that is a greatly simplified
rewrite of GrPathTessellateOp without inner fan triangulation. This op
is a very simple Redbook method built on tessellation. For now we
leave GrPathTessellateOp as-is. The next CL will change it to do inner
fan triangulation exclusively.

Bug: skia:10419
Change-Id: Ia67f4ab038a541e6454f5bf304ecd3c1d8805427
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357138
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-01-26 21:04:54 +00:00
Robert Phillips
15f6d744a6 Remove handleDirtyContext calls from backends for which they don't make sense
and add a default implementation of onResetContext (which only the GL backend implements)

Change-Id: I20bb4cd2a60dba3200fc8ef4c9e4fd6a9f54ceef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359497
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-01-26 21:00:55 +00:00
Ethan Nicholas
68c77d4ae7 Added SkSL DSL swizzles
Change-Id: I4410bcb7af35420e38ba8d6f525a2e7df2542297
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358957
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-26 20:54:19 +00:00
Joe Gregorio
a6bff0c344 Fix CheckGeneratedFiles bot.
It turns out previous builds may leave root-owned
files in the work cache, and sometimes those
contain '.fp' files, which touch will fail on, since
the recipe doesn't run as root.

Solution is to restrict 'touch fp files' to the src/ subdirectory.

Change-Id: Ic0d70a67548ec66dbd1d3905fd1cacfadde181f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359496
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2021-01-26 20:01:11 +00:00
John Stiles
a0c266283a Add SkSL for-loop control flow test to dm.
While loops and do-while loops remain untested in dm, as they are not
supported in ES2 (and therefore not available in Runtime Effects).

Change-Id: I2f1bfccccd571cc4ced096bc18ebbb9ecc9f9b4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359556
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-01-26 19:55:55 +00:00
Ethan Nicholas
30e93d51c9 Added builtin SkSL DSL functions
Change-Id: I4e771083e90f3c60b61f7ce7c8e6697e7bf7c7e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358518
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-26 19:18:30 +00:00
John Stiles
0ecfdea199 Add SkSL unit test for unbraced blocks that optimize away.
In most cases, this works properly and a `;` is emitted, but in one
particular case (int x, y;) we get nothing.

Change-Id: If88d92502f6a533284dd4e0f78daedaf1481ff3d
Bug: skia:11218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359558
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-01-26 19:06:41 +00:00
Brian Salomon
1eea1ea8c1 Revert "Write pixels goes through GrRenderTask system."
This reverts commit 27efe6cb1e.

Reason for revert: wasm compile

Original change's description:
> Write pixels goes through GrRenderTask system.
>
> The specific motivation is to remove some uses of GrResourceProvider
> making textures with data in lazy callbacks. But it's a general
> improvement that could allow use cases like writePixels in DDL
> recordings.
>
> Bug: skia:11204
>
> Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I116caf1e4dd9015270b9d4f810bd26e0e30a6497
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359559
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-26 18:18:22 +00:00
Robert Phillips
489e5b9cb2 Add handleDirtyContext calls to GrGLGpu::onUpdate*BackendTexture calls
Bug: 1170246
Change-Id: I34c24570ee0b5d822580359e4a7884cace418863
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359361
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-01-26 18:00:19 +00:00
Brian Salomon
27efe6cb1e Write pixels goes through GrRenderTask system.
The specific motivation is to remove some uses of GrResourceProvider
making textures with data in lazy callbacks. But it's a general
improvement that could allow use cases like writePixels in DDL
recordings.

Bug: skia:11204

Change-Id: Ic55c3f75976a1d3a7d93981e21be75a3053ef069
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356845
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-26 17:42:42 +00:00
Ben Wagner
d7ec61519c Add documentation on blitting glyphs.
Document why mask gamma, optical sizing, and contrast hacks are used and
where. In addition to documentation this also justifies where contrast
settings should be placed in the API.

Change-Id: I8c67d800a95e62360a88c815d3224e0c05ed65c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356305
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-01-26 17:18:04 +00:00
John Stiles
e3a91cf31c Fix fuzzer-discovered error with variable scoping.
In GLSL and SkSL, control statements don't require explicit braces
around single-statement children. That is, the `match = true` child
statement here doesn't need to be braced.

    if (condition) match = true;

Because there are no braces, we never create a Block or a dedicated
SymbolTable here.  This is normally not a problem, but the fuzzer
discovered that it can dump things into the symbol table inside a child
statement:

    if (condition) int newSymbol;

This becomes problematic because the symbol name now outlives its block.
This means `newSymbol` can be referred to later, which should be illegal
(and can cause the optimizer to blow up since the structure is bogus).

There doesn't seem to be any reason to allow this code to compile; the
user can add an explicit scope here to make it reasonable, and it's
(almost) meaningless to declare a symbol that's instantly going to fall
out of scope. This code is now rejected with an error message.

Change-Id: I44778e5b59652d345b10eecd4c88efbf7d86a5e0
Bug: oss-fuzz:29849
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358960
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-26 17:08:59 +00:00