Commit Graph

56889 Commits

Author SHA1 Message Date
Brian Osman
9155b338bb Revert "Add ES3 intrinsics isinf/isnan to public SkSL ES3."
This reverts commit e43714f490.

Reason for revert: Several Pixel (Adreno) devices failing the test

Original change's description:
> Add ES3 intrinsics isinf/isnan to public SkSL ES3.
>
> The ES3 spec doesn't mandate that `isnan` actually has to do anything,
> so the Isnan test is not enabled. (It doesn't work on my personal
> machine unless I make the NaN detectable at compile-time.)
>
> We do not support these functions in constant-expressions, as we
> currently avoid optimizing anything into a non-finite value; we leave
> expressions alone if we calculate a NaN/inf result for their value.
>
> Change-Id: Ibfdfb47b6e6134165c8780db570de04a916d2bfa
> Bug: skia:12022
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441581
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I89899ed391aa870350d0452bab4a0fb75bd7be38
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-25 02:55:09 +00:00
Chris Dalton
80fc31bc61 Set --internalSamples for nanobench
Use 4 internal msaa samples on mobile and AppleM1, otherwise 8.

Bug: skia:12372
Change-Id: Ic64d93d65d9fef89df08f7471f9552b4a2546316
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441682
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-24 21:34:17 +00:00
Brian Osman
293497e77f Convert internal sample() calls to shade/filter/blend
Bug: skia:12302
Change-Id: I8cf958acf9214d0de903a4097647afd74f2a659e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441541
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 21:03:44 +00:00
Ravi Mistry
7b3edfa659 Fix Flutter bot by using vpython3 from cipd and setting env vars for it
Change-Id: I429771c977a0f01805ea49077fe8cda642f1a477
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441308
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
2021-08-24 20:20:49 +00:00
John Stiles
e43714f490 Add ES3 intrinsics isinf/isnan to public SkSL ES3.
The ES3 spec doesn't mandate that `isnan` actually has to do anything,
so the Isnan test is not enabled. (It doesn't work on my personal
machine unless I make the NaN detectable at compile-time.)

We do not support these functions in constant-expressions, as we
currently avoid optimizing anything into a non-finite value; we leave
expressions alone if we calculate a NaN/inf result for their value.

Change-Id: Ibfdfb47b6e6134165c8780db570de04a916d2bfa
Bug: skia:12022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441581
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-24 19:23:48 +00:00
John Stiles
c332739531 Remove 0/x arithmetic simplification.
If x is a known compile-time constant value, it can already be optimized
to a final value.
If x is not known, it could be zero, and 0/0 should result in a NaN.

Change-Id: I643a7c6da0a43ec366235c4df39fc78d3b361de7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441580
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-24 19:18:41 +00:00
Brian Osman
9746f20a04 Tweak Overflow.sksl to generate the same output on Windows & other OS
Change-Id: I26754745aa26313a2f76a86bd41699c7ac5b8a46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441596
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-08-24 18:29:17 +00:00
Michael Ludwig
8c75b2d30e Simplify conservative clip tracking for SkNoPixelsDevice
Deletes SkConservativeClip as a type, it was only used by
SkNoPixelsDevice at this point.

Simplifies the clip tracking to only rely on intersect/difference ops
(but also expands it to support updating overall bounds if the diff
op is a sufficiently large rectangle).

Adds SkRect::roundIn() -> SkIRect to match the exposed API for round()
and roundOut().

Bug: skia:10205
Change-Id: I1337a51a8a4e51f94fe2b5f9ab29a0b5058b8094
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437737
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-24 18:23:43 +00:00
Brian Osman
f8a550491e SkSL: Use type-specific sampling intrinsics, rather than fn-call syntax
After further discussion, using intrinsics with signatures similar to
sample keeps us looking like GLSL. However, using "sample" is still
misleading, so this adds explicit "shade", "filter", and "blend"
intrinsics. After migrating clients, the "sample" versions will be
removed.

