Commit Graph

10400 Commits

Author SHA1 Message Date
John Stiles
28991c1a34 Reland "Verify that tests in errors/ actually generate the expected errors."
This reverts commit 43539c22a2.

Reason for revert: UB fixed at http://review.skia.org/505678

Original change's description:
> Revert "Verify that tests in errors/ actually generate the expected errors."
>
> This reverts commit 8d646c127a.
>
> Reason for revert: triggering UBSAN
> http://screen/887FeQtZWs2A6oo
>
> Original change's description:
> > Verify that tests in errors/ actually generate the expected errors.
> >
> > Error expectations are embedded in the source with a special *%%*
> > marker, like this:
> >
> >      /*%%*
> >      expected 'foo', but found 'bar'
> >      'baz' is not a valid identifier
> >      *%%*/
> >
> > This unit test compiles every effect in errors/ and verifies that it
> > makes an error. It also verifies that the errors returned include the
> > expectations from the *%%* marker section, in the listed order, if any
> > expectations have been listed. (Error expectations are not meant to be
> > exhaustive; additional errors are allowed.)
> >
> > In this CL, I've manually attached error expectations to the first few
> > error tests. A followup CL will (mechanically) add expectations to every
> > error test, based on their current error reports.
> >
> > Change-Id: I4add30fef6419c4d3f8d2a221c5aeb53eee35ae7
> > Bug: skia:12665
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505399
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
>
> Bug: skia:12665
> Change-Id: I3bcdbe9fc1abab13656d6462b73f6439967fd96f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505642
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12665
Change-Id: I49e23869f4ef383a0b076006e319e0a6d7191cad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505643
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-08 18:20:04 +00:00
John Stiles
ada59c148e Fix UB when reporting out-of-range values.
It's undefined behavior to cast a double to an int64 if the double is
out of range. Our SkSL error tests managed to trigger UBSAN on the tree,
pinpointing the issue (which we had already written up a bug for).

Change-Id: Ia06896732223ff310f2c175efcbeb96ba5786fa8
Bug: skia:12863
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505678
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-02-08 17:30:09 +00:00
Kevin Lubick
8e7c2ae4f7 Remove old test main (skia_test.cpp)
The only use was an executable that only compiled in the pathops tests.

The pathops tests *are* ran in DM and this executable
is not run anywhere.

Change-Id: Ia2d5d7247c25cbad1941b9ee124615c008ea76b7
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505640
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-08 17:06:47 +00:00
Kevin Lubick
5cb6b4464b Remove SkVptr
It appears unused in Skia and Chrome.

Change-Id: I2058374dfda853312087e7e9c50845d2c805b0d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505639
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-08 17:00:15 +00:00
Kevin Lubick
89ce347cca Remove SkFixed15
It appears unused in Skia and Chrome.

Change-Id: I5d21f6635f96eca58c5efc9eaabe649a7e81db04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505638
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-08 16:57:24 +00:00
Robert Phillips
3bdff6b354 [graphite] Add a means of accumulating multiple code snippets
Namely, SkShaderInfo. This doesn't do anything interesting yet. The ShaderCodeDictionary stores the snippets and then a PaintParamsKey can be traversed to collect the snippets in an SkShaderInfo. Gluing them together will be next-ish.

Bug: skia:12701
Change-Id: Icb4b41716592fc119778ae08f84565da9acaf202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503822
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 16:46:50 +00:00
John Stiles
43539c22a2 Revert "Verify that tests in errors/ actually generate the expected errors."
This reverts commit 8d646c127a.

Reason for revert: triggering UBSAN
http://screen/887FeQtZWs2A6oo

