Commit Graph

9757 Commits

Author SHA1 Message Date
John Stiles
307f8f525a Simplify the boilerplate of cloning a fragment processor.
GrFragmentProcessor now provides an (explicit) copy constructor which
clones all child processors and flags from the passed-in FP. Since we no
longer have flags which propagate up to the root node of the FP tree,
all flags are now safe to copy, since a cloned FP also clones all of its
children.

Change-Id: Ia9f80e0ec540ed1056d25dbb1861a174a1d55f4b
Bug: skia:12299
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437836
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-09 20:36:14 +00:00
Michael Ludwig
e1d0040c54 Delete GrClipStackClip and GrReducedClip
Bug: skia:10205
Change-Id: Iafee804751d69e98241a7825664f3be04b20eb14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436566
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-09 18:53:58 +00:00
Brian Salomon
3176e868c4 Rename GrGLSLFragmentProcessor to GrFragmentProcessor::ProgramImpl
Bug: skia:11358

Change-Id: Ic179ddd9d52dca3fc0bd85b61db49097390b7f58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437681
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-09 17:43:59 +00:00
Mike Reed
22cada0a38 Clean up unflattening paints
Attempting reland after breaking G3
-- fixed by updating layerdrawlooper

Change-Id: I9013baae4ff2acad2040741ba53188d616f2920c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437679
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-08-09 17:43:37 +00:00
William Hesse
3c2461126b Fix rMoveTo to be relative to the start of a closed path
Other relative PathOps were fixed in
https://chromiumcodereview.appspot.com/22681006/

Fiddle: https://fiddle.skia.org/c/58ab5cfea29432c432ea7b467c1266ac
Bug: skia:1474
Change-Id: I6c3381087c81b2c28030c8158f5fa5662e5bfa7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436477
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-09 14:59:14 +00:00
Robert Phillips
f76768d73c Revert "Clean up unflattening paints"
This reverts commit 717ef9472b.

Reason for revert: Blocking the G3 roll

Original change's description:
> Clean up unflattening paints
>
> Just removing legacy cruft for fonts, and also change to return by
> value (cleaner).
>
> Change-Id: If120931119c32542e06801da2b6d60ba84ba2186
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437676
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=bungeman@google.com,fmalita@chromium.org,reed@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: If735d0212412c0262a6ccb52e7dd224a255906cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437678
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-09 14:06:25 +00:00
Brian Salomon
13b287386a Remove GLSL from name of functions that builds GrProcessor keys.
Bug: skia:11358
Change-Id: Ie70e45b18c12126c8e86700ad1040bc319be385a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436998
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-09 14:01:13 +00:00
Mike Reed
717ef9472b Clean up unflattening paints
Just removing legacy cruft for fonts, and also change to return by
value (cleaner).

Change-Id: If120931119c32542e06801da2b6d60ba84ba2186
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437676
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-08-09 13:26:22 +00:00
Michael Ludwig
a0438e6604 Remove SK_SUPPORT_DEPRECATED_CLIPOPS and expanding clip op defs
Bug: skia:10209
Change-Id: I72639b7e768742dcdec810a5a714ce21ff0f6e0a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436565
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-06 19:15:13 +00:00
Ethan Nicholas
a40ddcd63d Pass dsl::PositionInfo by value
We were previously using a mix of pass-by-value and pass-by-pointer (to
allow for explicitly null PositionInfo). Being able to pass a null
PositionInfo didn't really add much, since we can just use a nullary-
constructor PositionInfo instead, so these have all been migrated to
by-value.

Change-Id: Ia31e252cac94f64c4b38c29a54e6e7f752e70672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437276
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-06 18:10:41 +00:00
Michael Ludwig
a3a67ae303 Reland "Avoid expanding clip ops in tests that will remain after feature removal"
This reverts commit b942d4b436.

Reason for revert: dependent cl no longer blocking android roll, so 
this can be relanded.