Bug: skia:12302
Change-Id: Ia03e4b3794fc1fc5ae3c3099a7a350343ec7702e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441457
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-24 18:18:46 +00:00
John Stiles
878d8fbf2f Improve constant folding for boolean vectors.
The additional tests from http://review.skia.org/441238 uncovered a gap
in the constant folder's abilities; it was not able to fold away
boolean vector comparisons even when they were constant. These are ES2
constant-expressions, so folding them properly is a requirement.

Change-Id: Ia0b4d5d1215c5fc2b247ac3f0dec4c8747d2153e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441579
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-08-24 18:12:12 +00:00
Ethan Nicholas
877858a195 Removed unnecessary GL extensions
We've been cargo-culting these extensions around for a long time, but it
appears they aren't actually necessary.

Change-Id: I536ec9b81643c7d35f108d230233bb6990fcb5d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441519
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-08-24 17:34:17 +00:00
John Stiles
0c4dd7ae3d Add ES3 versions of min/max/mix/clamp to public SkSL.
I've also added a new runtime_intrinsics slide which plots all of the
ES3 section 8.3 intrinsics for testing purposes. We already had SkSL
tests for the ES3 versions of these functions in intrinsics/.

Change-Id: Ie4cec34cacddc26be78dce1e641de8172fcefd99
Bug: skia:12022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441578
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-24 17:14:50 +00:00
John Stiles
6f90c702e6 Improve runtime-intrinsic plotting.
Instead of a series of green dots, we now get a smooth antialiased line.
This is especially useful on high-DPI displays, as previously the green
dots had gaps between them (making the plot appear as a dashed line).

Change-Id: I947e9ec31fafd133a2458bf508102fedd3eaea1a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441577
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-08-24 15:48:17 +00:00
Michael Ludwig
53009db137 Reland "Downgrade giant clip ops' AA in SkRasterClipStack"
This reverts commit f248b35d75.

Reason for revert: adding guard around aa disabling

Original change's description:
> Revert "Downgrade giant clip ops' AA in SkRasterClipStack"
>
> This reverts commit 3a15110898.
>
> Reason for revert: needs a build flag to roll into g3
>
> Original change's description:
> > Downgrade giant clip ops' AA in SkRasterClipStack
> >
> > Anti-aliased path rendering in the software backend has an internal
> > limit of +/-16384 per coordinate. Path rendering is triggered by draws
> > and clips. Draws are tiled at a high-level before entering the blitter,
> > so this limit will not be encountered. Coverage mask generation for
> > AA clips, however, is not tiled. Normally, it relies on the path being
> > clipped by the underlying device dimensions. When the device itself
> > is larger than 16384, then the clip ops can reach the blitter and
> > exceed the internal limit.
> >
> > When this happens, SkScan::FillPath adds a hard rect clip, which is
> > what caused the mis-applied clip seen in the attached bug report.
> >
> > This CL detects when the canvas/device dimensions are large enough to
> > cause this problem and forcefully disables anti-aliasing for all clips.
> > This shouldn't really be a visual behavior change since the blitter
> > already was downgrading from AA. The main advantage is that the clip
> > stack will use SkRegion for BW clips exclusively instead of switching
> > to use SkAAClip.
> >
> > It was decided to handle this at the clip stack level vs. a per-op
> > decision since a non-AA large clip element used with SkAAClip (
> > triggered by a smaller non-problematic op) would still show the bug.
> >
> > This is only a mitigation. The long-term solution is to use tiling for
> > clipping as well as drawing (possibly by requiring the tiling to be
> > handled by clients, with surface creation failing at sizes > 16k).
> >
> > Bug: chromium:1240718, skia:7998
> > Change-Id: I1f4cae540bec4d44c6e1d8032ded9e95ff32b82f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441456
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: I6008cef5f7df48f27497e2ec75db14584c2acb68
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1240718, skia:7998
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441520
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Bug: chromium:1240718, skia:7998
Change-Id: Ie152db8dd95b1f40cbfa26c1c4543601f3f53754
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441497
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-24 15:46:19 +00:00
Jorge Betancourt
e1fb47daac [JetSki] plumb experimental SkText to JetSki
Change-Id: I972ff5bd066ff9e8afa98f506e6fe9d6b9dc621a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440597
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-08-24 15:34:21 +00:00
Brian Osman
b5282f0112 Migrate runtime effect sample tests to golden files
Much easier to maintain, especially with an upcoming change to the
sampling syntax.

