Commit Graph

140 Commits

Author SHA1 Message Date
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
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
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
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
Robert Phillips
7a0d3c3f12 Revise GM infrastructure to not rely on GrSurfaceDrawContext
The SDC will soon be V1-only. Remove it from the generic testing infrastructure and require each V1-specific GM to explicitly retrieve it.

Bug: skia:11837
Change-Id: I4c904b7e333333382062bde4b17a1f9f81bee6a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430425
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-21 20:59:37 +00:00
Chris Dalton
ea46ef3a9c Move clip optimizations into GrFillRRectOp
Adds a new clipToShape() virtual on GrDrawOp and implements it with
GrFillRRectOp. GrClipStack now calls this method before attempting to
clip by any other means.

Since clips are often round rects, and a round rect/round rect
intersection can itself be round rect, this allows GrFillRRectOp to
bypass clipping entirely in many cases.

Bug: chromium:928984
Change-Id: Ic19b3f481ee489e3ca85817ba11d132172089a11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426297
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-12 21:58:21 +00:00
Robert Phillips
550de7f872 Depower GrPipeline.h
This is mainly to get GrTextureEffect.h out of this header. Its distribution keeps gumming up efforts to make more classes V1-only.

Bug: skia:11837
Change-Id: I6d5aae20bb20cfe3fb4d93c526efe8cf7e5e0c52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425017
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-07 13:56:23 +00:00
Robert Phillips
7cef6789fd Change architecture #defines to be SK_GPU_V1 and SK_GPU_V2
A strictly mechanical CL

Bug: skia:11837
Change-Id: Id794d1fefe261d685b19e5d4d599cdab5e021cf7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424038
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-01 18:42:53 +00:00
Chris Dalton
b1e8f85fb8 Add an 'opBeingClipped' param to GrClip::apply
The tessellation atlas needs this to call visitProxies.

Bug: b/188794626
Bug: chromium:928984
Change-Id: I5bfb2559abcaf5c7602393e96adb846bcfbce971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420878
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-23 20:41:39 +00:00
Brian Osman
6290555808 Replace GrDeviceSpaceEffect with a runtime FP
Change-Id: Ic0876160c936132c53b55ac9d27e0e422e1ccd26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420217
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-21 19:31:06 +00:00
Robert Phillips
1ca0da4b91 Make GrClipStack, GrClipStackClip, and GrReducedClip OGA-only
GrStencilClip and GrStencilMaskHelper just come along for the ride

Bug: skia:11837
Change-Id: I7cfa2dd620b7457e6b6be4abf91b1ecd415d9b73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417680
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-15 12:48:34 +00:00
Chris Dalton
6edc8d9617 Remove 'hasUserStencilSettings' from GrClip::apply
This doesn't seem necessary. Its only purpose was to disable analytic
clips when there were user stencil settings, which seems like a
de-optimization. The ops that use stencil all seem to properly handle
clip processors in their color pass, so it should be fine to remove
this.

Bug: skia:12047
Change-Id: Ide0ae1004548d62b2feb73c6950bcbcaf6716cfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413099
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-05-27 17:14:37 +00:00
Chris Dalton
f5b87f9b11 Make SkSurfaceProps non-optional for SDCs and SkSpecialImages
This ensures we don't lose the original SkSurfaceProps when creating
image filters, etc.

Bug: skia:11396
Change-Id: I6b412361c1005138278a1396faa7f7e069ec7eb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397291
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-04-20 16:22:46 +00:00
Derek Sollenberger
396cd1dfab Revert "Lift atlas clip FP creation out of GrClip::apply"
This reverts commit 92b35673c5.

Reason for revert: breaking the android roll (see ag/14076257)