Original change's description:
> Revert "Avoid expanding clip ops in tests that will remain after feature removal"
>
> This reverts commit d1c51b2572.
>
> Reason for revert: blocking revert that might be breaking android
>
> Original change's description:
> > Avoid expanding clip ops in tests that will remain after feature removal
> >
> > Bug: skia:10208
> > Change-Id: I4fb2c8181bfb8cac3c8ab95c833094c98f8ee6fc
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436159
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ib62cc03f99793f8f1cb0180145b7557101a23ead
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10208
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436957
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Bug: skia:10208
Change-Id: Iff6e5b2b245426a76b92e895434613fe16ba717c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437277
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-06 17:07:31 +00:00
Michael Ludwig
d59d3e179d Reland "Add SkClipStack::replaceClip() separate from deprecated clip op"
This reverts commit 8ba1e71a1f.

Reason for revert: had missed a few places where GrReducedClip needed to
use the equivalent region op, not skClipOp + replace bool.

TBR=robertphillips@google.com,brianosman@google.com,csmartdalton@google.com

Original change's description:
> Revert "Add SkClipStack::replaceClip() separate from deprecated clip op"
>
> This reverts commit 68587ae274.
>
> Reason for revert: breaking path clipping tests in Android?
>
> Original change's description:
> > Add SkClipStack::replaceClip() separate from deprecated clip op
> >
> > The replaceClip functionality was added to allow Android to move off of
> > generalized expanding clips. At the time, SkClipStack simply used the
> > kReplace_SkClipOp to handle it. In order to remove those expanding ops,
> > SkClipStack will need a proper implementation of replaceClip().
> >
> > The clip elements have an additional field to mark if
> > it's a replace (and it's op will be kIntersect). Adds a temporary
> > getRegionOp() function to unify elements that use this field vs.
> > elements that use the deprecated clip op (i.e. if they were deserialized
> > from an SKP that recorded an expanding op).
> >
> > Clients of SkClipOp that checked for replace ops use the new function
> > instead of referring to the enum value directly.
> >
> > Bug: skia:10209
> > Change-Id: I1c16c87fadb2becfe181db717c05e240ac87fd34
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436158
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
>
> TBR=robertphillips@google.com,brianosman@google.com,csmartdalton@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: If3f99a7d2f2df99c2b99d431d494ca28da66b1d8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10209
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436956
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Bug: skia:10209
Change-Id: I9feb0f3571ec26580bcdf0fe541f43f2ee8cf8d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436959
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-06 14:44:39 +00:00
Mike Reed
09746be8de Set SkPath.fLastMoveToIndex field from SkPathBuilder
This is a "legacy" field in SkPath, and only needed for editing the
path (in funny cases, such as a relative verb or missing moveto).
When we finally make SkPath immutable, we won't need this field at all.

Note: this CL "fixes" the last 2 columns in path_append_extend gm.
They should appear the same as the previous 2 columns.

Change-Id: Ia5f2e8ec586b5f5189fc3ac2cd513fe89d31cd22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436958
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-08-06 14:12:11 +00:00
John Stiles
2195f94a0c Add unit test for array narrowing conversions.
Change-Id: Ibadda2a10e19984c7a0efb66fd3187f280666445
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436996
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-06 13:05:35 +00:00
John Stiles
e3f85e07fa Add improved regression test for oss-fuzz:36655.
Most of the code generated by the fuzzer is nonsense, but there is a
method to its madness. The crash is only triggered under specific
conditions:
- The runtime effect has enough helper functions to mostly fill up the
  call graph hash-map. It won't rehash until it gets close to capacity.
- There must be several calls to built-in functions, in order to add
  elements to the call graph to force a rehash.

The fuzzer-generated code manages to satisfy both these requirements.

Change-Id: I9a1d7535557fedd4e9bfece3930ac86ede291ffe
Bug: oss-fuzz:36655
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437118
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-06 13:03:32 +00:00
John Stiles
e3ae968f5f Enable comparison of arrays of different precision types.
GLSL allows an array of `lowp float` to be compared against `highp
float` seamlessly because the types are considered to be the same. SkSL,
however, treats these as different types, so we need to coerce the types
to allow this comparison to work.