Change-Id: I378811b7be0afcce5b7e68a942e7b46d96568155
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441518
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-08-24 15:19:44 +00:00
Ethan Nicholas
0f36d11c1d Report pending errors from MetalCodeGenerator
This mirrors the change in https://skia-review.googlesource.com/c/skia/+/441311,
but for Metal this time.

Change-Id: I1abdb844b6392c81252532f9ff4a91b993edb66e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441401
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-08-24 15:08:31 +00:00
John Stiles
d77dda5bd5 Fix inliner bug discovered by fuzzer.
The inliner contained a type error when attempting to inline a function
that takes an array as input. The scratch copy of the array was created
as `float[123] var;` instead of `float var[123];`. This led to an
assertion in VarDeclaration::Make.

Change-Id: I5128fe71462bb59a015a7b4e59c1a74800828b16
Bug: oss-fuzz:37466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441576
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-08-24 14:44:43 +00:00
Michael Ludwig
f248b35d75 Revert "Downgrade giant clip ops' AA in SkRasterClipStack"
This reverts commit 3a15110898.

Reason for revert: needs a build flag to roll into g3

Original change's description:
> Downgrade giant clip ops' AA in SkRasterClipStack
>
> Anti-aliased path rendering in the software backend has an internal
> limit of +/-16384 per coordinate. Path rendering is triggered by draws
> and clips. Draws are tiled at a high-level before entering the blitter,
> so this limit will not be encountered. Coverage mask generation for
> AA clips, however, is not tiled. Normally, it relies on the path being
> clipped by the underlying device dimensions. When the device itself
> is larger than 16384, then the clip ops can reach the blitter and
> exceed the internal limit.
>
> When this happens, SkScan::FillPath adds a hard rect clip, which is
> what caused the mis-applied clip seen in the attached bug report.
>
> This CL detects when the canvas/device dimensions are large enough to
> cause this problem and forcefully disables anti-aliasing for all clips.
> This shouldn't really be a visual behavior change since the blitter
> already was downgrading from AA. The main advantage is that the clip
> stack will use SkRegion for BW clips exclusively instead of switching
> to use SkAAClip.
>
> It was decided to handle this at the clip stack level vs. a per-op
> decision since a non-AA large clip element used with SkAAClip (
> triggered by a smaller non-problematic op) would still show the bug.
>
> This is only a mitigation. The long-term solution is to use tiling for
> clipping as well as drawing (possibly by requiring the tiling to be
> handled by clients, with surface creation failing at sizes > 16k).
>
> Bug: chromium:1240718, skia:7998
> Change-Id: I1f4cae540bec4d44c6e1d8032ded9e95ff32b82f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441456
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I6008cef5f7df48f27497e2ec75db14584c2acb68
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1240718, skia:7998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441520
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-24 14:16:47 +00:00
Brian Osman
9f1e06aef9 Reland "Add sRGB 8888 colortype"
This is a reland of 0f7c10ef56

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Change-Id: I5b6bb28c4c1faa6c97fcad7552d12c331535714d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441402
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 12:56:32 +00:00
Michael Ludwig
3a15110898 Downgrade giant clip ops' AA in SkRasterClipStack
Anti-aliased path rendering in the software backend has an internal
limit of +/-16384 per coordinate. Path rendering is triggered by draws
and clips. Draws are tiled at a high-level before entering the blitter,
so this limit will not be encountered. Coverage mask generation for
AA clips, however, is not tiled. Normally, it relies on the path being
clipped by the underlying device dimensions. When the device itself
is larger than 16384, then the clip ops can reach the blitter and
exceed the internal limit.

When this happens, SkScan::FillPath adds a hard rect clip, which is
what caused the mis-applied clip seen in the attached bug report.

This CL detects when the canvas/device dimensions are large enough to
cause this problem and forcefully disables anti-aliasing for all clips.
This shouldn't really be a visual behavior change since the blitter
already was downgrading from AA. The main advantage is that the clip
stack will use SkRegion for BW clips exclusively instead of switching
to use SkAAClip.

