Commit Graph

2000 Commits

Author SHA1 Message Date
Michael Ludwig
66470f8b7d Pre-construct device-to-layer matrix for skif::Mappings
SkCanvas and SkDevice were using SkM44 and its definition of invert(),
but it was slightly more generous than SkMatrix::invert() so the fuzzer
caught a case where the layer's SkDevice had a valid transform but then
converting it to a SkMatrix in skif::Mapping was no longer invertible.

This modifies it so that skif::Mapping no longer tries to invert the
matrices. In almost all cases, the inverse of the layer-to-device
matrix can be constructed directly from a matrix multiply (that's what
device->getRelativeTransform() does). When the matrices are
ill-conditioned the constructed inverse may be inaccurate (hence why
SkMatrix::invert reports false), but in practice this happens for
ridiculously large transforms and the error isn't significant compared
to the precision range of the matrices anyways.

Other cases explicitly want to use the identity matrix for the layer
to device matrix, so I added a helper in the few places that would have
had to pass SkMatrix::I() twice instead.

The last case is drawImage() that creates its own skif::Mapping, now it
just calculates the inverse that skif::Mapping() would have done and if
it fails it drops the draw since it means the canvas matrix is bad.

Bug: chromium:1276525
Change-Id: Ib516bb2fac19d5e7397bd27d80f8e3932b25b2e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509396
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-16 16:26:40 +00:00
Brian Osman
cd189e8a1d Remove default/deprecated arguments to makeShader calls
Bug: skia:12643
Change-Id: I37e1718a20283dfb814c85260257d57bac2b7b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506211
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2022-02-09 20:41:23 +00:00
Michael Ludwig
220702dac0 Track min required segments in PatchWriter
Also handles automatically chopping curves to reach the maximum segments
allowed for the PatchWriter.

Change-Id: Iba817e817dd270d170d305c1256cf9aec7b803d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502056
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-08 16:30:26 +00:00
Michael Ludwig
f85d177016 Update PatchWriter API to writeFoo instead of << Foo
Change-Id: Iee54fd52b9ac291c82cfd9ce3a0876ee6c1f972a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502787
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-07 21:26:39 +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
Michael Ludwig
3518875c21 Avoid RAII wrappers around PatchWriter
Instead of CubicPatch(writer) << control points ... code now writes
writer << Cubic(controlPoints). The main benefit of this is that the
control points are available to the PatchWriter. This allows it (in
follow up CLs) to automatically chop the curves and track the last join
control point.

Change-Id: I38b57a141261afd42e511cc195eb5e64a2382263
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501837
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-02-03 02:30:52 +00:00
Ben Wagner
668995122f Fix when a glyph has a path
Always call generateMetrics before generatePath so that generateMetrics
can determine which glyph representation to use and if that glyph
representation can be modeled as a path.

Pass an allocator into generateMetrics so that it can set the path to
not existing. This allows generatePath to continue to work as it used
to, creating a path if any path is available. However, generateMetrics
may first set the path to not existing.

Update getPath and internalGetPath to use the path on the glyph if it
has already been set. Update makeGlyph and internalMakeGlyph to always
call generateMetrics first (which is now more like initGlyph).

Update the SkGlyph::PathData to indicate that it is a dev-path and not a
user-path. A user-path will have effects applied to it. A dev-path is
always a resolved path which is always filled -- unless it is hairline.

Update everything else for the knock on effects and to take advantage of
this information.

Bug: chromium:1266022
Change-Id: Id3f3cf5a534ab99f3a5779c910c1d1e191e68b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478658
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-12-07 14:58:29 +00:00
Chris Dalton
09ece934af Move breadcrumb and inner-fan triangles out of PathCurveTessellator
The callsites output these triangles now. This removes the final
direct Ganesh dependency from the tessellator code.