In other words, these comparisons can cause an array to be implicitly
casted. The expression `myHalf2Array == float[2](a, b)` should be
allowed when narrowing conversions are enabled. To allow this to work,
we need a dedicated IR node representing this type coercion.

We now allow implicit coercion of array types when the array's component
types would be implicitly coercible, and have a new IR node representing
that implicit conversion.

This CL fixes array comparisons, but array assignment needs additional
fixes. It currently results in:
    "type mismatch: '=' cannot operate on (types)".

Bug: skia:12248
Change-Id: I99062486c081f748f65be4b36a3a52e95b559812
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436571
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-06 12:57:10 +00:00
Robert Phillips
7386dc7941 Ensure default SkPaints w/ dither don't get dithered
Skipping dithering of const paints was originally added in:

https://skia-review.googlesource.com/c/skia/+/19880/

Change-Id: Icebca1c3ef779bb103030deac12621619f5ce248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437116
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-05 22:04:28 +00:00
John Stiles
9ae6ea0711 Fix fuzzer-discovered error with swizzling matrices.
The optimization logic for swizzling a constructor assumed that every
argument to the constructor was a scalar or vector. When it was written,
this assumption was true. However, we recently added support for casting
mat2x2 to float4 which violates the assumption.

We now check every argument and do not attempt to optimize if a
non-scalar, non-vector arg is found.

Change-Id: Ia2b297bd62dfdf4af56712164fbc80c29c9611eb
Bug: oss-fuzz:36852
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437017
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-05 21:59:23 +00:00
John Stiles
ded41aafb2 Fix fuzzer-discovered error with SPIR-V interface arrays.
OSSFuzz discovered a minor variation of oss-fuzz:36770 which tickled a
different bug in SPIR-V RTFlip handling; we did not properly handle the
case where the InterfaceBlock is an array. SPIR-V does not support this
at all, but the IRGenerator allows it, and we don't detect it an an
error until later in the compilation process.

Change-Id: I80bd67a13dad878717dc122462132a2ed675532d
Bug: oss-fuzz:36850
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437018
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-05 21:44:16 +00:00
John Stiles
628777c9ed Fix cases of variable shadowing in SkSL.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: Ic582c59b9f7dfee2d7e90e50bfb36c57e958c673
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436641
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-05 21:39:12 +00:00
Michael Ludwig
8ba1e71a1f Revert "Add SkClipStack::replaceClip() separate from deprecated clip op"
This reverts commit 68587ae274.

Reason for revert: breaking path clipping tests in Android?

Original change's description:
> Add SkClipStack::replaceClip() separate from deprecated clip op
>
> The replaceClip functionality was added to allow Android to move off of
> generalized expanding clips. At the time, SkClipStack simply used the
> kReplace_SkClipOp to handle it. In order to remove those expanding ops,
> SkClipStack will need a proper implementation of replaceClip().
>
> The clip elements have an additional field to mark if
> it's a replace (and it's op will be kIntersect). Adds a temporary
> getRegionOp() function to unify elements that use this field vs.
> elements that use the deprecated clip op (i.e. if they were deserialized
> from an SKP that recorded an expanding op).
>
> Clients of SkClipOp that checked for replace ops use the new function
> instead of referring to the enum value directly.
>
> Bug: skia:10209
> Change-Id: I1c16c87fadb2becfe181db717c05e240ac87fd34
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436158
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>

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

Change-Id: If3f99a7d2f2df99c2b99d431d494ca28da66b1d8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436956
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-05 14:47:41 +00:00
Michael Ludwig
b942d4b436 Revert "Avoid expanding clip ops in tests that will remain after feature removal"
This reverts commit d1c51b2572.

Reason for revert: blocking revert that might be breaking android