It was decided to handle this at the clip stack level vs. a per-op
decision since a non-AA large clip element used with SkAAClip (
triggered by a smaller non-problematic op) would still show the bug.

This is only a mitigation. The long-term solution is to use tiling for
clipping as well as drawing (possibly by requiring the tiling to be
handled by clients, with surface creation failing at sizes > 16k).

Bug: chromium:1240718, skia:7998
Change-Id: I1f4cae540bec4d44c6e1d8032ded9e95ff32b82f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441456
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-24 12:16:44 +00:00
Ethan Nicholas
553239bc12 Added reportPendingErrors to SkSL code generation
This fixes an assertion failure uncovered by the fuzzer.

Bug: oss-fuzz:37469
Change-Id: I626c003cfa8a0bc65851899df3a7695dbe29200b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441311
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-23 20:54:40 +00:00
Herb Derby
bb447be35a clean up code: explicits, finals, and namespace
Change-Id: Ie346a2dab7648e28e71ed0b6fd9331895644f1a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441400
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-08-23 19:57:47 +00:00
John Stiles
2089b3cbdb Remove redundant check from constant-value detection code.
The last if check in this loop was unnecessary. It was an exact
duplicate of the first check at the top of the loop.

Change-Id: I08adc4f6df8577d168ae965220c0d9ddceb91121
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441240
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-23 19:31:30 +00:00
John Stiles
3f37322d71 Fix const function-parameter assertion discovered by fuzzer.
During constant-folding, we baked in an assertion stating that any
const-typed variable reference ought to have an initial value, because
you can't declare a const variable without assigning a value. However,
function parameters are an exception to this rule! They are variable
references and are allowed to be const, but will not have an initial
value. (In this case, `const` just means you can't alter the value.)

In this case, all we needed to do was remove the assertion; we already
treated this case defensively and with the appropriate care.

Change-Id: I61242c6d08c59886c6992898f195771e6334f2b4
Bug: oss-fuzz:37465
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441239
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-08-23 19:28:29 +00:00
Herb Derby
7cba20f80c use a tent filter for sigma larger than 132
Originally, the cpu blur code could only deal with sigma <= 132. This
is due to limiting the gaussian to using a uint32_t for accumulation.
This change adds a tent filter for sigma > 132 but less < 2183. The
upper limit is not a problem because the GPU code limits sigma to 535
for both GPU and CPU. The output for GPU and CPU should be very
similar now.

Bug = skia:12338

Change-Id: I12299373911f42b914ee329a02ca81bdbd0763bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440545
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 18:52:42 +00:00
Ethan Nicholas
39f6da4793 Switched Context::errors() over to a field access
Now that Context owns the errors pointer, there is no magic behind its
accessor and no reason not to just use a straight field access.

Change-Id: I3f771f458ffdaf95d6289ba5767535a78126cc0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441312
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-08-23 18:40:09 +00:00
Brian Osman
405eb7b72f Revert "Add sRGB 8888 colortype"
This reverts commit 0f7c10ef56.

Reason for revert: Unhappy rollers

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reed@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ie199535b9b65ec7c7fef3c773452ea06bdbd2d9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441376
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-23 17:38:05 +00:00
John Stiles
d361690358 Fix diagonal-matrix assertion discovered by fuzzer.
This was another place where we needed to use
`getConstantSubexpression` to rebuild vectors/matrices; it is a more
robust approach than trying handle each ctor type individually. The
fuzzer found an edge case with double-casting matrices to vectors that
fell through the cracks with the original approach.

In adding additional tests, I also found a case that the constant-folder
seems to ignore, `bool4(x,x,x,x) == bool4(x)`. This does fold for ints
and floats, so this ought to be fixable in a followup, but it's not a
big deal either way; this is very unlikely to occer in real code.

Change-Id: I4d577c87ef7049306685ca95250ecdf93b1dbc06
Bug: oss-fuzz:37464
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441238
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-08-23 17:33:42 +00:00
Ben Wagner
e127304700 Fix stringop-overflow in SkString
GCC 10.2.1 gives the following warning as error in a release build

../../src/core/SkString.cpp:227:22: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  227 |     rec->data()[len] = 0;

which is detecting that fBeginningOfData is a char and that this code
cannot be reached with len == 0. Work around this by changing
fBeginningOfData to be an array of one char containing the empty string
by default.

While making this change, also make fBeginningOfData and fRefCnt
private.

Change-Id: Ic254bac465fcd02707a06010e0d7501520f7271d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441136
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-08-23 17:19:44 +00:00
Ethan Nicholas
313c9482a1 Remove ErrorReporter pointer from DSL
This centralizes the ownership of the current ErrorReporter solely in
SkSLContext.

Change-Id: I3fdffb8133e9800ef9b898a62c2d418560079b83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441237
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-08-23 16:39:58 +00:00
Jim Van Verth
466b280461 Reland "Metal: Use StoreAndResolve store action when possible."
This is a reland of a7f9d8c2b1

Original change's description:
> Metal: Use StoreAndResolve store action when possible.
>
> This is a step towards using memoryless MSAA attachments, and
> discardable resolve. As we're currently doing a Store, Load, and then
> Resolve, this at least saves us the Load.  We may fall back to this mode
> if the resolve target is framebufferOnly and hence we can't use it as
> an input attachment.
>
> Bug: skia:12086
> Change-Id: Ib5690400e756a653c4bb3f8a5f79c77cbfc61a78
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441076
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

Bug: skia:12086
Change-Id: Icc86bcbd21b4a4eb61695a9d19a3453d823ec39f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441302
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-08-23 16:17:50 +00:00
Brian Salomon
c7e0f19c36 Move FP function writing to GrGLSLProgramBuilder.
It was in GrGLSLFPFragmentBuilder and the recursive
step for children was in GrFragmentProcessor::ProgramImpl.

Change name mangling to create suffix on each mangle request.

Remove class GrGLSLProgramBuilder::AutoStageAdvance, combine into
GrGLSLProgramBuilder::reset() and rename to advanceStage(). Presumably
in the past the class did something in its destructor but no more.

Variable name mangling is slightly different than before. Trivially
instead of appending "_Stage0" we append "_S0" for the GP and similar
through the root FPs and XP. Also, previously the first root FP would
would get "_Stage1_c0". Now it gets just "_S1". It's first child, if it
has one, gets "_S1_c0", it's second child "_S1_c1". In other words,
appending "_c<i>" begins with the children of root FPs rather than the
root FPs themselves. All the tracking of stage/substage indices and name
mangling string is now private to GrGLSLProgramBuilder.

Bug: skia:12182
Change-Id: I03ce236b79abc9523fef6557ca575abfa847ed73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441300
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 16:01:44 +00:00
John Stiles
368166262a Add trunc/round/roundEven SKSL ES3 public APIs.
Improved tests caught a longstanding bug in the compile-time
optimization logic for round/roundEven. These would *always* round to an
even number even when it didn't make sense to do so. (e.g. 3.1 would
round to 4.)