Bug: skia:12524
Change-Id: Id0d16839ed35a2bd9a812b8747ca8669fac5bed8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470196
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-12 15:26:51 +00:00
Chris Dalton
f0f447c2f0 Yank GrPathTessellationShader out of PatchTessellators
The tessellators are now agnostic of the shader class, which makes
them mostly usable by Graphite now. Also moves the code for writing
the middle-out vertex and index buffers into the PatchTessellators,
which makes sense since they also write the instance buffers.

Bug: skia:12524
Change-Id: I6c415645e389e056c0db1d93663b1b295d6b4535
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469631
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-11-11 22:28:40 +00:00
Chris Dalton
08a971126e Reland "Implement batching for convex tessellated paths"
This is a reland of 9613060bdf

Original change's description:
> Implement batching for convex tessellated paths
>
> Moves the view matrix transformation onto the CPU (when local coords
> are not used), and plumbs a color attrib through the tessellation
> patches.
>
> Bug: skia:12524
> Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Bug: skia:12524
Change-Id: I77cd079d8921b224925bd2f7364c564822886d61
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470436
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-11-11 20:01:40 +00:00
Robert Phillips
954e81a170 Revert "Implement batching for convex tessellated paths"
This reverts commit 9613060bdf.

Reason for revert: assertion failure on ANGLE

Original change's description:
> Implement batching for convex tessellated paths
>
> Moves the view matrix transformation onto the CPU (when local coords
> are not used), and plumbs a color attrib through the tessellation
> patches.
>
> Bug: skia:12524
> Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: Ie086376656777bb167075a9822d8c702cc7e41ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12524
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470296
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-11 13:30:09 +00:00
Chris Dalton
9613060bdf Implement batching for convex tessellated paths
Moves the view matrix transformation onto the CPU (when local coords
are not used), and plumbs a color attrib through the tessellation
patches.

Bug: skia:12524
Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-11-11 00:34:00 +00:00
Chris Dalton
6bb17ab48d Reland "Lift recursive curve culling out of tessellators"
This is a reland of 75e1f4c028

Original change's description:
> Lift recursive curve culling out of tessellators
>
> We need recursive chopping/culling logic in order to draw
> astronomically large paths. But rather than do that at the same time
> the tessellators chop curves, this CL moves that logic into an
> SkPath -> SkPath transformation that runs ahead of time (and only if
> the path is extremely large to begin with). This will enable us to
> remove recursion from the tessellators and quickly determine ahead of
> time the size of buffers they need.
>
> Bug: skia:12524
> Change-Id: Ib2800fb23054f1548501811203173e58273fbc83
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

Bug: skia:12524
Change-Id: Idf54f0c2bddaaddc9fc17bee99c910f3961682a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465361
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-29 21:59:30 +00:00
Greg Daniel
5f132753ec Revert "Lift recursive curve culling out of tessellators"
This reverts commit 75e1f4c028.

Reason for revert: need to revert parent CL

Original change's description:
> Lift recursive curve culling out of tessellators
>
> We need recursive chopping/culling logic in order to draw
> astronomically large paths. But rather than do that at the same time
> the tessellators chop curves, this CL moves that logic into an
> SkPath -> SkPath transformation that runs ahead of time (and only if
> the path is extremely large to begin with). This will enable us to
> remove recursion from the tessellators and quickly determine ahead of
> time the size of buffers they need.
>
> Bug: skia:12524
> Change-Id: Ib2800fb23054f1548501811203173e58273fbc83
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

Bug: skia:12524
Change-Id: Ib075e8398767fd7b9f49e50ecee98ce47a2ad6b1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464296
Auto-Submit: Greg Daniel <egdaniel@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-27 17:22:59 +00:00
Chris Dalton
75e1f4c028 Lift recursive curve culling out of tessellators
We need recursive chopping/culling logic in order to draw
astronomically large paths. But rather than do that at the same time
the tessellators chop curves, this CL moves that logic into an
SkPath -> SkPath transformation that runs ahead of time (and only if
the path is extremely large to begin with). This will enable us to
remove recursion from the tessellators and quickly determine ahead of
time the size of buffers they need.