Original change's description:
> Verify that tests in errors/ actually generate the expected errors.
>
> Error expectations are embedded in the source with a special *%%*
> marker, like this:
>
>      /*%%*
>      expected 'foo', but found 'bar'
>      'baz' is not a valid identifier
>      *%%*/
>
> This unit test compiles every effect in errors/ and verifies that it
> makes an error. It also verifies that the errors returned include the
> expectations from the *%%* marker section, in the listed order, if any
> expectations have been listed. (Error expectations are not meant to be
> exhaustive; additional errors are allowed.)
>
> In this CL, I've manually attached error expectations to the first few
> error tests. A followup CL will (mechanically) add expectations to every
> error test, based on their current error reports.
>
> Change-Id: I4add30fef6419c4d3f8d2a221c5aeb53eee35ae7
> Bug: skia:12665
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505399
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:12665
Change-Id: I3bcdbe9fc1abab13656d6462b73f6439967fd96f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505642
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-08 16:29:36 +00:00
Robert Phillips
07b639da6f [graphite] Consolidate functionality in the SkShaderCodeDictionary
At some point we'll need to go through the dictionary for user provided SkSL

Bug: skia:12701
Change-Id: I484ae30626dad64f2bce1e0948071380d9f8282e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504596
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 15:54:35 +00:00
John Stiles
8d646c127a Verify that tests in errors/ actually generate the expected errors.
Error expectations are embedded in the source with a special *%%*
marker, like this:

     /*%%*
     expected 'foo', but found 'bar'
     'baz' is not a valid identifier
     *%%*/

This unit test compiles every effect in errors/ and verifies that it
makes an error. It also verifies that the errors returned include the
expectations from the *%%* marker section, in the listed order, if any
expectations have been listed. (Error expectations are not meant to be
exhaustive; additional errors are allowed.)

In this CL, I've manually attached error expectations to the first few
error tests. A followup CL will (mechanically) add expectations to every
error test, based on their current error reports.

Change-Id: I4add30fef6419c4d3f8d2a221c5aeb53eee35ae7
Bug: skia:12665
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505399
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-08 14:38:39 +00:00
John Stiles
f1bb464ee4 Add support for constant folding of matrix-times-matrix.
This code should be easily adaptable to matrix-times-vector as well;
just treat the vector as a 1-row or 1-column matrix. I haven't gotten
around to writing tests for this, though.

Change-Id: If59ae52cd12952b44d3574d54398b2dc66edbcc8
Bug: skia:12819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505221
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>
2022-02-08 14:35:45 +00:00
John Stiles
d0234ba3bf Move backend-specific error tests out of errors/ test folder.
These tests only generate an error in the SPIR-V or GLSL backends. We
will soon enforce that everything in errors/ must actually fail to
compile.

Change-Id: Ic54707eb3bfa19287b4ed52335066fc0fbf19ec1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505397
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-08 14:18:46 +00:00
Ben Wagner
88ddcb8f50 Reland "Pin FcConfig for FCIDirect at creation."
This reverts commit d7f7cc8791.

SkFontConfigInterfaceDirect class methods used the FontConfig library
static global "current" FcConfig (implicitly through the use of
nullptr). This was pinned down once per call to each method which used
it (to avoid the "current" FcConfig from being changed out from under it
while running). However, the use of global state as a matter of course
makes it very difficult to reliably test.

Modify SkFontConfigInterface to optionally take an FcConfig on
contruction. If nullptr is provided it is equivelent to the old behavior
so that existing users are unaffected. SkFontConfigInterface takes
ownership of any passed FcConfig and will release it on destruction.

Bug: skia:12916
Change-Id: I20a3cd9405ad40f28b394c713c0514aaa3b08cd0
Revert-Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504776
Revert-Change-Id: I812547bf27371ab716b7a167d7e975f7538d37fb
Revert-Reason: google3 roll failure due to memory leak
Original-Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504477
Origianl-Change-Id: Ie3573403a95c6bf627ce5ff7f2eb5617c9cd162d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505136
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-02-07 21:32:21 +00:00
Herb Derby
2562144c11 rename fontID to typefaceID
Change-Id: Ifb387d315fdd083190128f448aadb3e54c4e3369
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505198
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-07 20:12:39 +00:00
John Stiles
78eb43826f Fill out matrix-folding ES3 tests.
This mirrors a lot of the existing matrix ES2 tests, but using
non-square matrices. This is still important because a lot of subtle
bugs can slip through the cracks when rows == columns.