RoundEven isn't available in lower shader models of Direct3D;
SPIRV-Cross throws if it's unavailable. We may need a caps bit for this.

Change-Id: I3cc50238a2116b8d4e2c4059730d8b5cfb2bb056
Bug: skia:12022, skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441078
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-23 15:44:15 +00:00
Brian Osman
0f7c10ef56 Add sRGB 8888 colortype
A color type that linearizes just after loading, and re-encodes to sRGB
just before storing, mimicking the GPU formats that work the same way.

Notes:
  - No mipmap support
  - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
  - Needs better testing

This is a re-creation of reviews.skia.org/392990

Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-23 15:14:41 +00:00
Brian Osman
1432816147 Roll SPIRV-Cross
Includes ~10 months of updates, including some key fixes
for bugs around certain intrinsics.

Change-Id: I6c44be36bf53bdc10bea8c5540f0cb2bcbe9cd92
Bug: skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441303
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-23 14:49:49 +00:00
John Stiles
7253a201a3 Improve error-checking during array-size conversion.
The fuzzer noticed insufficient guards in IndexExpression::Convert when
converting an array size from an IntLiteral to a SKSL_INT. We had code
in IRGenerator which did this properly, so I moved our array-size
conversion logic into SkSLType and had IndexExpression share it.