Original change's description:
> Lift atlas clip FP creation out of GrClip::apply
>
> Atlas clips always had a potential point of failure: If the SDC's
> opsTask ever got closed between GrClip::apply and
> GrOpsTask::addDrawOp, their mask would have gotten sent to the wrong
> opsTask. It didn't _look_ like this could happen with the current
> code, but it could have also been inadvertently changed quite easily.
>
> This CL adds a "pathsForClipAtlas" array for GrClip::apply to fill out
> instead of creating FPs. The SDC then generates the actual clip atlas
> FPs once it knows exactly which opsTask they will belong in.
>
> Bug: chromium:928984
> Change-Id: I507ab13b2b5e8c3c3c1916d97611297dbbd8a522
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389926
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I9597d822a9f31b7070aee691ddf3a52f4f424a24
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:928984
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392339
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-04-02 15:44:47 +00:00
Chris Dalton
92b35673c5 Lift atlas clip FP creation out of GrClip::apply
Atlas clips always had a potential point of failure: If the SDC's
opsTask ever got closed between GrClip::apply and
GrOpsTask::addDrawOp, their mask would have gotten sent to the wrong
opsTask. It didn't _look_ like this could happen with the current
code, but it could have also been inadvertently changed quite easily.

This CL adds a "pathsForClipAtlas" array for GrClip::apply to fill out
instead of creating FPs. The SDC then generates the actual clip atlas
FPs once it knows exactly which opsTask they will belong in.

Bug: chromium:928984
Change-Id: I507ab13b2b5e8c3c3c1916d97611297dbbd8a522
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389926
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-04-01 20:21:18 +00:00
Brian Salomon
b43d699bb7 Revert "Revert "Reland "Make textures used with alpha-only color-types produce 0s for RGB""""
This reverts commit 1fb7ecb744.

Cq-Include-Trybots: luci.chromium.try:linux-blink-rel,linux-rel
Change-Id: If6692949edd7722e23bc3b64213e75bc15b91a13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350026
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-01-06 14:16:09 +00:00
Greg Daniel
1fb7ecb744 Revert "Reland "Make textures used with alpha-only color-types produce 0s for RGB"""
This reverts commit d006555866.

Reason for revert: probably breaking chrome roll and bad gm diffs

Original change's description:
> Reland "Make textures used with alpha-only color-types produce 0s for RGB""
>
> revised version fixes android-only clip code
>
> This reverts commit c85bce8ea6.
>
> Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
> Change-Id: I8499227e376a8d9daf8f294714a5112d9851197b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348894
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I552cdfe681dc24678e47bfcab3a2c6fc31e6d913
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349396
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-12-31 12:53:42 +00:00
Brian Salomon
d006555866 Reland "Make textures used with alpha-only color-types produce 0s for RGB""
revised version fixes android-only clip code

This reverts commit c85bce8ea6.

Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Change-Id: I8499227e376a8d9daf8f294714a5112d9851197b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348894
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-30 23:13:19 +00:00
Brian Salomon
c85bce8ea6 Revert "Make textures used with alpha-only color-types produce 0s for RGB"
This reverts commit 16d86135b7.

No-Tree-Checks: true
Change-Id: Ia5ba78259a3a406c4c0f8ddca9aaf495d29b34f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348176
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-29 15:18:07 +00:00
Brian Salomon
16d86135b7 Make textures used with alpha-only color-types produce 0s for RGB
channels in shader.

This matches how CPU backend and 3D APIs do things.

Change-Id: I455e89e5782f6653ccd4e29e0f23ec087687aac0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317763
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-28 19:13:19 +00:00
Brian Salomon
8f7d95382e Remove public getter for GrSurfaceDrawContext on SkSCanvas.
Made it private and accessible internally via SkCanvasPriv.

Update SkGpuDevice methods/variables after rename of GrDrawSurfaceContext.

Cq-Include-Trybots: luci.skia.skia.primary:Canary-G3,Canary-Flutter,Canary-Android
Change-Id: I3da64cee1de03c201243ee6c7ccd4b4c44cad8c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346498
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-12-23 16:13:07 +00:00
Brian Salomon
eebe735dea GrRenderTargetContext->GrSurfaceDrawContext
Just the class/files. variable names and additional comments to follow.

Change-Id: Ic03d07fd5009eaf3d706c2536486a117328963fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342617
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-12-10 18:51:19 +00:00
Brian Salomon
70fe17e12f Remove GrRenderTargetContextPriv and GrSurfaceContextPriv
I think this is vestigial from some time in the past where RTC was
public.

Also just expose the methods that add ops rather than have so many
friends + testingOnly versions.

Change-Id: I60d9fdff23b2d67039a7b37815da7ff9e73d8999
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339158
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-11-30 20:13:25 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Michael Ludwig
6397e80437 Specify aa type of draw to the GrClip
Change-Id: I9ed98859814e462c63ab29b94f0365ccc57d2e9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307706
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-08-05 20:18:56 +00:00
Robert Phillips
b7bfbc299a Move GrRecordingContext.h and GrDirectContext.h into include/gpu
External clients will need access to these classes once GrContext
goes away.