Change-Id: I626c4c2b176c8280da64513d16f59e76e726cbe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505218
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-07 19:53:00 +00:00
Greg Daniel
45e4e0ed2b Fix Surface::resolveMSAA for non msaa surfaces.
Bug: chromium:1292418
Change-Id: I48dc15fa43b4f3c12e5ca87f1665b2da85d93ddf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504697
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-07 15:29:40 +00:00
John Stiles
b73789dc4a Reland "Reenable unreachable-code warnings."
This is a reland of b292c30aa0

This CL also addresses the Wuffs-specific unreachable code.

Original change's description:
> Reenable unreachable-code warnings.
>
> Change-Id: Ie56967a4b823388f0975384e88be23ff2fceecf7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504598
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Change-Id: I655db50134e0de0d0448f22b636ba027513e28f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504757
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-07 14:56:09 +00:00
John Stiles
87aa7a9095 Add SK_PRINTF_LIKE to existing variadic print functions.
This shook out a handful of formatting issues:
[SkVMVisualizer]
- We were passing plain text like "width:35%;" through printf.
- One particular opcode type was printing a string as a number.
[Skottie, SortToy]
- Used wrong integer type instead of %zu for size_t

This CL does not update print functions which take printf arguments via
variadic template, as __attribute__((format)) does not support this
style. These could be converted to va_list style, but that's not done in
this CL.

(For some reason, GCC requires the attribute to be set on a prototype
for freestanding functions, so a few of these now have a prototype
immediately followed by a declaration.)

Change-Id: I63a6c2486c785cc38563028fdf8df0662ec04935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504698
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-07 14:55:39 +00:00
John Stiles
d7f7cc8791 Revert "Pin FcConfig for FCIDirect at creation."
This reverts commit 8b618c3e16.

Reason for revert: google3 roll failure due to memory leak
http://screen/4pH356LBiTMTQK7

Original change's description:
> Pin FcConfig for FCIDirect at creation.
>
> SkFontConfigInterfaceDirect class methods used the FontConfig library
> static global "current" FcConfig (implicitly through the use of
> nullptr). This was pinned down once per call to each method which used
> it (to avoid the "current" FcConfig from being changed out from under it
> while running). However, the use of global state as a matter of course
> makes it very difficult to reliably test.
>
> Modify SkFontConfigInterface to optionally take an FcConfig on
> contruction. If nullptr is provided it is equivelent to the user passing
> the result of `FcConfigReference(nullptr)` so that existing users are
> unaffected. SkFontConfigInterface now takes ownership of this FcConfig
> and will release it on destruction.
>
> Change-Id: Ie3573403a95c6bf627ce5ff7f2eb5617c9cd162d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504477
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Change-Id: I812547bf27371ab716b7a167d7e975f7538d37fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504776
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-04 23:32:11 +00:00
John Stiles
4250effcc5 Prepare to reenable unreachable-code warnings.
Adding double-parens around an `if ((false))` squelches the warning.
In other cases, you can squelch the warning by assigning the
always-constant(-on-this-machine) check into a constexpr bool.

Change-Id: I5a344fb45779c5bd2865edb3cffaf839ba9a5d85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-04 21:45:39 +00:00
Greg Daniel
324e00243f [graphite] Add RecorderPriv class
Change-Id: If2ef260cf015e7f7ae2ebc7de1a41a5ef52b8dd3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504616
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-04 21:23:08 +00:00
Ben Wagner
8b618c3e16 Pin FcConfig for FCIDirect at creation.
SkFontConfigInterfaceDirect class methods used the FontConfig library
static global "current" FcConfig (implicitly through the use of
nullptr). This was pinned down once per call to each method which used
it (to avoid the "current" FcConfig from being changed out from under it
while running). However, the use of global state as a matter of course
makes it very difficult to reliably test.