Original change's description:
> Avoid expanding clip ops in tests that will remain after feature removal
>
> Bug: skia:10208
> Change-Id: I4fb2c8181bfb8cac3c8ab95c833094c98f8ee6fc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436159
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ib62cc03f99793f8f1cb0180145b7557101a23ead
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10208
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436957
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-05 14:46:42 +00:00
Derek Sollenberger
337e484839 Revert "Reland "uniform Ptr (UPtr) is a sub class of Ptr""
This reverts commit ea17e2499d.

Reason for revert: blocking the android roll on a build failure

Original change's description:
> Reland "uniform Ptr (UPtr) is a sub class of Ptr"
>
> This is a reland of cef047a490
>
> Fix strides in SkVMTest to be the right size.
>
> Original change's description:
> > uniform Ptr (UPtr) is a sub class of Ptr
> >
> > A pointer for a Uniform (UPtr) is a sub type of a Ptr. Everywhere you
> > can use a Ptr a UPtr will work, but you can't use Ptr where you need
> > a UPtr. All the UPtr instructions uniformF, gather32, etc are expected
> > to be hoisted and therefore loaded only once. While the varyings
> > instructions like load32, etc. are expected to remain in the body
> > of the loop, and be evaluated each time through the loop.
> >
> > Change-Id: I4fe6458c2a4614872ed67cda1e81b05ea8a9e69e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436297
> > Commit-Queue: Herb Derby <herb@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Change-Id: I858fa1224452ec801b6186fede353849edc895b5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436564
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: I0ffc93a04f5329838d422ad9e42aba09b9ba0064
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436639
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-08-05 01:11:41 +00:00
John Stiles
b806da4501 Honor lowp/mediump/highp precision qualifiers in IRGenerator.
This CL does not update the DSLParser to honor these precision
qualifiers; that will be done in a followup.

Change-Id: Ib629bc99c0e6c7afb550a381d4e3b6ccc26aa64e
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436337
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-04 21:29:10 +00:00
John Stiles
020143148f Add parser support for highp/mediump Tokens in vardecls.
These parse into new modifier bits; the IR generator does not yet
support these bits. That's coming in a followup CL.

Change-Id: I362e9227694f9b862eaad100f6afca45a9b62a01
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436336
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-04 21:11:14 +00:00
Herb Derby
ea17e2499d Reland "uniform Ptr (UPtr) is a sub class of Ptr"
This is a reland of cef047a490

Fix strides in SkVMTest to be the right size.

Original change's description:
> uniform Ptr (UPtr) is a sub class of Ptr
>
> A pointer for a Uniform (UPtr) is a sub type of a Ptr. Everywhere you
> can use a Ptr a UPtr will work, but you can't use Ptr where you need
> a UPtr. All the UPtr instructions uniformF, gather32, etc are expected
> to be hoisted and therefore loaded only once. While the varyings
> instructions like load32, etc. are expected to remain in the body
> of the loop, and be evaluated each time through the loop.
>
> Change-Id: I4fe6458c2a4614872ed67cda1e81b05ea8a9e69e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436297
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: I858fa1224452ec801b6186fede353849edc895b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436564
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-08-04 20:51:14 +00:00
Robert Phillips
f3868628f9 Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions (take 2)
The only really interesting parts are:
  src/gpu/SurfaceFillContext.*
  src/gpu/v1/SurfaceFillContext.*

Everything else is mostly mechanical.

TBR=michaelludwig@google.com
Bug: skia:11837
Change-Id: Ia208e9a73d1529804c06d4f805d8ca3674851496
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436558
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-04 19:40:55 +00:00
Michael Ludwig
d1c51b2572 Avoid expanding clip ops in tests that will remain after feature removal
Bug: skia:10208
Change-Id: I4fb2c8181bfb8cac3c8ab95c833094c98f8ee6fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436159
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-08-04 19:11:40 +00:00
Michael Ludwig
3b39b7f5c6 Alias canComputeFastBounds to affectsTransparentBlack
This moves SkImageFilter's API closer to SkColorFilter's, and also
updates SkRecordDraw's PaintMayAffectTransparentBlack to be less
conservative.