This is a purely mechanical CL.

Bug: skia:10441
Change-Id: I7ffeb29d88bcc0f012412fba911e8362d046e24a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300206
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 17:32:14 +00:00
Robert Phillips
9eb0002b47 Double down on abandoned being publicly accessible on contexts
abandoned() is publicly accessible on GrContext. Since
GrRecordingContext is taking its place in many locations, make its
abandoned() call also publicly accessible.

This CL also removes abandoned() from GrContextPriv since it is
publicly accessible.

Change-Id: I72bdae369d06e34ec3f99a18a0feb72e2ae67666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299876
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-30 20:01:51 +00:00
Michael Ludwig
4e3cab7919 Reland "Simplify GrClip API"
This is a reland of 9716414e93

Original change's description:
> Simplify GrClip API
>
> Removes quickContains(SkRect), quickContains(SkRRect), and isRRect().
> Replaces these three functions with preApply() that conservatively
> determines the clip effect up to a single rrect intersection. The major
> motivation for this is the new GrClipStack implementation. preApply()
> and apply() will be able to reuse much more code compared to separating
> the preApply functionality across the older three functions that were
> removed. Additionally, preApply is able to convey more information for
> less work, since it can usually determine being skipped or unclipped while
> determining if the clip is a single rrect.
>
> As part of using this API, the attemptQuadOptimiziation and the equivalent
> rrect optimization are overhauled. Hopefully legibility is improved, and
> the rrect case is now applied outside of the android framework (but with
> tighter AA requirements).
>
> Bug: skia:10205
> Change-Id: I33249dd75a28a611495f87b211cb7ec74ebb7ba4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298506
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Bug: skia:10205, 10456
Change-Id: I500eeda36ea50e95eb8cb658b36aa2373d5166c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298823
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-30 19:57:11 +00:00
Robert Phillips
95c250c247 Downgrade GpuGMs to only receiving a GrRecordingContext
Most of this CL is just noise (i.e., all the header changes) due to the
signature change. The 'discard' GM has some substantive changes but
that's about it.

Change-Id: I72011a442c149b5db93cf8decade6779be4f63d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296704
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-30 13:02:33 +00:00
Michael Ludwig
d8f4f42b03 Revert "Simplify GrClip API"
This reverts commit 9716414e93.

Reason for revert: clipRRect elision seems to trigger precision issues on Nexus5x, see https://chrome-gpu-gold.skia.org/search?fdiffmax=-1&fref=false&frgbamax=255&frgbamin=0&head=true&include=false&issue=2264837&limit=50&master=false&match=name&metric=combined&neg=false&offset=0&pos=false&query=source_type%3Dchrome-gpu&sort=desc&unt=true

Original change's description:
> Simplify GrClip API
> 
> Removes quickContains(SkRect), quickContains(SkRRect), and isRRect().
> Replaces these three functions with preApply() that conservatively
> determines the clip effect up to a single rrect intersection. The major
> motivation for this is the new GrClipStack implementation. preApply()
> and apply() will be able to reuse much more code compared to separating
> the preApply functionality across the older three functions that were
> removed. Additionally, preApply is able to convey more information for
> less work, since it can usually determine being skipped or unclipped while
> determining if the clip is a single rrect.
> 
> As part of using this API, the attemptQuadOptimiziation and the equivalent
> rrect optimization are overhauled. Hopefully legibility is improved, and
> the rrect case is now applied outside of the android framework (but with
> tighter AA requirements).
> 
> Bug: skia:10205
> Change-Id: I33249dd75a28a611495f87b211cb7ec74ebb7ba4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298506
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I850cbf92eea9cf5f2db5528a93251f02dbd6fee2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10205
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298753
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-24 18:58:25 +00:00
Michael Ludwig
9716414e93 Simplify GrClip API
Removes quickContains(SkRect), quickContains(SkRRect), and isRRect().
Replaces these three functions with preApply() that conservatively
determines the clip effect up to a single rrect intersection. The major
motivation for this is the new GrClipStack implementation. preApply()
and apply() will be able to reuse much more code compared to separating
the preApply functionality across the older three functions that were
removed. Additionally, preApply is able to convey more information for
less work, since it can usually determine being skipped or unclipped while
determining if the clip is a single rrect.