Modify SkFontConfigInterface to optionally take an FcConfig on
contruction. If nullptr is provided it is equivelent to the user passing
the result of `FcConfigReference(nullptr)` so that existing users are
unaffected. SkFontConfigInterface now takes ownership of this FcConfig
and will release it on destruction.

Change-Id: Ie3573403a95c6bf627ce5ff7f2eb5617c9cd162d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504477
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-02-04 20:37:16 +00:00
Ben Wagner
bee5ccd548 Avoid "drawable" when not referring to SkDrawable.
Change all use of "drawable" to "accepted" in glyph drawing code. To
improve uniformity "rejects" is also changed to "rejected".  This is
motivated by the desire to add SkDrawable backed glyph rendering, which
would make the use of "drawable" for both "glyphs which are drawable"
and "glyph which renders with SkDrawable" very confusing.

Change-Id: I6d080bc9ec25f81aa9479757d2cca47ae74f4db6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504236
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-02-04 15:52:11 +00:00
John Stiles
4d6f603241 Eliminate unused function.
This was blocking the Android roll: http://screen/9937JW7waCFer64

Change-Id: I89a88ff5a28e077fb302b5c803d0e4829de35103
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504416
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-04 14:57:17 +00:00
John Stiles
9c63e63771 Add missing intrinsic tests for abs/max/min(genIType), clamp(genType)
GPUs that failed continued to fail when I put in error bars like
`distance(a, b) <= 0.001`, so they're just disabled entirely now.
Presumably their results are very busted.

Change-Id: I0f1b80f661563a20630740f8cfb6ef69f2a47934
Bug: skia:11209, skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503817
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-04 14:42:17 +00:00
Ethan Nicholas
744116876e Improved whole-program dehydration and rehydration
This adds a Dehydrator.write(Program) to mirror the Rehydrator's
program() method and simplifies the API.

Change-Id: I1b6d6b722d0ce8e6a292132522f806e43d49ce85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502704
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-03 21:49:16 +00:00
Ethan Nicholas
abddff3e11 Re-land "Added tests for sksl clone() on our test corpus".
This reverts commit 63a4d65e16.

Change-Id: Ibd17331d518cf1ac95a310e505ee5b0f6495905e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501318
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-02-03 21:01:48 +00:00
John Stiles
9cce961d3b Revert "Add missing mix(genIType, genIType, genBType) to sksl_public."
This reverts commit d33334d44e.

Reason for revert: this isn't available in ES3! Only 4.5.
http://screen/9VstoY9RQkufqm3

Original change's description:
> Add missing mix(genIType, genIType, genBType) to sksl_public.
>
> Change-Id: I8d4816f726196e6f4a5fbb0940b5dd1b2d7db7f5
> Bug: skia:11209
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503821
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Bug: skia:11209
Change-Id: Iad4e95ca89b79066d3a1be42605b4338b542638f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503831
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-03 20:44:11 +00:00
Herb Derby
7cb61889c5 convertToBlob added to remote glyphs cache
Have the AnalysisCanvas (also known as the diff canvas) convert
SkTextBlobs to GrSlugs and record the Strike differences. Make sure
these differences are tracked and recorded.

Bug: chromium:1278340

Change-Id: I2c8d62fa61511abd1e14d4bf595e6db1a0b5e26b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503827
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-03 20:36:44 +00:00
John Stiles
d33334d44e Add missing mix(genIType, genIType, genBType) to sksl_public.
Change-Id: I8d4816f726196e6f4a5fbb0940b5dd1b2d7db7f5
Bug: skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503821
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-02-03 20:19:48 +00:00
Greg Daniel
2a4a0b7f1f Reland "Add SkSurface resolve function."
This is a reland of d921f21fbc

Original change's description:
> Add SkSurface resolve function.
>
> This will insert a resolve msaa call into the stream of commands for
> the SkSurface. This is mostly useful for cases when a client wraps the
> resolve texture but has Skia draw with MSAA, and the client wants to
> make sure Skia resolves to their wrapped texture.
>
> Bug: chromium:1292418
> Change-Id: I6eddae967136716b9215fcd96e7d77a2457efdf2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503340
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