Bug: skia:12524
Change-Id: Ib2800fb23054f1548501811203173e58273fbc83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463936
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-27 16:39:36 +00:00
Chris Dalton
49c766732d Delete the skgpu::tess namespace
Tessellation code can just exist in the skgpu namespace.

Bug: skia:12524
Change-Id: I44d473c5f82d608bb6cd3bb9df239c4f4028da4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461557
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-20 18:16:48 +00:00
Chris Dalton
0de8a96a72 Create an skgpu::tess namespace
This is just a bunch of renaming, and for now the tessellate/shaders
directory remains untouched. The next steps will be to clean up and
remove all Ganesh v1 dependencies from tessellation.

Bug: skia:12524
Change-Id: I8cc166c0c78f9fb160de807131fa53fcc0765818
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458876
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-13 16:54:28 +00:00
Brian Salomon
9fa47cc1c6 Make class members that are static constexpr also be inline.
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.

In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.

We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.

Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-11 16:22:59 +00:00
Robert Phillips
ef80d7b50a Move more classes to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Iaa0349749a5d79d7915fb37ef1b30b46f0aa58d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448796
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-16 14:04:16 +00:00
Brian Osman
cbfa34a58c Convert internal SkSL to use .eval()
Also update RELEASE_NOTES to describe new syntax.

Change-Id: I2666551b98f80b61ae3a48c92a9e306cdc7242b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444735
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-03 15:54:54 +00:00
Robert Phillips
2af13c135b Reland "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 44b7568c8a.

Reason for revert: Google 3 CL has landed

Original change's description:
> Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
>
> This reverts commit 30a6b101f4.
>
> Reason for revert: Maybe blocking G3 roll?
>
> Original change's description:
> > Fix compilation w/ "skia_enable_svg = false" (take 2)
> >
> > Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Idf73d864108067ee1c34e88ee4e5236847abd582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444501
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 17:54:08 +00:00
Robert Phillips
44b7568c8a Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 30a6b101f4.

Reason for revert: Maybe blocking G3 roll?

Original change's description:
> Fix compilation w/ "skia_enable_svg = false" (take 2)
>
> Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 22:31:00 +00:00
Robert Phillips
30a6b101f4 Fix compilation w/ "skia_enable_svg = false" (take 2)
Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 18:28:25 +00:00
Mike Reed
2303f7c4a9 Redraw duing mouse drag
Change-Id: I3d72395ad6e8212859a8a3839211f73d27524f22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443413
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2021-08-31 00:34:58 +00:00
Chris Dalton
2a26c50a62 Store the correct number of samples in GrProgramInfo
Bug: skia:11396
Change-Id: I9480b89635bd7a6bdff8ab4876c8eeafdbc27c8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442096
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-26 17:24:47 +00:00
Michael Ludwig
3c0c185e0e Don't assume DecomposeCTM and setDeviceCoordSystem always succeed
Very originally, skif::Mapping::DecomposeCTM() and
SkBaseDevice::setDeviceCoordinateSystem assumed that if the canvas
matrix was invertible, then any scale decomposition would produce a
valid device coordinate system. This proved not to be true and fuzzers
quickly caught it, but I had attempted to address it by forcing
SkCanvas to do extra work so that the above two functions remained
unchanged.

However, it's become apparent that even making the assumption that the
product of two invertible matrices remains invertible does not always
hold true in the wonderful world of floating point math.

Instead, this rewrites DecomposeCTM and setDeviceCoordinateSystem to
return bools, allowing them to fail. This cleans up some of the earlier
checks that SkCanvas makes while computing the skif::Mapping, and it
also ensures that once we fold in the prior device's transform, the
net layer->global transform remains valid. If any of this fails, it
just gets rid of the new device and sets the clip to empty, basically
preventing drawing until the invalid layer has been restored.