Originally:
-canComputeFastBounds() handled aggregating behavior of the entire graph
  but it's a public API
-affectsTransparentBlack() was the private virtual for a specific node

Now:
-affectsTransparentBlack() handles aggregating behavior of the graph and
  is part of SkImageFilter_Base (mirroring SkColorFilter_Base).
-added onAffectsTransparentBlack() to clarify the per-node virtual that
  they can override.
-canComputeFastBounds() simply returns !affectsTransparentBlack().

There are some usages in our code that I kept using canComputeFastBounds
(e.g. SkPaint's computefastBounds) because it kept naming consistent.
In other places I updated to use affectsTransparentBlack since I thought
that made it clearer why we were checking that behavior.

Bug: skia:12282
Change-Id: I7b58372c127b4d8d9097d6c0de64486e822d2342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436296
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-04 19:11:19 +00:00
John Stiles
9fdcc517b2 Write test demonstrating bug with array narrowing conversions.
We don't currently support this. There's no explicit syntax to cast an
array's type, but it can be implicitly required in some situations, like
`halfArray == floatArray` (when fAllowNarrowingConversions is on).

Change-Id: I00fe0ddd4f2682b2950e828dd78bb941d5f0430e
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436560
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-04 18:34:18 +00:00
Michael Ludwig
68587ae274 Add SkClipStack::replaceClip() separate from deprecated clip op
The replaceClip functionality was added to allow Android to move off of
generalized expanding clips. At the time, SkClipStack simply used the
kReplace_SkClipOp to handle it. In order to remove those expanding ops,
SkClipStack will need a proper implementation of replaceClip().

The clip elements have an additional field to mark if
it's a replace (and it's op will be kIntersect). Adds a temporary
getRegionOp() function to unify elements that use this field vs.
elements that use the deprecated clip op (i.e. if they were deserialized
from an SKP that recorded an expanding op).

Clients of SkClipOp that checked for replace ops use the new function
instead of referring to the enum value directly.

Bug: skia:10209
Change-Id: I1c16c87fadb2becfe181db717c05e240ac87fd34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436158
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-08-04 18:17:11 +00:00
Derek Sollenberger
b00cbc704d Revert "uniform Ptr (UPtr) is a sub class of Ptr"
This reverts commit cef047a490.

Reason for revert: DM test failures on some Windows/Linux devices

Original change's description:
> uniform Ptr (UPtr) is a sub class of Ptr
>
> A pointer for a Uniform (UPtr) is a sub type of a Ptr. Everywhere you
> can use a Ptr a UPtr will work, but you can't use Ptr where you need
> a UPtr. All the UPtr instructions uniformF, gather32, etc are expected
> to be hoisted and therefore loaded only once. While the varyings
> instructions like load32, etc. are expected to remain in the body
> of the loop, and be evaluated each time through the loop.
>
> Change-Id: I4fe6458c2a4614872ed67cda1e81b05ea8a9e69e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436297
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I785973be1493643e7d5a3da482bc4ab07d186865
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436559
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-08-04 17:26:34 +00:00
Derek Sollenberger
40b82c6b5c Revert "Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions"
This reverts commit af844c79d5.

Reason for revert: breaking chrome roller

Original change's description:
> Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions
>
> The only really interesting parts are:
>   src/gpu/SurfaceFillContext.*
>   src/gpu/v1/SurfaceFillContext.*
>
> Everything else is mostly mechanical.
>
> Bug: skia:11837
> Change-Id: If2945f30dadd6ad0cccf6ff2b53e4a92b1dc6cbc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436099
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I3b2d1d4a30e253a107f55dc3c5ecaaee5386e6e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436557
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-08-04 17:15:45 +00:00
Herb Derby
cef047a490 uniform Ptr (UPtr) is a sub class of Ptr
A pointer for a Uniform (UPtr) is a sub type of a Ptr. Everywhere you
can use a Ptr a UPtr will work, but you can't use Ptr where you need
a UPtr. All the UPtr instructions uniformF, gather32, etc are expected
to be hoisted and therefore loaded only once. While the varyings
instructions like load32, etc. are expected to remain in the body
of the loop, and be evaluated each time through the loop.

