Commit Graph

4972 Commits

Author SHA1 Message Date
Michael Ludwig
3e8ff3ef61 Fix vertex alpha when connector edges intersect inner edges
In the new GM, the left and right portions of the path have a shared
vertex. The two edges leaving that vertex vertically towards the bottom
of the image are nearly parallel but the right edge has a steeper slope.
This leads to two sources of self intersections. The outset vertices
for the left and right sides intersect, which converts some of those
edges into "connecting" edges and removes others (preventing double
hitting of pixels). However, these outset but now "connecting" edges
from the right side also overlap with the inset vertices of the left
shape, requiring additional vertex splitting and connecting edge
creation.

The old alpha logic when one of the intersecting edges was a connecting
edge was to use its interpolated alpha value. In this case, since the
connecting edge originated from two outset vertices, its end point
alphas were 0 and the split alpha became 0, even though the other
intersecting edge was an interior edge.

This CL flips the logic around and ensures that any split vertex that
is on the interior edges remains fully opaque, any vertex that is
fully on the exterior remains fully transparent, and anything else
uses the max of the interpolated alphas (equivalent to the old
logic when one edge was connecting and one was exterior, but is more
accurate if somehow we get two connecting edges intersecting).

Bug: skia:11859
Change-Id: I85d2d54a8833e3c9da2fdd1a4f3a0513119730b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400596
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-04-26 17:00:08 +00:00
Brian Osman
56ed7daeca Use MakeForShader/ColorFilter in runtime effect tests
Bug: skia:11813
Change-Id: I9748a2806fe4636111fbb5740a3ebdb0814cfc35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401018
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-26 14:44:38 +00:00
Chris Dalton
57ab06c14e Delete mixed samples
Mixed samples is no longer relevant for Ganesh. DMSAA and the new
Ganesh architecture both rely on full MSAA, and any platform where
mixed samples is supported will ultimately not use the old
architecture.

Change-Id: I5acc745010e090ef26310d92ec6240be2cd494cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399837
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-22 20:11:34 +00:00
Herb Derby
f9cf1aa2ca add drawGlyphs for SkRSXform
Add a drawGlyphs to SkCanvas that takes SkRSXform instead of
positions. Update buffer sizing calculations to take
SkRSXform buffers into account.

Change-Id: I14529088199dcd0b1ae78b4605e1ba77fec2000e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399096
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-21 19:43:37 +00:00
Brian Osman
f6123f1dcc Convert some SkRuntimeEffect::Make to use stage-specific factories
The old factory is deprecated. The new ones do stricter checking on the
signature of main and calls to sample, and include checks at effect
creation-time that the SkSL is valid for the requested stage.

Bug: skia:11813
Change-Id: Ibd15a6f90e74bdc9c2352d3dc61b6682f626f413
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397477
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-21 16:19:57 +00:00
Brian Salomon
9a56eb7063 Consolidate on SkImage_Gpu constructor that takes SkColorInfo.
Also take SkImageInfo in SkImage_GpuBase.

Change-Id: Ie6d71a9a4a3740b9acc0faae72df2796e9a0e567
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398230
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-21 14:19:27 +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
Brian Osman
e49703faf2 Remove custom SkVertices data and runtime effect varying support
This was an experimental feature. It worked (but only the GPU backend).
It was never adopted or used by anyone, to my knowledge. It's a large
amount of code, and a strange corner of SkSL for users to stumble into.

Bug: skia:10680
Change-Id: I0dda0364bce7dbffa58c32de4c7801ec2a6bc42e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398222
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-19 17:49:25 +00:00
Brian Osman
cc3d2d25c5 Runtime effects: Detect passthrough sample calls automatically
As explained, this is *very* conservative. It only works when the child
is sampled from within main, and using a direct reference to the coords
parameter. If that parameter is ever modified (even after being used),
the optimization doesn't happen. For most cases, this is fine.

Bug: skia:11869
Change-Id: Ia06181730a6d07e2a4fe2de4cc8e8c3402f0dc52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397320
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-19 14:52:44 +00:00
Chris Dalton
224e5e4d7e Generalize the squircle runtime effect to draw "super rounded rects"
These are rounded rectangles whose corners are superellipses instead
of ovals. This builds on a lot of work done by zakcohen@google.com to
define a consistent, visually appealing shape that can be used
reliably in the Android UI.

Change-Id: I97fde7be870152c9ee776fde53118019d0caa251
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397416
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-16 19:24:43 +00:00
Herb Derby
e90a295f6c fix SkCanvas::drawGlyphs's bounds calculation
Change-Id: I9aea1f516ccb362cf28684de571bdd6971dd6f6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397478
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-16 16:34:33 +00:00
Michael Ludwig
70fae35842 Preserve winding scale for outer edges in AA triangulation
More details are in the bug, but the specific test case gets an
overlap region in the AA outset geometry for the left and right shapes.
Additionally, the mitered outset for the left shape is collinear with
the bottom of the right shape, so the winding of exterior edge of
the overlap region is updated to +2.