Bug: chromium:1292418
Change-Id: I810b5618092c560f5bba900024b3b8c0c88baea9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503717
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-03 20:13:16 +00:00
Brian Osman
005392cbc4 Reland "For runtime shaders, deduce isOpaque automatically"
This is a reland of 995d16fc91

Original change's description:
> For runtime shaders, deduce isOpaque automatically
>
> The forceOpaque parameter is now ignored. Instead, we do a conservative
> analysis of the shader's main function to determine if it always returns
> an opaque color. This is good enough to detect simple cases, including
> things like:
>
>   return child.eval(p).rgb1
>
> Bug: skia:12643
> Bug: skia:12896
> Change-Id: I74b331aa12fadb1d0d1bb85f225dc7aa01ba2455
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503346
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:12643
Bug: skia:12896
Change-Id: I4ae55cdd3f88c1b5a08bd59913df1c1cd48a4679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503824
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 18:45:09 +00:00
Kevin Lubick
49df61f638 Reland "[fuzzer] Remove GL from (now-Vulkan) build"
This is a reland of 805acda3f3

It fixes the #if SK_GL which was causing the Android roll
to fail.

This disables unit tests on Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-TSAN_Vulkan
which were consistently crashing with OOM.

Original change's description:
> [fuzzer] Remove GL from (now-Vulkan) build
>
> The fuzzer runs against the Vulkan version of Swiftshader.
> There are no libGL.so (etc) on the fuzz runtime, so we
> want to avoid linking against those.
>
> The GL code that is #ifdef'd out is still necessary to
> avoid timeouts on TSAN with our NVIDIA jobs.
> https://skia-review.googlesource.com/c/skia/+/502638
>
> Procedure for testing this locally (and iterating):
>   1. In oss-fuzz checkout, run
>      `python infra/helper.py shell skia`
>      to pull up local interactive version of Docker
>      fuzzer build image.
>   2. Run `compile` in fuzzer shell. Stop after
>      the swiftshader compiles and is copied into /out
>      with Ctrl + C.
>   3. Comment out the swiftshader compilation part [1]
>      (no need to re-do this when modifying Skia code).
>      `apt-get install nano -y`
>      `nano ../build.sh`
>   4. Make change to Skia repo using normal methods.
>   5. Run the following in the Skia repo
>      `git diff origin main > foo.patch`
>      Copy the patch into the Docker shell using Ctrl+C
>      and nano.
>   6. Apply the patch inside the Docker shell
>      `git apply foo.patch`
>      and re-compile (which should skip right to
>      building the fuzzer libs)
>      `compile`
>   7. Repeat 4-7 or make small changes directly in
>      the Docker shell via nano.
>   8. When compilation and link succeeds, run
>      `ldd /out/api_mock_gpu_canvas`
>      to verify GL and friends were not dynamically linked.
>
> [1] https://github.com/google/oss-fuzz/pull/7214/files#diff-76f13875e33875cdd372f1f0933206be599cd87952f1bd1eaa57ca928ee9e3e1R49-R53
>
> Change-Id: Idf569820527c1304b0e5a68fd36295be89dfa2a0
> Bug: oss-fuzz:44132
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503016
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>

Bug: oss-fuzz:44132, skia:12900
Change-Id: Ia2eff9403b0035e7f86098f296d7d9b1bbfd4876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503716
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-03 18:07:47 +00:00
Brian Osman
bd712d3f97 In SkSL tests, don't force opaque output
Requires tweaking one inliner test to avoid an Intel driver bug (on
ANGLE).