Change-Id: I4fe6458c2a4614872ed67cda1e81b05ea8a9e69e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436297
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-04 16:00:10 +00:00
Robert Phillips
af844c79d5 Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions
The only really interesting parts are:
  src/gpu/SurfaceFillContext.*
  src/gpu/v1/SurfaceFillContext.*

Everything else is mostly mechanical.

Bug: skia:11837
Change-Id: If2945f30dadd6ad0cccf6ff2b53e4a92b1dc6cbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436099
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-04 14:30:10 +00:00
John Stiles
68f5606831 Fix cases of variable shadowing in rasterization.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: I169ff3bac8517869132297c8e98bd9bd4248a349
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436100
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-08-03 19:00:58 +00:00
Michael Ludwig
2f6e2f8410 Use SkClipOp::kFoo instead of kFoo_SkClipOp from SkClipOpPriv
The SkClipOpPriv.h header will be going away soon, but a number of
places still use its kIntersect_SkClipOp definitions instead of the
equivalent SkClipOp::kIntersect. Besides updating these references,
a number of unnecessary includes to SkClipOpPriv.h are removed and
some test cases exercising expanding clip ops are deleted since they
will be unnecessary shortly.

Bug: skia:10208
Change-Id: I2bbdd6bb39869134c6a80ef2b4482e6cabdeb0b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436157
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-03 18:08:21 +00:00
John Stiles
e9dcbfdaa1 Add test for Runtime Effects and narrowing conversions.
This code intentionally mixes half4s and float4s everywhere. Before
http://review.skia.org/435916 landed, this resulted in a compile error.

Change-Id: I852fef6ee99a8b78623e0e9ddeee2ad84a8c0504
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436058
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-03 15:58:46 +00:00
Robert Phillips
a3f206e0b8 Non-substantive changes for making v1::SurfaceDrawContext V1-only
Bug: skia:11837
Change-Id: I60112e370c95e6f9d9bc12cb9b05d40dd2220bc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435279
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-02 19:22:58 +00:00
Brian Salomon
66b500a07c Remove explicit sample flag from GrFP.
Instead expand the map that is computed by GrGLSLGP to include a bool
that indicates whether each FP requires coords or not.

Now GrGLSLGP is solely responsible for determining which FPs take coords
and inserting any varyings. The rest of the system follows its lead when
generating FP functions and call sites.

Bug: skia:12198