Bug: chromium:1239968, chromium:1240685
Change-Id: Ib9ce8f95859e726a9eacf1154f6eef8dd3995500
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442017
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-26 14:21:45 +00:00
Robert Phillips
24d622d6f9 Move the GrTessellationPathRenderer into the skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ic445e99adbe2d2ada64f98f9f516c198a247ef09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440876
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-25 17:16:28 +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
Robert Phillips
e453fa063d Move some v1-only gpu/tessellate files to gpu/ops
This CL just moves the files and renames them. It doesn't move them into the skgpu::v1 namespace.

Bug: skia:11837
Change-Id: Iab322d0dc5b5d1cfd32436785081539dc85c18d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440776
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-08-19 19:56:46 +00:00
Chris Dalton
eb0195e5b4 Delete all code related to disabling multisample
Bug: skia:12196
Change-Id: Iae403ae28e134e4762fc7f58bbfe22bf8c42ab97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436317
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-19 16:56:48 +00:00
Robert Phillips
832f3fbcae Move GrTessellationPathFlags to their own header (GrTessTypes.h)
Having this enum on GrTessellationPathRenderer forced it to be over-#included and was blocking making GrTessellationPathRenderer.h v1-only.

Bug: skia:11837
Change-Id: I80660ed659946d7aa555057c9f4fd1136b44cca0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440536
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-19 14:47:45 +00:00
Brian Salomon
3dbd159d09 Fix a couple Wshadow warnings
Change-Id: I04da5871c668b1ed9ca8db7fdcbfe06a70ee227f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440079
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-17 15:09:14 +00:00
Robert Phillips
06273bcb8a Prepare headers for making all ops V1-only
Basically, ensure all the headers about to become V1-only only appear in contexts that are currently or will soon be V1-only.

This is almost all fallout from retracting some of the moving headers from other headers i.e.:

GrMeshDrawOp.h from GrOpFlushState.h
GrDrawOp.h from GrOpsRenderPass.h
GrDrawOp.h from GrOpsTask.h
GrSimpleMeshDrawOpHelper.h from GrTessellationShader.h


Bug: skia:11837
Change-Id: I939f5c82c3042e9ab00571b5796ab82dbe968085
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438677
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-12 15:09:11 +00:00
John Stiles
c5fc970ff2 Fix cases of variable shadowing in /samplecode/.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: I4c476668a83a0054fe8624d5ffa650db202ba810
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438376
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2021-08-11 13:40:50 +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
960b0f344d Fix cases of variable shadowing in samplecode/.
These were reviewed last year at http://review.skia.org/312480 but never
landed. Splitting into small chunks to land individually.

If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: I53d04e5b2ffd7e170a8b10a6bacbc239c8b5e7ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435720
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2021-08-02 19:25:01 +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
Chris Dalton
17eaf62160 Update GrPathTessellator::prepare() to take a list of paths
This allows us to batch multiple paths together in a single
tessellation. The first user will be the atlas, but the convex
renderer is also a good candidate.

Bug: skia:12258
Change-Id: I4d415d32bbf423cfd9b7ddf2543c21371936da90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433776
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-07-28 16:56:51 +00:00
Chris Dalton
6966981ae0 Add a 'pathMatrix' to GrPathTessellator::prepare
The pathMatrix is applied on the CPU while the geometry is being
written out. It is a tool for batching, and is applied in addition to
the shader's on-GPU matrix. This CL also updates GrPathStencilCoverOp
do do all its path transformations with pathMatrix on the CPU side.
The next step will be for atlases to use the pathMatrix instead of
creating uber paths.

Bug: skia:12258
Change-Id: Ib924dfb06a2c0eed8f9045adc6ae9eefad510082
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433236
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-07-27 20:31:57 +00:00
Mike Reed
2bdf6ed96f Stop using SkFilterQuality
Change-Id: Ief80d125eacb5922b95ab16ebc8d6b483469ada7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429097
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-17 01:55:42 +00:00
Jim Van Verth
94fda947eb Reland "Fix directional shadows."
This is a reland of 6789b82401