When determining the polygons to fill, this +2 on the outer edges
violates the winding rules that normally ensure the interior polygons
(that use +/-2 instead of +/-1) are always filled.

It appears a similar bug fix was added here:
https://skia-review.googlesource.com/c/skia/+/141952/
but then didn't survive a heavy refactor later:
https://skia-review.googlesource.com/c/skia/+/215094

To the best of my knowledge, this is achieving the same result as the
original fix but is updated to preserve winding scale for interior
polygons with overlap regions (the code checks for these, but they
seem pretty rare to me).

Bug: 1197461
Change-Id: I0d32820af8cfec92c46114aeaa58b6e340abdfca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397140
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-04-15 20:31:12 +00:00
Brian Salomon
5a32828e5e No VS specialization for identity or scale/trans in reduced shader mode
Modifies helpers on GrGLSLGeometryProcessor that insert, set, and make
keys for view/local matrix uniforms to not omit the uniform when
the matrix is identity or use a float4 when it is scale/trans. Always
uses a 3x3.

Bug: skia:11844
Change-Id: I0f25b60b46b8932d7e2cac4a50159d22b9cd84d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395656
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-14 20:09:09 +00:00
Brian Salomon
354147a23c Replace GrConstColorProcessor with a runtime FP
Change-Id: Ie36ea4d5186f6cca341efc6300b813ec8255bdbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-14 18:40:18 +00:00
Brian Osman
577c6067a1 Runtime effects: Support input color as a parameter to main()
For now, just bolt this onto the existing runtime effects. The next step
is to add dedicated modes to the compiler for shader vs. color filter.
Once we get there, we will be much more strict about main signature in
each mode (and start adding other per-mode error checking).

Bug: skia:11813
Change-Id: I27e27600209e9844ae107364baea2fb949b47c3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395838
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-04-13 21:55:18 +00:00
John Stiles
3738ef531b Move code generators to codegen/ directory.
We are up to having seven distinct types of codegen, and will soon have
an 8th (DSL C++).

Change-Id: I6758328390c234ba1d5c30c118199dbc820af52a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395817
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-13 15:34:24 +00:00
Ethan Nicholas
b14e6b9055 Added _Type suffix to DSL Type enum
No functionality changes, just making the naming consistent with our
other enums.

Change-Id: Ic9bc4a89f8373e4dc1060067a41468fb626e5fa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394160
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-08 21:55:05 +00:00
Brian Salomon
2c673409ef Expose writing to mip levels via GrSurfaceContext::writePixels
Bug: skia:11786
Change-Id: Id17952db0aede56fa39845d9d371cf0a141f9dd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391836
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-04-02 19:16:15 +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 Osman
358858fe4c Fix bots that don't like std::is_integral_v
Change-Id: I37202f26bd1d990f80528f490ccd7e99cbc2139f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392056
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-01 18:49:43 +00:00
Brian Osman
d18967c67d Add integer uniforms to runtime effects
Bug: skia:11803
Change-Id: I925f14be282b96355721986de6049090b35adf3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391856
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-04-01 17:20:03 +00:00
John Stiles
3d1d60ac19 Avoid creating GM test resources at startup time.
The `compositor_quads_xxxxxx` slides were attempting to create their
renderers at program startup time. These are now created in
onOnceBeforeDraw instead.

Change-Id: I5dd5844447bf87348cb88ee97aa4e03593eb07fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389616
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-03-29 15:17:09 +00:00
Dominik Röttsches
2e04df9a06 Support PaintTranslate in COLRv1 rasterisation
Found during implementation of COLRv1 fuzzer for FreeType that translate
operation was still missing.

Added a test glyph containing two squares filled with a radial gradient
shifted by dx 128, dy -128 and dx -308, dy 307
combined using a PaintComposite.

Bug: skia:11790
Change-Id: I4cbfe34a111a450777dc2f8fa9d32a405f808a89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389116
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-03-25 20:14:21 +00:00
Michael Ludwig
e50167091c Move Sk3Perspective and Sk3Lookat into SkM44
Sk3Perspective -> SkM44::Perspective
Sk3LookAt -> SkM44::LookAt

Also adds some SK_API tags to the SkV[2,3,4] structs. Also fixes
linkage issues around Sk3Perspective/LookAt by moving them into the
exported SkM44 (if we don't like them as SkM44 factories, will just need
to add SK_API tags to old Sk3Perspective/Lookat directly).