Bug: chromium:709351
Cq-Do-Not-Cancel-Tryjobs: true
Change-Id: I08fac938396d6b90805ba9650c7a520af888bc12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503819
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 17:25:35 +00:00
Robert Phillips
433504300a [graphite] Distribute key creation to SkShaders
Bug: skia:12701
Change-Id: I33d24fc319acbfbb3a218a8dd916c5a64f15f028
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503342
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-03 17:22:58 +00:00
Ben Wagner
8405dfceaa Improve remote glyph caching.
A glyph cache entry is made up of metrics, an image, and a path. If an
entry does not exist then nothing is known of the glyph yet. If there is
an entry it must have at least the metrics. The image and the path may
logically be added lazily as needed. Prior to this change it was not
possible to send both the image and the path of a single glyph. The
added test fails when a given strike is used for both the image and the
path. With this change the test passes, as the image is sent and the
path is sent, and both are merged into the remote glyph. The assertions
around not creating the glyph more than once are replaced with
assertions that no part of the glyph is set more than once.

Change-Id: I2fd4047ee15e0d584b68e1180c6fe15224889310
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503347
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2022-02-03 16:49:43 +00:00
Brian Osman
4e95e1e12a Revert "For runtime shaders, deduce isOpaque automatically"
This reverts commit 995d16fc91.

Reason for revert: Breaks one SkSL test on ANGLE

Original change's description:
> For runtime shaders, deduce isOpaque automatically
>
> The forceOpaque parameter is now ignored. Instead, we do a conservative
> analysis of the shader's main function to determine if it always returns
> an opaque color. This is good enough to detect simple cases, including
> things like:
>
>   return child.eval(p).rgb1
>
> Bug: skia:12643
> Bug: skia:12896
> Change-Id: I74b331aa12fadb1d0d1bb85f225dc7aa01ba2455
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503346
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:12643
Bug: skia:12896
Change-Id: I7d86933f29ddb373222dff7f2a28a413fd777002
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503818
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-03 16:09:13 +00:00
John Stiles
d4fff483dd Implement Metal polyfill for sign(genIType).
This uses nested selects to compute `(x > 0) ? 1 : (x < 0) ? -1 : 0`.

Change-Id: I1a87fc8506767bb0a9dd77ba2193b330e0a4d0a2
Bug: skia:12898, skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503486
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-03 15:21:03 +00:00
Brian Osman
995d16fc91 For runtime shaders, deduce isOpaque automatically
The forceOpaque parameter is now ignored. Instead, we do a conservative
analysis of the shader's main function to determine if it always returns
an opaque color. This is good enough to detect simple cases, including
things like:

  return child.eval(p).rgb1

Bug: skia:12643
Bug: skia:12896
Change-Id: I74b331aa12fadb1d0d1bb85f225dc7aa01ba2455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503346
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 15:04:34 +00:00
John Stiles
ffeb6f2339 Remove SkSL::String class.
The previous CLs have removed the last significant differences between
SkSL::String and std::string. This CL removes SkSL::String entirely and
replaces it with std::string throughout the code.

Apologies for the very long CL, but I have done my best to make it as
simple and reviewable as possible. The vast majority of changes are
simple replacement of `SkSL::String` with `std::string`. In the rare
spots where code is moved from one place to another, it is logically
unchanged.

Change-Id: I39563d2db45da229f17f4504dfd63e00bde7a96e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503339
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 14:59:16 +00:00
Leon Scroggins
1351a5954f Revert "[fuzzer] Remove GL from (now-Vulkan) build"
This reverts commit 805acda3f3.

Reason for revert: Looks to be breaking the Android roll. See https://android-build.googleplex.com/builds/pending/P29733268/aosp_bramble-userdebug/latest/view/logs/build_error.log