Original change's description:
> Fix directional shadows.
>
> The xy offset calculation for drawShadow was not quite correct. Rather
> than normalizing the light vector and using the xy values of that as the
> base offset value, we should scale the light vector by 1/z.
>
> See https://github.com/flutter/engine/pull/27124#issuecomment-880182653
> for more detail.
>
> Bug: skia:10781
> Change-Id: Ib69a313cb96a532f8d89644e3d69f666a184e897
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428880
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Bug: skia:10781
Change-Id: Ib58d374aa03d0144512e5ded6ccd572c74783607
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428978
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-16 16:49:52 +00:00
Jim Van Verth
3c8ae888b9 Revert "Fix directional shadows."
This reverts commit 6789b82401.

Reason for revert: Failing CK test.

Original change's description:
> Fix directional shadows.
>
> The xy offset calculation for drawShadow was not quite correct. Rather
> than normalizing the light vector and using the xy values of that as the
> base offset value, we should scale the light vector by 1/z.
>
> See https://github.com/flutter/engine/pull/27124#issuecomment-880182653
> for more detail.
>
> Bug: skia:10781
> Change-Id: Ib69a313cb96a532f8d89644e3d69f666a184e897
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428880
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: Id22c2113fc1b62109975b83a0dcda5b1b16380a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10781
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428977
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-15 17:53:35 +00:00
Jim Van Verth
6789b82401 Fix directional shadows.
The xy offset calculation for drawShadow was not quite correct. Rather
than normalizing the light vector and using the xy values of that as the
base offset value, we should scale the light vector by 1/z.

See https://github.com/flutter/engine/pull/27124#issuecomment-880182653
for more detail.

Bug: skia:10781
Change-Id: Ib69a313cb96a532f8d89644e3d69f666a184e897
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428880
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-15 17:22:05 +00:00
John Stiles
7bf799956d Reland "Add format-specifier warnings to SkDebugf."
This is a reland of e58831cd95

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12143
Change-Id: Id3c0c21436ebd13899908d5ed5d44c42a0e23921
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421918
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 17:57:43 +00:00
Tyler Denniston
283dba5785 Revert "Add format-specifier warnings to SkDebugf."
This reverts commit e58831cd95.

Reason for revert: looks like breaking a few build bots

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I07848c1bf8992925c9498e916744d0840355a077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421917
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-06-25 13:33:10 +00:00
John Stiles
e58831cd95 Add format-specifier warnings to SkDebugf.
This CL fixes up many existing format-specifier violations in Skia.
Note that GCC has a warning for formatting nothing, so existing calls to
`SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
These were apparently meant to be used as a place to set a breakpoint.

Some of our clients also use SkDebug with bad format specifiers, so this
check is currently only enabled when SKIA_IMPLEMENTATION is true.

Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 11:05:59 +00:00
Chris Dalton
685e09b31a Reland "Purge ccpr"
This is a reland of 7bf6bc0d06

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Change-Id: If0be86902e7cc4755eba91a89be1ec1a6a4b54b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419720
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-19 18:42:38 +00:00
Brian Osman
fe83ab6706 Revert "Purge ccpr"
This reverts commit 7bf6bc0d06.

Reason for revert: Android build references kCoverageCounting

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I01d99287978f848eb8bf900c07cba90ceb3b6edc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419898
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-19 15:13:19 +00:00
Chris Dalton
7bf6bc0d06 Purge ccpr
Now that the clip atlas has been successfully migrated to
tessellation, we don't need this code anymore!

Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-18 21:46:36 +00:00
Robert Phillips
294723d690 Move GrOp::VisitProxyFunc to GrTypesPriv.h GrVisitProxyFunc
This is almost purely a query/replace CL (% the #include juggling).
The VisitProxyFunc is used by more than just the Ops and will probably
still be required in the NGA.

This is a prelude to making all the remaining GrOp-derived classes OGA-only.

Bug: skia:11837
Change-Id: If1c127e5c126c676be529ed2a61dd7953abb03d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419162
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-17 17:23:35 +00:00