Change-Id: I3f125211b76899f216e63cc8d587776004516e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388476
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-03-24 15:47:22 +00:00
Robert Phillips
84fd1c2dec Clean up remaining NVPR bits & bobs
Bug: skia:11760, skia:11787
Change-Id: Idfedb90576e0484bf32a9002081c0fcb888141eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388216
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-03-23 19:12:12 +00:00
Brian Salomon
ed3c75b0a5 adjust values in very_large_sigma_gpu_blur gms
Only the largest sigma (320) would hit the downscale limit with the
old sigmas and image sizes. However, that sigma was far too large
to produce reference values in a reasonable amount of time.

Reduce the image sizes so that the downscale limit can be hit with a
smaller sigma.

Bug: skia:11735
Change-Id: Ia7f4385c6114f7071a14336ca39f81cf9ac68861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386058
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-23 15:23:18 +00:00
Robert Phillips
f10535f6fa Fuse GrGLSLPrimitiveProcessor and GrGLSLGeometryProcessor ...
into a new GrGLSLGeometryProcessor. Since NVPR is no more this
distinction (between GLSL- Primitive and Geometry -Processor)
probably isn't needed/useful.

Bug: skia:11760
Change-Id: I75621725bd2b0ef3dbac2ea6449bd571551babab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388036
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-23 14:30:18 +00:00
Robert Phillips
787fd9d80a Fuse GrPrimitiveProcessor & GrGeometryProcessor into a new GrGeometryProcessor
With the removal of NVPR we no longer need this distinction.

Bug: skia:11760
Change-Id: I225a4feb764395fb72aca3ffc8b6d05396bf0b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386890
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-03-22 19:44:40 +00:00
Robert Phillips
22970175f7 Remove sample locations usage from GL backend
Bug: skia:8921

Change-Id: If9e65a78f9e1fddb5c5ad5afa5612294935122e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386837
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-03-22 18:00:06 +00:00
Mike Reed
12a75588e7 GrFPArgs no longer needs sampling
Change-Id: I20fc4b4c3d6997f3ebc1d6d0049447b348f8a110
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387416
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-20 17:33:56 +00:00
Mike Reed
10a5ff2cac Must pass filtering to picture shader
Change-Id: I820867df80daa1594d6202cad5e8e95c060293fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386838
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-03-18 22:18:47 +00:00
Chris Dalton
4e94fd11cd Add a runtime effect gm for squircle clips
Change-Id: I6bf9cad2dd7095afbc153e90510dd0f7c398797d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382936
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-17 06:09:35 +00:00
Brian Salomon
f970746dd2 Add GM that tests GPU blur with very large sigmas.
GM initially does not draw correctly because of large sigma drop outs.

Make SkGpuBlurUtils::GaussianBlur use the correct translation when both
sigmas are (effectively) 0.

Bug: skia:11735
Change-Id: I674c63cc57b56995a7ade4c098bb997bd5baee8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383703
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-03-15 21:40:26 +00:00
Chris Dalton
03730e6ca6 Delete path caching and path rendering from ccpr
All that's left is a clip atlas renderer.

Bug: chromium:1158093
Change-Id: I8b509904a752a202ff1321e5302c41a3f57a5edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383741
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-12 16:02:16 +00:00
Chris Dalton
1bb1f220bd Remove undefined behavior from innershapes gm
It is undefined for the inner rrect to not be contained in the inner.

Change-Id: I632060771fb7918050e1836d17b4702ea765a08f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384116
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-12 16:00:46 +00:00
John Stiles
9c4cdef7e5 Fix gm slide 'TessellationTestRectShader'.
This needed to be updated to match changes in
http://review.skia.org/382476. It is not tested on any of the normal
CQ trybots.

Change-Id: I3c0843d8e77958192c0db9ad8f6b797aec887fe4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382757
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-10 17:38:18 +00:00
Jim Van Verth
e82fdaa50b Accept near-simple, near-circular rrects for shadow fast path.
SkRRectPriv::IsSimpleCircular does a tolerance-based check for the
rrect radii but not for determining if the rrect is simple. This adds
IsNearlySimpleCircular as a looser check, since we don't care in this
case that the rrect is perfectly simple.

Bug: skia:11717
Change-Id: Ibbd53ff8c120287339fa29f87f064e6fb633ee7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382703
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-03-10 17:30:34 +00:00
Chris Dalton
1e7b2e5e17 Re-enable ccpr clipping for small paths
For things like path rendering we can (and should) do better than an
atlas. But for use cases like "many small paths clipped by many small
paths," an atlas is probably still the best solution we have.