As part of using this API, the attemptQuadOptimiziation and the equivalent
rrect optimization are overhauled. Hopefully legibility is improved, and
the rrect case is now applied outside of the android framework (but with
tighter AA requirements).

Bug: skia:10205
Change-Id: I33249dd75a28a611495f87b211cb7ec74ebb7ba4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298506
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-24 15:12:12 +00:00
Michael Ludwig
e06a8972f0 GrClips know their device dimensions
If GrClips know their dimensions then getConservativeBounds() does not
need any arguments and isRRect() can remove its rtBounds argument.

I also updated GrFixedClip to report the render target bounds as a
degenerate rrect in its isRRect implementation if it was wide open. Its
apply() function was also simplified to take advantage of the prior
GrScissorState work where the rectangle was always valid to access and
contained within the render target bounds.

Change-Id: I627b97976cb176b1c80627462027034b06ad2cb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290957
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-11 22:41:24 +00:00
Michael Ludwig
58f569b3e3 Remove unnecessary GrFixedClip includes/declarations
Change-Id: I295855b6a1dbce583920bfef63b2890e7794b8c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290827
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-06-10 01:28:03 +00:00
Michael Ludwig
4e221bd41c Initial clipShader implementation for SkClipStack and GPU
Change-Id: I0af800900a7fbd9d16af0058ee0754358ebc3875
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293562
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-05 20:17:58 +00:00
Michael Ludwig
d1d997e11f Reland "Improve scissor state tracking in GrRTC"
This reverts commit 4926b07217.

Reason for revert: fix wip