Original change's description:
> [fuzzer] Remove GL from (now-Vulkan) build
>
> The fuzzer runs against the Vulkan version of Swiftshader.
> There are no libGL.so (etc) on the fuzz runtime, so we
> want to avoid linking against those.
>
> The GL code that is #ifdef'd out is still necessary to
> avoid timeouts on TSAN with our NVIDIA jobs.
> https://skia-review.googlesource.com/c/skia/+/502638
>
> Procedure for testing this locally (and iterating):
>   1. In oss-fuzz checkout, run
>      `python infra/helper.py shell skia`
>      to pull up local interactive version of Docker
>      fuzzer build image.
>   2. Run `compile` in fuzzer shell. Stop after
>      the swiftshader compiles and is copied into /out
>      with Ctrl + C.
>   3. Comment out the swiftshader compilation part [1]
>      (no need to re-do this when modifying Skia code).
>      `apt-get install nano -y`
>      `nano ../build.sh`
>   4. Make change to Skia repo using normal methods.
>   5. Run the following in the Skia repo
>      `git diff origin main > foo.patch`
>      Copy the patch into the Docker shell using Ctrl+C
>      and nano.
>   6. Apply the patch inside the Docker shell
>      `git apply foo.patch`
>      and re-compile (which should skip right to
>      building the fuzzer libs)
>      `compile`
>   7. Repeat 4-7 or make small changes directly in
>      the Docker shell via nano.
>   8. When compilation and link succeeds, run
>      `ldd /out/api_mock_gpu_canvas`
>      to verify GL and friends were not dynamically linked.
>
> [1] https://github.com/google/oss-fuzz/pull/7214/files#diff-76f13875e33875cdd372f1f0933206be599cd87952f1bd1eaa57ca928ee9e3e1R49-R53
>
> Change-Id: Idf569820527c1304b0e5a68fd36295be89dfa2a0
> Bug: oss-fuzz:44132
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503016
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>

Bug: oss-fuzz:44132
Change-Id: I3832417c60ff425572717d37dc9609419922b18e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503351
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-03 13:10:09 +00:00
Greg Daniel
27303250dd Revert "Add SkSurface resolve function."
This reverts commit d921f21fbc.

Reason for revert: New test breaking GL android bots

Original change's description:
> Add SkSurface resolve function.
>
> This will insert a resolve msaa call into the stream of commands for
> the SkSurface. This is mostly useful for cases when a client wraps the
> resolve texture but has Skia draw with MSAA, and the client wants to
> make sure Skia resolves to their wrapped texture.
>
> Bug: chromium:1292418
> Change-Id: I6eddae967136716b9215fcd96e7d77a2457efdf2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503340
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

Bug: chromium:1292418
Change-Id: I86e5f82f0e2a0921906c0caba964929750500965
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503350
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-02 21:26:13 +00:00
Greg Daniel
d921f21fbc Add SkSurface resolve function.
This will insert a resolve msaa call into the stream of commands for
the SkSurface. This is mostly useful for cases when a client wraps the
resolve texture but has Skia draw with MSAA, and the client wants to
make sure Skia resolves to their wrapped texture.

Bug: chromium:1292418
Change-Id: I6eddae967136716b9215fcd96e7d77a2457efdf2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503340
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-02 19:55:40 +00:00
John Stiles
a3b11365b4 Update RecursiveComparison tests to run on GPU.
These tests are not guaranteed to pass in ES2 (as ES2 specifically does
not require NaN to be implemented), so they are now run in GPU+ES3 and
on the CPU.

Change-Id: Ica78e15a06b3b00b651c5fabd0decf751853a83f
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501238
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-02 19:39:00 +00:00
Greg Daniel
55a69d1de0 [graphite] Store ResourceProvider on Recorder instead of Gpu.
By being on Recorder, more calls can directly access the ResourceProvider
without needing the Context or Gpu. A different ResourceProvider is
created for each Recorder. Each ResourceProvider stores a ref to the
GlobalCache so that it can access shared resources. Eventually each
ResourceProvider will also have its own ResourceCache for all non shared
Resources.

A big win of this change is that Context can be removed from Recorder.

Bug: skia:12754
Change-Id: Ib6ac71c617de4d6b6b2ac4956580e65d4d7e6f7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502637
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-02 19:34:39 +00:00
Kevin Lubick
805acda3f3 [fuzzer] Remove GL from (now-Vulkan) build
The fuzzer runs against the Vulkan version of Swiftshader.
There are no libGL.so (etc) on the fuzz runtime, so we
want to avoid linking against those.