Change-Id: Iff5d250d0d6ccba9235f3fe652891554e3fdfc24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380856
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-10 16:22:58 +00:00
John Stiles
4d7ac49dca Declare outputColor and outputCoverage inside emitCode.
This is useful because it allows the variables to be declared as `const`
when they are trivial values like `half4(1)`. This enables the constant
folder to simplify or eliminate them. In most cases, this is only a
small benefit, as you'd expect a competent GPU driver to do the same.
However, Mali-400 can benefit significantly from optimizing away the
multiplication against a constant half4(1) coverage in Porter-Duff.

Mali-400 performance is back to normal: http://screen/3cDxdaGkYE8oBcS

Change-Id: I21fd23f91f747079cd05b082f7b3444aeabafb93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382476
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-10 16:03:18 +00:00
Chris Dalton
cc13b3522a Reland "Use analytic AA in FillRRectOp even if the target has MSAA"
This is a reland of cad44bcdd2

Original change's description:
> Use analytic AA in FillRRectOp even if the target has MSAA
>
> Bug: skia:11396
> Change-Id: Ia29fd5c9f00006274bb2aa1db96fbad57d858786
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380016
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:11396
Change-Id: I6382085ccd037b534a1ed1355c1464aaef799a44
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380477
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-05 23:57:15 +00:00
Ethan Nicholas
fe5d6928d0 DSL var values are now specified at construction time rather than in
Declare

This solves several issues caused by the lack of ordering guarantees in
C++; it was possible for the SkSL backend to look for the value of a
variable before its Declare() call gets processed. Moving the initial
value out of Declare should fix this whole class of problems.

Change-Id: I428fe230f1c312a0128c1f00c2a36cb95f4590a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380358
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-05 21:47:28 +00:00
Chris Dalton
e3aec3c603 Revert "Use analytic AA in FillRRectOp even if the target has MSAA"
This reverts commit cad44bcdd2.

Reason for revert: Triggered an Adredo330 bug

Original change's description:
> Use analytic AA in FillRRectOp even if the target has MSAA
>
> Bug: skia:11396
> Change-Id: Ia29fd5c9f00006274bb2aa1db96fbad57d858786
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380016
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ic51a279f9fefe03b28182bf1222c2e26625f5bf3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380476
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-05 21:47:26 +00:00
Brian Salomon
d63638bb7b Copy on write for wrapped backend texture surfaces.
Makes SkImage_Gpu backed by two proxies, an original and a copy. The
image uses the original until a new render task is bound to it at which
point further uses of the image will use the copy. If the image is ever
used off a GrDirectContext we fall over to the copy. If the copy is
never used and never can be used by the next flush then the render
task that populates it is marked "skipped" and we don't perform the
copy.

Bug: skia:11208

Change-Id: Id255f4a733acc608c8a53c1a5633207aeafc404b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366282
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-05 19:50:05 +00:00
Chris Dalton
cad44bcdd2 Use analytic AA in FillRRectOp even if the target has MSAA
Bug: skia:11396
Change-Id: Ia29fd5c9f00006274bb2aa1db96fbad57d858786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380016
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-05 17:28:05 +00:00
Peng Huang
a42ed48e84 Fix a double free problem in YCbCrImageGM::createYCbCrImage()
If SkImage::MakeFromTexture() fails, the reelase_ycbcrhelper will
also be called, so ycbcrHelper.release() should be always called.

Change-Id: I104e02155da653bcb465723cbead595f16459fca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379848
Commit-Queue: Peng Huang <penghuang@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-05 15:36:25 +00:00
Ethan Nicholas
daed2592bb Made SkSL DSL into public API
In addition to the unsurprising changes to eliminate references to
src/, we also had to tighten up some C++17-isms as they are not
permitted in public headers.

Change-Id: Ie5005a33d7a135e69fb66beca5e7a5f960dbd453
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378496
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-04 21:03:58 +00:00
Brian Salomon
6d25f9d068 Fix downsampled blur with clamp mode.
Ensure the extra border added to the downsampled image doesn't filter in
values from outside the source bounds.

Bug: chromium:1174354
Change-Id: I6c62eeaa57ce4e5341eab24985553f87ab0df666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378322
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-03 14:15:31 +00:00
Ethan Nicholas
4113057c57 Fix use-after-free in SkSL DSL
Bug: skia:11384
Change-Id: I462295ce8eb42ca5270595bbd8714d70abf33441
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378319
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-03-02 21:33:59 +00:00
Mike Klein
9ca065e2fd fix races in dashcircle.cpp
Remove static from locals that are not constexpr.

See
https://task-driver.skia.org/logs/sMqS6sn7QDHLAJjHkSg7/65e8489b-9f04-4da5-bea4-d996dc0bb9ba

Change-Id: I2c1d75c8cd2866b500b0d33ac8a1b8cd9b9fb567
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377940
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-03-01 20:18:21 +00:00