Commit Graph

53024 Commits

Author SHA1 Message Date
John Stiles
9f079f7c0d Add Type::isEnum helper method.
Change-Id: I62755dfcf5c8bb5bd7e0cc742e675aacf4afbb78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354658
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-15 19:52:56 +00:00
Tyler Denniston
a25e1a38dd [svg] Implement feBlend filter
Note we are still not passing filters-blend-01-b because we don't yet
support feImage.

Bug: skia:10841
Change-Id: Ibca52c0e8e8d45e73473dea3b0252d6b81eaa584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354657
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-15 19:45:56 +00:00
Brian Osman
bf061a32ef Fix an (int + float) error in "cube" particle demo
Also fix a crash if you try to play an effect that has never compiled
correctly. (After the first compile, the arrays were always large enough
to set "dt" -- this code is all going to be reworked soon for SkVM, but
I hit this while diagnosing the type coercion error).

Change-Id: I5bfab539c7304bde2da36b0b0604991d5b5b303a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354660
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-15 19:15:16 +00:00
Mike Klein
7de307a64f pull arm64 binary on arm64 Mac/Linux
Really I just want the Mac binary, but Linux kind of comes along for
free.  (It'd work for Windows too if there were arm64 GN binaries.)

Python2 calls Linux 'linux2', while Python3 calls it 'linux'.

Change-Id: I8ef3d482a956acfe6b1eec3d7b5429b25c528c54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354556
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-15 19:00:46 +00:00
Tyler Denniston
a22d21e447 [svg] Fix incorrect optimization for opacity layer
When both filter and opacity attributes are set on a leaf node, the
opacity must be applied as a separate layer so that the results of the
filter are modified by the opacity. Previously in this circumstance we
were incorrectly applying the opacity to the paints only (without a
layer).

To illustrate:

<svg viewBox="0 0 1000 500" version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <filter id="Green" x="0%" y="0%" width="100%" height="100%">
      <feFlood flood-color="lime" flood-opacity="1" />
    </filter>
  </defs>
  <rect x="30" y="20" width="400" height="100" fill="red" opacity="0.1"
        filter="url(#Green)"/>
  <g filter="url(#Green)">
    <rect x="30" y="200" width="400" height="100" fill="red" opacity="0.1"/>
  </g>
</svg>

The two rects should render differently. In the <g> case, the filter
output (opaque green) overrides the translucent red pixels of the rect.
In the <rect> case, the filter output overrides the translucent red
pixels with opaque green, but then is modified by the opacity on the
<rect>.

Relevant W3C test is filters-blend-01-b (and possibly others).

Change-Id: I165eed36c546f1f99457865cee58ee2b3bffe6f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354879
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-15 18:55:16 +00:00
Chris Dalton
97c476ecb7 Disable the MSAA atlas mode for CCPR
We have a long term path rendering plan that uses dynamic MSAA instead.
This CL is a test to see if we can drop support for CCPR now.

Change-Id: I1bff3ca3143a6b453b65a7932a1805c195922805
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-01-15 18:43:56 +00:00
Mike Reed
2ac6ce8e6e Simplify common case for recttorect
Change-Id: I70e295a677b8cac3d578e3cd57472c833af03877
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354336
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-15 18:37:46 +00:00
John Stiles
e6c67c5bc4 Restrict the creation of built-in types to BuiltinTypes class.
This CL limits the availability of functions like "MakeLiteralType" and
"MakeScalarType" to the BuiltinTypes class. This allows us to know,
definitively, that whenever we encounter these types, they are part of
the BuiltinTypes class and available anywhere in the program without
needing to be cloned.

The remaining MakeXxxxxxTypes in SkSL::Type are constructed dynamically
and injected into child symbol tables during parse/IR generation. These
types must be treated with special care when being moved or cloned:
- Arrays (MakeArrayType)
- Structs (MakeStructType)
- Enums (MakeEnumType)

Change-Id: I5490d6739c2a5ffdd54195f5a0b9b5be05d07953
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354878
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-15 17:49:26 +00:00
Florin Malita
b2aa04d184 [svg] Minor cleanup
Replace a bunch of no-op stubs with a default template impl.

Change-Id: I37b24361dcf3d7c247a12a7c20a9f3a967b6f9e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354877
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-15 17:32:16 +00:00
John Stiles
ac01aca0fe Migrate BuiltinTypes to a separate file from Context.
No code or functionality changes.

Change-Id: I24317767570ae9ebbfea56f873d98709fb22d8b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354876
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-15 17:23:16 +00:00
Mike Reed
5ec22387ff Simplify common case of linear filtering with no mips
Change-Id: I08b4a7bc088705b93a0aa680f6733d09c7ad23dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354221
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-15 16:47:16 +00:00
Mike Klein
4f4c064d5b roll gn to latest
Nice periodically, and this version also has a Mac arm64 binary.

Refine a few visibility rules from ":*" (any target in this file)
to "./*" (any target in any .gn file anywhere under this directory).

Use frameworks over libs where now required.

Change-Id: Ic19e1533e2810d18ae4684645d8555b422320b7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354536
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-15 15:34:00 +00:00
Florin Malita
73d57bf4e8 [svg] Add support for mask color-interpolation
https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperty

Bug: skia:10842
Change-Id: I3e97577ee257c9afe64d924c768c85badbfab07d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354220
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-15 15:19:40 +00:00
John Stiles
6a1a98c313 Fix for fuzzer-discovered use-after-free.
The inliner discovered that when a binary expression is inlined, its
type is not cloned into the destination's SymbolTable. This meant that
when the inlined-from function was later dead-stripped, the type pointer
would become dangling. Did a quick pass over inlineExpression and
inlineStatement and ensured that types are always copied.

Also found that `copy_if_needed` was making a copy of eligible types
each time one was encountered, instead of making one copy and reusing
it. This is fixed as well.

Change-Id: Iee3259ab038dfb04034bf0110af1909ccffec3de
Bug: oss-fuzz:29444
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354219
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-15 15:11:00 +00:00
Tyler Denniston
5878ecef2f [svg] Implement feOffset filter
https://www.w3.org/TR/SVG11/filters.html#feOffsetElement

We should now be passing filters-felem-02-f W3C test.

Bug: skia:10841
Change-Id: I642cf3c8816b83bdf88066c55103e432ae9c9d5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354216
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-01-15 15:04:30 +00:00
Brian Salomon
2ba80af000 Test all YUVA image factories with different encoded origins.
Now that SkImage_GpuYUVA stores a GrYUVATextureProxies it supports
encoded origins.

Modify wacky_yuv_format GMs to use different origins and remove
restriction in SkImage::MakeFromYUVAPixmaps.

Bug: skia:10632
Change-Id: I02477d592b7baba164944d629eeac48223698c10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353623
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-01-15 14:55:10 +00:00
John Stiles
4ed174526b Honor fIsScope when emitting a Block's description.
Change-Id: I93d580e67cb66d388bd66b280ff229cb79e5b154
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354218
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-15 14:43:40 +00:00
Florin Malita
cf1e2f3d9b [svg] Fix mask edge artifacts
Per spec, the explicit <mask> bounds [x,y,w,h] are used to also clip
the content (the actual mask geometry may extend beyond these bounds).

This clip is currently scoped such that it applies both to the mask
layer and the content layer.  When the clip is not pixel-aligned,
we're anti-aliasing both layers' edges -- which darkens the composition
result (producing dark hairlines around the mask).

Push the clip down such that it applies to content only.

Change-Id: I32169e2b6dc9685e50a51c6b22cfaaac1a897239
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354217
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-15 14:31:50 +00:00
Greg Daniel
70ea0d97c1 Fix caps checks for vulkan indirect and instanced draws.
Change-Id: I74314d233582618b526ac0db14da5b41553ddbff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353096
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-01-15 14:11:10 +00:00
skia-autoroll
7f81cb6901 Roll SwiftShader from 5255c465bbba to aedd133cd85f (1 revision)
https://swiftshader.googlesource.com/SwiftShader.git/+log/5255c465bbba..aedd133cd85f

2021-01-14 amaiorano@google.com VulkanBenchmarks: fix memory leaks

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 ethannicholas@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: ethannicholas@google.com
Change-Id: Ib58ece5c5c409ad0a384611d1a3a3c95e1cb2ce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354377
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-15 05:02:42 +00:00
skia-autoroll
b1847d2c87 Roll ANGLE from 198dc345383e to 50c82f42e33f (10 revisions)
198dc34538..50c82f42e3

2021-01-14 geofflang@google.com Don't index into SystemInfo gpus if it's empty.
2021-01-14 timvp@google.com Tests: Add Magic Tile 3 trace
2021-01-14 syoussefi@chromium.org Vulkan: Move xfb buffer decl to translator in emulation path
2021-01-14 timvp@google.com Capture/Replay: Only get source for linked programs
2021-01-14 jmadill@chromium.org Revert "Vulkan: Prefer host cached memory for Buffers"
2021-01-14 natsu@google.com Update roll AOSP scripts to reflect vulkan-deps subdirectory
2021-01-14 timvp@google.com Fix call to getImageFormatFeatureBits() in SurfaceVk.cpp
2021-01-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll SwiftShader from 3549479dc4cc to 5255c465bbba (6 revisions)
2021-01-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 50bcbaad4cbf to 5869a809d551 (4 revisions)
2021-01-14 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 451c64aaec04 to fabc0b0b129a (518 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 ethannicholas@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: ethannicholas@google.com
Test: Test: angle_perftests --gtest_filter=TracePerfTest.Run/*magic_tiles_3*Test: Test: scripts/roll_aosp.sh && m ANGLE
Change-Id: Iabeb174f583296c7f99a2d4d546b41a8aee4f047
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354358
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-15 04:56:32 +00:00
skia-autoroll
1895425ffc Roll Chromium from 2930e73f7b89 to e330bc98d133 (559 revisions)
2930e73f7b..e330bc98d1

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 ethannicholas@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: ethannicholas@google.com
Change-Id: I653f407cc97cbde82bb924d68981d2fb9f321d30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354376
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-15 04:45:23 +00:00
skia-autoroll
819622a2d0 Roll Dawn from 6f833b7f78c9 to 5a6fda1a6fcc (6 revisions)
https://dawn.googlesource.com/dawn.git/+log/6f833b7f78c9..5a6fda1a6fcc

2021-01-14 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from 0f4638b9e499 to 0a68b365ebff (4 revisions)
2021-01-14 bclayton@google.com Convert StorageTextureTests to WGSL
2021-01-14 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from a7b52e33d5e8 to 0f4638b9e499 (2 revisions)
2021-01-14 dsinclair@chromium.org Update texture storage syntax.
2021-01-14 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from 904c5b9621da to a7b52e33d5e8 (3 revisions)
2021-01-14 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from 313ae9e87f37 to 904c5b9621da (2 revisions)

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from 313ae9e87f37 to 0a68b365ebff

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 dsinclair@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: dsinclair@google.com
Change-Id: I88ca7601de1e51c460f70d75a6eb187706e43499
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354357
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-01-15 04:45:22 +00:00
Chris Dalton
68b8bd5ba7 Add GrTriangulator::TriangulateInnerPolygons
Unlike TriangulateSimpleInnerPolygons, this new method *always*
succeeds. It works by introducing a concept of "breadcrumb" triangles.
The breadcrumb triangles serve as a glue that erases T-junctions
between the outer curves and inner polygon triangulation.

This CL also introduces a test to verify the breadcrumb triangles
actually guarantee to eliminate T-junctions. It works by cancelling
out shared edges in the combined breadcrumb triangles and inner
triangulation, and then verifying that the resulting edge list is
bit-for-bit identical to the outer edges from the original polygon(s).

Bug: skia:10419
Change-Id: Iea8ee2ca3701697246309dceb90e63279aabdfe4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353536
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-01-14 23:22:52 +00:00
Brian Osman
4cf85073e6 Enforce (valid) array sizes in many more places
Unsized arrays are now allowed in exactly one place: On the declaration
of an interface block. This satisfies the one existing use-case, which
is the gl_in (sk_in) declaration for geometry shaders. There is no other
useful scenario, and most of our backends don't support them anyway.

Several spots were using less strict checks when attaching sizes to
arrays, allowing for zero or negative-sized arrays, so those are all
fixed now.

The existing tests that initialize arrays are still a problem, because
Metal doesn't support that (neither does GLES2). Also, ArrayConstructors
has gone from generating an error in the Vulkan backend, to invalid
SPIR-V.

Bug: skia:11013
Bug: skia:11127
Change-Id: Ib08dfe9aeec96bf605661665d6f166419d27e8bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353817
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-14 22:14:59 +00:00
Tyler Denniston
94730febf9 [svg] Handle std input case for filter subregion calculation
From the spec [1], if any inputs of a filter are one of the standard
inputs (SourceGraphic, FillPaint, etc. -- anything except another
filter), then the default filter primitive subregion is equal to the
filter effect region.

[1] https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion

Bug: skia:10841
Change-Id: I70632e5119861c46c9e48af944d2c7cfdfc3c351
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354119
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-14 22:04:48 +00:00
Tyler Denniston
3df6c20a05 [svg] Fix <use> bounds calculation
Previously we were using fX and fY as the top left of the returned
bounds. We need instead to offset the referenced node's bounds by fX,
fY.

While I was here I updated the attribute parsing to the new form and
changed the type of fHref from SkSVGString to SkSVGIRI.

Change-Id: I4bfb91bca62e47f5dabfbb4aad48cbb301a7ea36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354118
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-14 21:35:58 +00:00
Mike Klein
a738fb5d58 restore select() in bool->int
Change-Id: Ia3ac338bef376aa1649569b9ebd3f7feb23ffd52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353936
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-14 21:09:58 +00:00
Julia Lavrova
68afd4802b Fixed TextBehavior for one line
3 different cases cases: text, empty line inside text, empty paragraph

Bug: skia:11167
Change-Id: I139a3974511d0984dddd86b6fbf72be3983f8394
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353579
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-01-14 20:56:49 +00:00
Florin Malita
3c10618d37 [svg] Add clipPathUnits support
https://www.w3.org/TR/SVG11/masking.html#ClipPathElementClipPathUnitsAttribute

Bug: skia:10842
Change-Id: Idf3b5b6da08dfaee165f0bbb549427f298a40cec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353713
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-14 20:18:15 +00:00
Mike Klein
9c03ffbedc get rid of I32a/F32a
These were meant to make it easier to pass constants to skvm::Builder,
but I think they've caused more problems than they solve.

This change is pretty much just mechanical, expanding all the existing
combinations of F32/F32a into (more) combinations of F32/float, and same
for I32/I32a/int.  In general for an N-ary function we'll end up with
2^N-1 variants (1->1, 2->3, 3->7), requiring at least one I32/F32.

As before, some functions have fewer variants where using a constant
doesn't actually make sense (the condition for select, the denominator
for divide, etc).

Change-Id: Ic7bbd82e7f1452d604479cdde0b3b6a60ffe8b8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353839
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-14 19:53:25 +00:00
John Stiles
774f45bc07 Enforce strict type coercion between int and uint.
This better matches GLSL's type coercion behavior.

Change-Id: I73fcfd8a9e57fd4cdb1692074d73ebd8fb788ac2
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353712
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-14 19:38:55 +00:00
John Stiles
ff4f76352d Update int/float mismatch test to include uints.
Change-Id: I47d02ca63ce64d9cfb3de0888d84b2b8a822f2b5
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353710
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-14 19:38:30 +00:00
Florin Malita
4ea46b71ac [svg] Fix null text context crash
The input may contain invalid text constructs lacking a root <text> node
e.g.  <svg><tspan>foo</tspan></svg>

Since we don't perform content model validation at the moment and text
contexts are only instantiated for root nodes, we must guard against
this case at render time.

Bug: oss-fuzz:29558
Change-Id: I7e39c1c4048900ce5becb3549802dc66bb1d242b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353711
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-14 19:03:25 +00:00
John Stiles
4a2d651243 Enforce stricter type coercion rules in SkSL.
Literals are still flexible; we still allow `1` to coerce to float.
However, we no longer accept code like `int x = sqrt(2);` or
`int x = 0; float y = x;` without an explicit cast.

Change-Id: Ieb294a4877447e2336252f876e8bc489d1e4a59a
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353417
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-14 18:59:45 +00:00
Florin Malita
491911003e [svg] Mask support
https://www.w3.org/TR/SVG11/masking.html#Masking

Implement masking based on a classic two-layers + kSrcIn blending
approach.

An additional layer is used to filter the mask content (but could be
avoided in a pinch -- see inline comments).

Also consolidate the objectBoundingBox rect resolution logic as
SkSVGRenderContext::resolveOBBRect().

Bug: skia:10842
Change-Id: I273318e97cc28d599d1ecf01706b6117eecb62d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353631
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-14 18:50:46 +00:00
John Stiles
a60fb178b5 Add SPIR-V support for casts to boolean scalar.
Change-Id: Icd8982d604881effee31cc1392e2717cb112d06d
Bug: skia:11172
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353629
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-14 18:35:25 +00:00
Brian Osman
890b2b406a Disallow switch statements in runtime effects
Bug: skia:10680
Change-Id: Ic77f7355866363ef476a93d8da180cf53207fa6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353707
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-14 17:45:16 +00:00
Brian Osman
01f322cce4 Move all runtime effect error tests to runtime_errors
Also renamed Discard to IllegalStatements, and added testing of while
and do loops.

Change-Id: Ibacf69131267a0436808e2e022ad126704af16ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353706
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-14 17:40:54 +00:00
Mike Klein
aebcf73404 always init function fReturnValue
It's not sound to pass undefined (skvm::NA) values into select(),
but this is working today because the F32a argument is 'fixing' it.

The first time through this snippet updating fReturn value,

    int i = 0;
    for (skvm::Val& slot : currentFunction().fReturnValue) {
        slot = select(returnsHere, f32(val[i]), f32(slot)).id;
        i++;
    }

the call to f32(slot) creates an F32{builder, NA}.  We pass that to
select() and that argument's F32a(F32) constructor, resulting in
F32a{builder, NA, 0.0f}.  Then when we need that as an F32, we resolve
it as splat(0.0f) because the F32a's id field is NA.

In short, best to remove F32a. :)

Added some SkASSERTs that would have caught this.

Change-Id: I67324cf20ad39ca555e69b9c407f379d14046043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353838
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-14 17:22:04 +00:00
Mike Klein
a517cfc3f4 slightly tweak bool->int
I'm looking to phase out I32a/F32a, and rewriting this expression to
avoid select() makes it easier, making these types unused except in
SkVM.{h,cpp}.

There's no particular reason beyond making that refactor easier to do
this: SkVM can convert select(cond, splat(1), splat(0)) into cond & 1
itself, and once I'm done with removing I32a/F32a, if we prefer select
we should be able to rewrite this back as

    dst[i] = skvm::select(i32(src[i]), 1, 0);

Change-Id: I562a112e54fdc2578802db02f6754c64a12798cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353837
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-14 17:14:33 +00:00
John Stiles
e7e68efd9f Add unit test for int/float mismatch error detection.
The "disallowed" tests are largely allowed in the current code, but all
fail properly in the followup CL.

Change-Id: I8e03570165480b60db9701ac1a782e1124ded56b
Bug: skia:11164
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353617
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-14 16:56:53 +00:00
John Stiles
48c2884c70 Add SPIR-V support for boolean vector typecasts.
Previously, `writeVectorConstructor` did not consider boolean types at
all when converting scalars to a different type. Now, this code reuses
the existing logic from `castScalarTo(Float|SignedInt|UnsignedInt)`
which supports Booleans. Added `castScalarToBoolean` to cover going in
the opposite direction.

Change-Id: I5479ab181b9b721db7fbff0bdc01718ce8f9f9b9
Bug: skia:11171
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353625
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-14 16:50:03 +00:00
Mike Klein
b296d926b0 macro hygiene in SkRP_opts.h
Change-Id: I4eda7ffb010f236b39750da6134fb8db6fc26380
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353836
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-01-14 16:17:03 +00:00
John Stiles
e318355a67 Add unit test for scalar conversion constructors.
This revealed a gap in our SPIR-V scalar constructor support;
typecasting a number to bool would lead to an ABORT.

Change-Id: Idac6d7ba34adfd214ed3cad8139e22d7170456f0
Bug: skia:11172
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353628
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-14 15:53:03 +00:00
Brian Osman
6c7910e680 Use isNumber() rather than isFloat() || isInteger()
Change-Id: Ibb9dca7b8e04485924f6a7d8dd4b17df90d5f320
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353779
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-01-14 15:48:23 +00:00
Tyler Denniston
8f78d55284 Reland "[svg] Perform colorspace conversions for filter effects"
This reverts commit 36acb7b10c.

Reason for revert: artifacts in 1010102 are expected

Original change's description:
> Revert "[svg] Perform colorspace conversions for filter effects"
>
> This reverts commit a0880eda22.
>
> Reason for revert: visual artifacts in 10-bit color depth (10-10-10-2)
>
> Original change's description:
> > [svg] Perform colorspace conversions for filter effects
> >
> > A filter effect can optionally be specified to operate in either sRGB
> > or linearRGB, according to the SVG spec:
> >
> > https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties
> >
> > This CL adds any necessary conversion steps (SkColorFilters) while
> > constructing the filter DAG. The default filter effect color space is
> > linearRGB. We should now be passing the filters-gauss-* W3C tests.
> >
> > Specific changes:
> > - Tag filter effect results with their colorspace when storing them in
> >   the filter context map
> > - Add an SkColorFolor conversion step as necessary when resolving filter
> >   effect inputs
> >
> > Bug: skia:10841
> > Change-Id: Ide12698ea64c4d40f09df93a60718788809086fa
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353078
> > Commit-Queue: Tyler Denniston <tdenniston@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
>
> TBR=fmalita@chromium.org,tdenniston@google.com
>
> Change-Id: Id4a33c49643039cfb2d2867a1513e8ee1d7b181a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10841
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353630
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

# Not skipping CQ checks because this is a reland.

Bug: skia:10841
Change-Id: Id6d9e01d9b18ebfb6f9a6cb74518ad5cd73ea00a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353777
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-14 15:02:23 +00:00
Heather Miller
bf562de155 Update Skia milestone to 90
Change-Id: Ib4ef9057cb623b2d8ea57c40fb6f67ac731471f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353778
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2021-01-14 14:50:08 +00:00
Derek Sollenberger
9e1cedda63 Add generic uniform setter function to SkRuntimeShaderBuilder
Change-Id: Idab539a4b39fe5ceab54948c99c0dcd6d19fd345
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352743
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-01-14 14:38:18 +00:00
Brian Osman
3d81fdcbd2 Add unit tests for for-loop unrolling
Change-Id: I350a6768ac124362b0d3e0f17e7a026265acf804
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353627
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-01-14 14:38:16 +00:00