Change-Id: I3471867fb64e94c7775c0b6209998159abeb6714
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435018
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-02 17:41:45 +00:00
John Stiles
d7437eec2e Fix for fuzzer-discovered error in SPIR-V with RTFlip.
SPIR-V code generation synthesizes some extra variables that don't
actually exist in the Program. Checking the ProgramUsage of these
variables would fail; ProgramUsage::get doesn't know about these
variables, so it asserts (and would consider them as dead even if it
didn't assert). We now track our SPIR-V bonus variables in a separate
set, and always report them as live.

Change-Id: If2f681470654025abf7ca4b3ec8126de2eb01297
Bug: oss-fuzz:36770
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435625
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-02 17:13:50 +00:00
Robert Phillips
33bf2b56f9 Pipe all SDC creation through the recording context
In the new GrSurfaceContext class hierarchy we can get either a v1 or v2 SFC/SDC depending on the context options setting.

Bug: skia:11837
Change-Id: Ia25bc10b58bbbaf65a484b323d9d0eee471bb7ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435276
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-02 16:04:52 +00:00
Brian Salomon
2957885548 Reland "Fix check in GrGLGpu for whether PBO 0 is bound"
This is a reland of 62d42db282

Check for PBO support before binding PBO 0.

Original change's description:
> Fix check in GrGLGpu for whether PBO 0 is bound
>
> Found in OOP-R canvas in Chrome. Most likely async read followed by
> sync read with an intervening resetContext().
>
> Bug: chromium:1208212
>
> Change-Id: Ibf85f070d0a4cd389f67e9b249655b0ef667c66e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435277
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

Bug: chromium:1208212
Change-Id: I0da48fa9a1f31ec15827f9bef980e9d5a7d70d26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435622
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-02 15:06:04 +00:00
Brian Salomon
751de92cf1 Revert "Fix check in GrGLGpu for whether PBO 0 is bound"
This reverts commit 62d42db282.

Reason for revert: d3d9 angle tests failing

Original change's description:
> Fix check in GrGLGpu for whether PBO 0 is bound
>
> Found in OOP-R canvas in Chrome. Most likely async read followed by
> sync read with an intervening resetContext().
>
> Bug: chromium:1208212
>
> Change-Id: Ibf85f070d0a4cd389f67e9b249655b0ef667c66e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435277
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: chromium:1208212
Change-Id: I85c89a4d0dd63aaafd80d7572c5643cfa547498b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435617
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-02 13:59:19 +00:00
Brian Salomon
62d42db282 Fix check in GrGLGpu for whether PBO 0 is bound
Found in OOP-R canvas in Chrome. Most likely async read followed by
sync read with an intervening resetContext().

Bug: chromium:1208212

Change-Id: Ibf85f070d0a4cd389f67e9b249655b0ef667c66e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435277
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-07-30 22:38:47 +00:00
John Stiles
ce9a5c953d Allow sampling from SkBlenders.
Runtime shaders, color filters, and blenders are all able to sample from
a blender. These use the blend-function signature; both a src-color and
dst-color must be passed to sample. i.e.: sample(blender, s, d)

Change-Id: I3738e6b0b4af6d1d79e62ca1815c80d6a1ae9d6f
Bug: skia:12257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432056
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-30 16:41:54 +00:00
Robert Phillips
1a2e7de8ea Update tests for a V1-only skgpu::v1::SurfaceDrawContext
Bug: skia:11837
Change-Id: If8dd864d6cd8bc5ab9569fbab40866e1810dbc27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434162
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-30 16:33:41 +00:00
John Stiles
131410a7d1 Add regression test for oss-fuzz:36655.
Change-Id: I7b53df1eae83a596c4d1f3620e7f9bd146f68af2
Bug: oss-fuzz:36655
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434465
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-29 15:22:20 +00:00
Brian Osman
7fd83ebd39 Fix SkTLList::popTail
Change-Id: Id3e4d10456be6e0e0329600f05641034f3ffdb8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434336
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-07-28 20:23:38 +00:00
Robert Phillips
4dca83162b Rename GrSurfaceDrawContext to skgpu::v1::SurfaceDrawContext
This CL is mostly mechanical. It:

replaces "src/gpu/GrSurfaceDrawContext.h" #includes with
         "src/gpu/v1/SurfaceDrawContext_v1.h" and reorders

replaces "class GrSurfaceDrawContext;" with
         "namespace skgpu { namespace v1 { class SurfaceDrawContext; }}"

replaces "GrSurfaceDrawContext*" with "auto" where possible
replaces "rtc" with "sdc"
replaces "surfaceDrawContext" with "sdc"
replaces GrSurfaceDrawContext with skgpu::v1::SurfaceDrawContext
reflows parameters as needed

This CL does not try to:

make skgpu::v1::SurfaceDrawContext V1-only
minimize the skgpu and/or skgpu::v1 prefixes

Those two tasks will be accomplished in follow up CLs. This CL is just trying to get the bulk of the mechanical changes comprehensibly landed.

Bug: skia:11837
Change-Id: I6fe59080249d585df8f5d27c6b67569cdc35842f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-28 20:12:10 +00:00