The GL code that is #ifdef'd out is still necessary to
avoid timeouts on TSAN with our NVIDIA jobs.
https://skia-review.googlesource.com/c/skia/+/502638

Procedure for testing this locally (and iterating):
  1. In oss-fuzz checkout, run
     `python infra/helper.py shell skia`
     to pull up local interactive version of Docker
     fuzzer build image.
  2. Run `compile` in fuzzer shell. Stop after
     the swiftshader compiles and is copied into /out
     with Ctrl + C.
  3. Comment out the swiftshader compilation part [1]
     (no need to re-do this when modifying Skia code).
     `apt-get install nano -y`
     `nano ../build.sh`
  4. Make change to Skia repo using normal methods.
  5. Run the following in the Skia repo
     `git diff origin main > foo.patch`
     Copy the patch into the Docker shell using Ctrl+C
     and nano.
  6. Apply the patch inside the Docker shell
     `git apply foo.patch`
     and re-compile (which should skip right to
     building the fuzzer libs)
     `compile`
  7. Repeat 4-7 or make small changes directly in
     the Docker shell via nano.
  8. When compilation and link succeeds, run
     `ldd /out/api_mock_gpu_canvas`
     to verify GL and friends were not dynamically linked.

[1] https://github.com/google/oss-fuzz/pull/7214/files#diff-76f13875e33875cdd372f1f0933206be599cd87952f1bd1eaa57ca928ee9e3e1R49-R53

Change-Id: Idf569820527c1304b0e5a68fd36295be89dfa2a0
Bug: oss-fuzz:44132
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503016
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-02 15:43:47 +00:00
Robert Phillips
80428f7c2e [graphite] Pass SkUniforms around as an SkSpan
Bug: skia:12701
Change-Id: Iee63650517a739029f81121cabd45dfcc2e8fa38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502698
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-02 15:31:13 +00:00
Greg Daniel
bc1e97ee5f [graphite] Add GlobalCache class to hold objects that can be accesed by all Recorders.
This class will be used to provide thread safe access to various shared
resources in Graphite. Currently the only thing moved onto here is
the SkShaderCodeDictionary. Eventually it will have things like the
pipeline cache on it as well.

The plan is that users will not access this class directly but instead
via a ResourceProvider (see follow on change).

Bug: skia:12754
Change-Id: I2ae2c4bf7025945de850a618055e59ccd403aaaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502315
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-01 21:55:14 +00:00
John Stiles
074a016b89 Remove skstd::string_view entirely.
We now use std::string_view throughout. SkStringView.h has been moved to
include/private/ and is only used for our C++20/23 compatibility methods
(starts_with/ends_with/contains).

Change-Id: I961842c6778256a03868e7602d48add34f420763
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502306
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-02-01 21:16:41 +00:00
Dominik Röttsches
7646dffe58 Determine weight, width and slant from variable axes
Let variable axes override existing or determine style information
with priority over FreeType face flags or information
from the OS/2 table.

Add test case for matching a variable fonts through SkFontMgr_FCI to
ensure the weight determination from variable axes is exercise.
The test does not exercise width or slant.

Add a small (~8.5k) subsetted Noto Sans CJK collection as a test font
(made using [1]), and ensure that matching, reported font style and axis
configuration are correct after matching.

[1] https://github.com/drott/noto-cjk/blob/subsetVFttv/subsetvf.py

Bug: skia:12864, skia:12881
Change-Id: I1fb05d88f68eda308b8864d32d98400c68e46834
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500516
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Dominik Röttsches <drott@google.com>
2022-02-01 19:34:50 +00:00
Robert Phillips
6e1ff7154d [graphite] Plumb SkUniformData/SkUniformBlock everywhere
An SkUniformData represents the uniforms from a single code snippet
The SkUniformBlock collects the set of SkUniformDatas needed by a whole program

Bug: skia:12701
Change-Id: Ic0596e2fb02ea00bec882af493644def9ebb2468
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497743
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-01 18:50:21 +00:00