Original change's description:
> Revert "Improve scissor state tracking in GrRTC"
> 
> This reverts commit 3b923a880b.
> 
> Reason for revert: GrAppliedHardClip isn't tracking scissor state properly
> 
> Original change's description:
> > Improve scissor state tracking in GrRTC
> > 
> > At a low level, this changes GrScissorState from a rect+bool to a rect+size.
> > The scissor test is considered enablebd if the rect does not fill the
> > device bounds rect specified by the size. This has a number of benefits:
> > 
> > 1. We can always access the scissor rect and know that it will be
> > restricted to the render target dimensions.
> > 2. It helps consolidate code that previously had to test the scissor rect
> > and render target bounds separately.
> > 3. The clear operations can now match the proper backing store dimensions
> > of the render target.
> > 4. It makes it easier to reason about scissors applying to the logical
> > dimensions of the render target vs. its backing store dimensions.
> > 
> > Originally, I was going to have the extra scissor guards for the logical
> > dimensions be added in a separate CL (with the cleanup for
> > attemptQuadOptimization). However, it became difficult to ensure correct
> > behavior respecting the vulkan render pass bounds without applying this
> > new logic at the same time.
> > 
> > So now, with this CL, GrAppliedClips are sized to the backing store
> > dimensions of the render target. GrOpsTasks also clip bounds to the
> > backing store dimensions instead of the logical dimensions (which seems
> > more correct since that's where the auto-clipping happens). Then when
> > we convert a GrClip to a GrAppliedClip, the GrRTC automatically enforces
> > the logical dimensions scissor if we have stencil settings (to ensure
> > the padded pixels don't get corrupted). It also may remove the scissor
> > if the draw was just a color buffer update.
> > 
> > Change-Id: I75671c9cc921f4696b1dd5231e02486090aa4282
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290654
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> 
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
> 
> Change-Id: Ie98d084158e3a537604ab0fecee69bde3e744d1b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294340
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Change-Id: I2116e52146890ee4b7ea007f3c3d5c3e532e4bdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294257
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-04 20:52:41 +00:00
Michael Ludwig
4926b07217 Revert "Improve scissor state tracking in GrRTC"
This reverts commit 3b923a880b.

Reason for revert: GrAppliedHardClip isn't tracking scissor state properly

Original change's description:
> Improve scissor state tracking in GrRTC
> 
> At a low level, this changes GrScissorState from a rect+bool to a rect+size.
> The scissor test is considered enablebd if the rect does not fill the
> device bounds rect specified by the size. This has a number of benefits:
> 
> 1. We can always access the scissor rect and know that it will be
> restricted to the render target dimensions.
> 2. It helps consolidate code that previously had to test the scissor rect
> and render target bounds separately.
> 3. The clear operations can now match the proper backing store dimensions
> of the render target.
> 4. It makes it easier to reason about scissors applying to the logical
> dimensions of the render target vs. its backing store dimensions.
> 
> Originally, I was going to have the extra scissor guards for the logical
> dimensions be added in a separate CL (with the cleanup for
> attemptQuadOptimization). However, it became difficult to ensure correct
> behavior respecting the vulkan render pass bounds without applying this
> new logic at the same time.
> 
> So now, with this CL, GrAppliedClips are sized to the backing store
> dimensions of the render target. GrOpsTasks also clip bounds to the
> backing store dimensions instead of the logical dimensions (which seems
> more correct since that's where the auto-clipping happens). Then when
> we convert a GrClip to a GrAppliedClip, the GrRTC automatically enforces
> the logical dimensions scissor if we have stencil settings (to ensure
> the padded pixels don't get corrupted). It also may remove the scissor
> if the draw was just a color buffer update.
> 
> Change-Id: I75671c9cc921f4696b1dd5231e02486090aa4282
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290654
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: Ie98d084158e3a537604ab0fecee69bde3e744d1b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294340
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-04 19:39:58 +00:00
Michael Ludwig
3b923a880b Improve scissor state tracking in GrRTC
At a low level, this changes GrScissorState from a rect+bool to a rect+size.
The scissor test is considered enablebd if the rect does not fill the
device bounds rect specified by the size. This has a number of benefits:

1. We can always access the scissor rect and know that it will be
restricted to the render target dimensions.
2. It helps consolidate code that previously had to test the scissor rect
and render target bounds separately.
3. The clear operations can now match the proper backing store dimensions
of the render target.
4. It makes it easier to reason about scissors applying to the logical
dimensions of the render target vs. its backing store dimensions.

Originally, I was going to have the extra scissor guards for the logical
dimensions be added in a separate CL (with the cleanup for
attemptQuadOptimization). However, it became difficult to ensure correct
behavior respecting the vulkan render pass bounds without applying this
new logic at the same time.

So now, with this CL, GrAppliedClips are sized to the backing store
dimensions of the render target. GrOpsTasks also clip bounds to the
backing store dimensions instead of the logical dimensions (which seems
more correct since that's where the auto-clipping happens). Then when
we convert a GrClip to a GrAppliedClip, the GrRTC automatically enforces
the logical dimensions scissor if we have stencil settings (to ensure
the padded pixels don't get corrupted). It also may remove the scissor
if the draw was just a color buffer update.

Change-Id: I75671c9cc921f4696b1dd5231e02486090aa4282
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290654
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-04 18:44:46 +00:00
Michael Ludwig
7c12e28cf4 Reland "GrClips provided as pointers to GrRTC"
This reverts commit 074414fed5.

Reason for revert: updated to guard against nullptr before calling
quickContains(rrect).

Original change's description:
> Revert "GrClips provided as pointers to GrRTC"
>
> This reverts commit 226b689471.
>
> Reason for revert: Breaks Android roller
>
> Original change's description:
> > GrClips provided as pointers to GrRTC
> >
> > A null clip represents no high-level clipping is necessary (the implicit
> > clip to the render target's logical dimensions is fine).
> >
> > This also removes GrNoClip and GrFixedClip::Disabled() since they are
> > replaced with just nullptr.
> >
> > By allowing nullptr to represent no intended clipping, it makes it easier
> > to require GrClip and GrAppliedClip objects to know about the dimensions
> > of the device. If we required a non-null clip object to represent no
> > clipping, we'd have to have an instance for each device based on its
> > size and that just became cumbersome.
> >
> > Bug: skia:10205
> > Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I42c4828bcf016ee3d30d5c20b771be96e125817b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292856
> Reviewed-by: Weston Tracey <westont@google.com>
> Commit-Queue: Weston Tracey <westont@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com,westont@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:10205
Change-Id: I5715a4de3b7c8847b73020dc4937d3816d879803
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292876
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-05-29 15:09:54 +00:00
Weston Tracey
074414fed5 Revert "GrClips provided as pointers to GrRTC"
This reverts commit 226b689471.

Reason for revert: Breaks Android roller

Original change's description:
> GrClips provided as pointers to GrRTC
> 
> A null clip represents no high-level clipping is necessary (the implicit
> clip to the render target's logical dimensions is fine).
> 
> This also removes GrNoClip and GrFixedClip::Disabled() since they are
> replaced with just nullptr.
> 
> By allowing nullptr to represent no intended clipping, it makes it easier
> to require GrClip and GrAppliedClip objects to know about the dimensions
> of the device. If we required a non-null clip object to represent no
> clipping, we'd have to have an instance for each device based on its
> size and that just became cumbersome.
> 
> Bug: skia:10205
> Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I42c4828bcf016ee3d30d5c20b771be96e125817b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10205
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292856
Reviewed-by: Weston Tracey <westont@google.com>
Commit-Queue: Weston Tracey <westont@google.com>
2020-05-29 12:55:44 +00:00
Michael Ludwig
226b689471 GrClips provided as pointers to GrRTC
A null clip represents no high-level clipping is necessary (the implicit
clip to the render target's logical dimensions is fine).

This also removes GrNoClip and GrFixedClip::Disabled() since they are
replaced with just nullptr.

By allowing nullptr to represent no intended clipping, it makes it easier
to require GrClip and GrAppliedClip objects to know about the dimensions
of the device. If we required a non-null clip object to represent no
clipping, we'd have to have an instance for each device based on its
size and that just became cumbersome.

Bug: skia:10205
Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-28 18:55:13 +00:00
Michael Ludwig
81d4172d86 Reland "Simplify GrRTC::clean APIs"
This reverts commit 4730f29993.

Reason for revert: Fix WIP

Original change's description:
> Revert "Simplify GrRTC::clean APIs"
> 
> This reverts commit 6cbd7c2e57.
> 
> Reason for revert: mac/generated files failures
> 
> Original change's description:
> > Simplify GrRTC::clean APIs
> > 
> > The CanClearFullscreen enum type is removed. Most usages of clear() had
> > kYes because a null scissor rect was provided, or had kNo because the
> > scissor was really critical to the behavior. A few places did provide a
> > scissor and kYes (e.g. for initializing the target).
> > 
> > To simplify this, the public GrRTC has two variants of clear(). One with
> > only a color (for fullscreen clears), and one with a rect for partial
> > clears. The private API also adds a clearAtLeast() function that replaces
> > the several cases where we'd have a scissor but could expand to fullscreen.
> > 
> > I find the current control flow in internalClear() to be hard to
> > follow (albeit I was the one to make it that way...), but later CLs
> > will improve it.
> > 
> > Bug: skia:10205
> > Change-Id: I87cf8d688c58fbe58ee854fbc4ffe22482d969c6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290256
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
> 
> Change-Id: I7131df6f5323f4f9c120cbcfd9bc57e627e2eb65
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291842
> 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:10205
Change-Id: Id5db153d7c2500279cca8478818b66f67a53e143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291844
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-05-27 14:26:16 +00:00
Michael Ludwig
4730f29993 Revert "Simplify GrRTC::clean APIs"
This reverts commit 6cbd7c2e57.

Reason for revert: mac/generated files failures

Original change's description:
> Simplify GrRTC::clean APIs
> 
> The CanClearFullscreen enum type is removed. Most usages of clear() had
> kYes because a null scissor rect was provided, or had kNo because the
> scissor was really critical to the behavior. A few places did provide a
> scissor and kYes (e.g. for initializing the target).
> 
> To simplify this, the public GrRTC has two variants of clear(). One with
> only a color (for fullscreen clears), and one with a rect for partial
> clears. The private API also adds a clearAtLeast() function that replaces
> the several cases where we'd have a scissor but could expand to fullscreen.
> 
> I find the current control flow in internalClear() to be hard to
> follow (albeit I was the one to make it that way...), but later CLs
> will improve it.
> 
> Bug: skia:10205
> Change-Id: I87cf8d688c58fbe58ee854fbc4ffe22482d969c6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290256
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I7131df6f5323f4f9c120cbcfd9bc57e627e2eb65
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10205
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291842
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-05-26 14:37:23 +00:00
Michael Ludwig
6cbd7c2e57 Simplify GrRTC::clean APIs
The CanClearFullscreen enum type is removed. Most usages of clear() had
kYes because a null scissor rect was provided, or had kNo because the
scissor was really critical to the behavior. A few places did provide a
scissor and kYes (e.g. for initializing the target).

To simplify this, the public GrRTC has two variants of clear(). One with
only a color (for fullscreen clears), and one with a rect for partial
clears. The private API also adds a clearAtLeast() function that replaces
the several cases where we'd have a scissor but could expand to fullscreen.

I find the current control flow in internalClear() to be hard to
follow (albeit I was the one to make it that way...), but later CLs
will improve it.

Bug: skia:10205
Change-Id: I87cf8d688c58fbe58ee854fbc4ffe22482d969c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290256
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-05-26 13:16:12 +00:00
Mike Reed
1f60733fb3 Revert "Revert "move onto new factories for SkMatrix""
This reverts commit c80ee456ad.

fix: update flutter's gn file to add guard

Change-Id: Iac5171c8475d9a862d06255dab1c6f38f10de2f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291361
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-21 16:58:39 +00:00
Mike Reed
c80ee456ad Revert "move onto new factories for SkMatrix"
This reverts commit 046c2b7d90.

Reason for revert: need to update/guard flutter

Original change's description:
> move onto new factories for SkMatrix
> 
> Just rename, no functional changes expected.
> 
> Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ic74f177128913374b8c60b4df88f04cf72fbacb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291359
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-21 16:05:20 +00:00
Mike Reed
046c2b7d90 move onto new factories for SkMatrix
Just rename, no functional changes expected.

Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-05-21 15:04:09 +00:00
Michael Ludwig
c002d5619e Simplify GrClip::getConservativeBounds() signature
It turns out no one was using the intersection of rect functionality on
GrClip, and this helps simplify what the new clip stack needs to define.

Bug: skia:10205
Change-Id: If85a0c744dd68a8ad2f380b54a539ac74850e4ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289440
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-13 18:59:13 +00:00
Michael Ludwig
828d341199 Reland "Refactor stencil clip mask generation into helper"
This reverts commit de228e53fe.

Reason for revert: GrReducedClip now assumes context isn't abandoned,
windowrectangles GM abuses GrReducedClip and has to be abandon-aware.

Original change's description:
> Revert "Refactor stencil clip mask generation into helper"
>
> This reverts commit 8b3a8a5238.
>
> Reason for revert: GM assert failure
>
> Original change's description:
> > Refactor stencil clip mask generation into helper
> >
> > Change-Id: If3dc80efde3b44e87ba8e7af3a258896ec5e78e6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288977
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,csmartdalton@google.com,michaelludwig@google.com
>
> Change-Id: I16559f791601145f57d147cdae345c200af313f1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289237
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: I6a9372edecd0bdc1a38464ab85f7b7f3ca85e5ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289239
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-05-12 17:49:47 +00:00
Brian Salomon
2eb7b57d14 Remove unused GrTextureDomain
Bug: skia:10139

Change-Id: I20cd95fcf5f11832366c32e48ed4d442c82b0719
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284082
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-04-21 18:51:24 +00:00
Brian Salomon
6422722cba Reland "Remove GrDeviceSpaceTextureDecalFragmentProcessor."
This is a reland of af5f9f008d

This was reverted due to Metal GMs failing. That is a bug in Metal where
pipeline creation fails with "internal error". Reporting to Apple, filing
Skia bug, and moving on.

Original change's description:
> Remove GrDeviceSpaceTextureDecalFragmentProcessor.
>
> It was used to sample clip masks using device coords.
>
> Replace with a more generic GrDeviceSpaceEffect that simply calls a
> child FP with sk_FragCoord.
>
> Also fix issue in GrQuadPerEdgeAA GP. It wouldn't setup coord transforms
> at all if they are all applied in the FS (explicit coords). Moreover,
> the GrGLSLGeometryProcessor::emitTransforms() helper required a valid VS
> var for local coords even when all FPs use explicit coords and wouldn't
> use a local coords var.
>
> Make CPP SkSL code gen for clone copy the explicit coord status of
> children.
>
> Change-Id: Ib8bb36028354405c8012f6e91e9eb46db75d16a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271658
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Change-Id: Ia4530e6799019cd92863fe983a2d3c71df6f0620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273511
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-26 18:57:36 +00:00