Also, a variety of tests around similar error conditions were added.

Change-Id: I51529dea25f9029f81ae236511610069d66be29f
Bug: oss-fuzz:37462
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441236
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 14:35:00 +00:00
John Stiles
8f633ef2b5 Fix assertion discovered by fuzzer.
We now stop processing a var-declaration if its array-size expression is
invalid. Previously, we'd pass a null array-size expression into
convertVar, which would assert (but would fail cleanly afterwards).

Change-Id: I976f3326e32afbc7045a86d73c0dcb28f418a6f4
Bug: oss-fuzz:37457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441079
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 14:23:46 +00:00
Kevin Lubick
e312532442 [fuzzer] Add docs about oss-fuzz dashboard and coverage report
Change-Id: I2ef9ee10a4e3b9c0c250b5ad2c6c99f9415b37db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441098
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-23 13:05:39 +00:00
Kevin Lubick
9ad7874d42 [fuzzer] Add docs about testing oss-fuzz locally.
Change-Id: Ib1e94b3924ece8b249a42a5c25daf771132e534a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441058
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-23 11:40:35 +00:00
skia-autoroll
2f0debc807 Roll ANGLE from 54e311162ff3 to 8c05fd4fe56a (14 revisions)
54e311162f..8c05fd4fe5

2021-08-22 lexa.knyazev@gmail.com Add ASTC & PVRTC to GLenumToString
2021-08-21 jmadill@chromium.org Capture/Replay: Init shader outputs during self-tests.
2021-08-21 jmadill@chromium.org translator: Fix InitializeVariables with gl_ClipDistance.
2021-08-20 jmadill@chromium.org infra: Update Milo perf short names.
2021-08-20 jmadill@chromium.org infra: Update angle_mb_config.pyl with new perf names.
2021-08-20 angle-autoroll@skia-public.iam.gserviceaccount.com Roll Chromium from 40a15381a86b to 873a11ee2df8 (930 revisions)
2021-08-20 jmadill@chromium.org infra: Make perf builders GPU-config-specific.
2021-08-20 jmadill@chromium.org Add EGL extension to create window with a swap interval set.
2021-08-20 jmadill@chromium.org Test Runner: Determine slow tests from test expectations.
2021-08-20 jmadill@chromium.org Ensure RGB10A2 format properly uses 4 pixel bytes.
2021-08-20 geofflang@google.com GL: Update VertexArrayGL to use ANGLE_GL_TRY.
2021-08-20 jmadill@chromium.org Capture/Replay: Don't access OOB in TexImage2D.
2021-08-20 gert.wollny@collabora.com Capture/Replay: Add the layer to the texture data label string
2021-08-20 angle-autoroll@skia-public.iam.gserviceaccount.com Roll vulkan-deps from 4a1a688a34d6 to 1dec6c3c106b (3 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 herb@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry
To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry

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/main/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: herb@google.com
Test: Test: ClipDistanceTest.ThreeClipDistancesRedeclared
Test: Test: TextureUploadFormatTest
Test: Test: TexureUploadFormatTest
Change-Id: I9c4fcc25dfbfdaa07ce9a0c47a326b2c91fc18de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441256
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-08-23 05:29:14 +00:00
skia-autoroll
f3812a3eb5 Roll Dawn from bd45466c6d4c to dd1a5b3ad3e0 (2 revisions)
https://dawn.googlesource.com/dawn.git/+log/bd45466c6d4c..dd1a5b3ad3e0

2021-08-21 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from f6a49d69b4bf to 1fa6f5ce9ba8 (1 revision)
2021-08-20 dawn-autoroll@skia-public.iam.gserviceaccount.com Roll Tint from d47a7ef0cf0c to f6a49d69b4bf (1 revision)

Also rolling transitive DEPS:
  https://dawn.googlesource.com/tint from d47a7ef0cf0c to 1fa6f5ce9ba8

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 alanbaker@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dawn: https://bugs.chromium.org/p/dawn/issues/entry
To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry

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/main/autoroll/README.md

Cq-Include-Trybots: skia/skia.primary:Build-Debian10-Clang-x86_64-Debug-Dawn
Bug: None
Tbr: alanbaker@google.com
Change-Id: Ide5f73bdb105b48f28732cf88ef04e7ddea6296c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441257
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-08-23 04:51:18 +00:00
skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com
6b335c53e8 Update SKP version
Automatic commit by the RecreateSKPs bot.

Change-Id: I4cd99eb32fb81b7dada739840490efb7d1617933
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441177
Reviewed-by: skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com <skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com>
Commit-Queue: skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com <skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com>
2021-08-22 09:01:45 +00:00
skia-autoroll
ab6c8725fb Roll SK Tool from 32db94dfd0b8 to 36d308a1e51f
https://skia.googlesource.com/buildbot.git/+log/32db94dfd0b8..36d308a1e51f

2021-08-22 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update CIPD Packages

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

To file a bug in Skia: https://bugs.chromium.org/p/skia/issues/entry

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/main/autoroll/README.md

Tbr: borenet@google.com
Change-Id: I8a750640973e5044b12dd7869bdc5c1524d2d539
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441196
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2021-08-22 07:06:14 +00:00
Jim Van Verth
51e33b5154 Revert "Metal: Use StoreAndResolve store action when possible."
This reverts commit a7f9d8c2b1.

Reason for revert: Flutter build

Original change's description:
> Metal: Use StoreAndResolve store action when possible.
>
> This is a step towards using memoryless MSAA attachments, and
> discardable resolve. As we're currently doing a Store, Load, and then
> Resolve, this at least saves us the Load.  We may fall back to this mode
> if the resolve target is framebufferOnly and hence we can't use it as
> an input attachment.
>
> Bug: skia:12086
> Change-Id: Ib5690400e756a653c4bb3f8a5f79c77cbfc61a78
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441076
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ibde0fb51afd0e7c5f1c8591390091cfb23f6a418
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12086
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441137
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-08-20 23:17:07 +00:00
Corentin Wallez
461c0eb9e7 Update deprecated wgpu:: structures.
Bug: dawn:22
Change-Id: I0428b7e6a3d678b606a4e51a43a573d5c31172d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440996
Commit-Queue: Stephen White <senorblanco@google.com>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@google.com>
2021-08-20 22:29:56 +00:00
John Stiles
931d226827 Require generation to be GLSL 3.30 in GrShaderCaps::supportsSkSLES3().
Real devices exist which support derivatives, non-square matrices, and
unsigned integers, but do not support all of ES3. On our tree,
ChromeOS-Clang-Sparky360-GPU-IntelUHDGraphics605-x86_64 meets this
criteria.

Change-Id: I6ae438c8cde291ca834f61700463a2df55705cb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441077
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-08-20 21:04:43 +00:00
Jim Van Verth
a7f9d8c2b1 Metal: Use StoreAndResolve store action when possible.
This is a step towards using memoryless MSAA attachments, and
discardable resolve. As we're currently doing a Store, Load, and then
Resolve, this at least saves us the Load.  We may fall back to this mode
if the resolve target is framebufferOnly and hence we can't use it as
an input attachment.

Bug: skia:12086
Change-Id: Ib5690400e756a653c4bb3f8a5f79c77cbfc61a78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441076
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-20 20:58:17 +00:00
Mike Reed
95c9734bac Reland "In SkCanvas destructor, discard (rather than blit) unbalanced layers"
This is a reland of 879b2f2e6e

Now includes a test that demonstrates the bug found by Chrome's fuzzers,
and a different (safer) implementation.

Original change's description:
> In SkCanvas destructor, discard (rather than blit) unbalanced layers
>
> Bug: skia:12267
> Change-Id: I6808f62b2385a3466b1a93db905041a6529f58cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433360
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Florin Malita <fmalita@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

Bug: skia:12267
Change-Id: Ide7dc61b054761826faa5bca3eec6be2fc63c83a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440977
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-20 19:35:57 +00:00
Joe Gregorio
edad81e7c5 The Debian10 bots in the skolo are now 10.10 instead of 10.3.
Change-Id: Ic11c25f8d2ca844c7b52384805df5454819ba6d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441061
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2021-08-20 19:29:12 +00:00