Commit Graph

2608 Commits

Author SHA1 Message Date
Michael Ludwig
97f85bb7fd Remove SkTextBlobDiffCanvas, use tracking device directly with base SkCanvas
Chromium has been updated to use makeAnalysisCanvas directly and there are
no more references to SkTextBlobDiffCanvas as a type in its code base.

Since the GlyphTrackingDevice extends SkNoPixelsDevice, any SkCanvas that
uses it is effectively a "no-draw" canvas. However, by returning a base
SkCanvas the text tracking now automatically happens in the context of
the base's AutoLayerForImageFilter handling it applies on every draw. This
means that drawing a text blob with an image filter that modifies the
transform state will now be analyzed in that context automatically
(simplifying code in chrome after this lands).

Another behavioral change is that all non-text draws will still go through
the base SkCanvas' virtuals and invoke the device function. Since it's an
SkNoPixelsDevice, it'll still be a no-op, it just happens a little later.
This won't really impact performance because oop-r already inspects their
operations and only plays back text and transform related ones to the
analysis canvas, so we shouldn't really see non-text draws being invoked
anyways.

Bug: chromium:1187246
Change-Id: I83f86571300751f385b3065dfe889f218fa1edc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405196
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-05-06 16:11:57 +00:00
Michael Ludwig
daa9b8e4d9 Add mapRect function and RectToRect constructor to SkM44
The SkM44::RectToRect function matches the semantics of
SkMatrix::RectToRect(kFill_ScaleToFit). No other ScaleToFit variants are
ported over to SkM44.

skottie uses some instances of kCenter_ScaleToFit so that functionality
may need to be added in the future (in SkM44 or in skottie). There are
no current usages of the kStart and kEnd_ScaleToFit semantics.

The SkM44::mapRect() function is implemented to correspond to the
SkMatrix::mapRect() that returns the mapped rect (instead of modifying a
pointer) and always has ApplyPerspectiveClip::kYes. This was chosen to
keep its behavior simple and because perspective clipping is almost
always the right thing to do. In the new implementation there is no
longer a performance cliff to worry about (see below). For the timebeing
mapRect is hidden behind SkMatrixPriv::MapRect().

Performance:
I added benchmarks for mapRect() on SkM44 and SkMatrix that use the same
matrices to get a fair comparison on their different specializations.
SkMatrix has a very efficient mapRect when it's scale+translate or
simpler, then another impl. for affine matrices, and then falls back to
SkPath clipping when there's perspective. On the other hand, SkM44 only
has 2 modes: affine and perspective.

On my desktop, with a Ryzen 9 3900X, here are the times for 100,000 calls
to mapRect for different types of matrices:
                         SkMatrix    SkM44
scale+translate           0.35 ms    0.42 ms
rotate                    1.70 ms    0.42 ms
perspective              63.90 ms    0.66 ms
clipped-perspective      138.0 ms    0.96 ms

To summarize, the SkM44::mapRect is almost as fast as the s+t specialization
in SkMatrix, but for all non-perspective matrices. For perspective matrices
it's only 2x slower than that specialization when no vertices are clipped,
and still almost 2x faster than the affine specialization when vertices are
clipped (and 100x faster than falling back to SkPath).

Given that, there's the open question of whether or not keeping an affine
specialization is worth it for SkM44's code size.

Bug: skia:11720
Change-Id: I6771956729ed64f3b287a9de503513375c9f42a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402957
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
2021-05-05 19:57:26 +00:00
Chris Dalton
5dfb3f4068 Collect DMSAA stats
Adds counters for the number of render passes, number of MSAA render
passes, and each op that either does or would trigger MSAA. Adds a
bot that collects stats on the html (not svg) skps.

Bug: skia:11396
Change-Id: Ic48263d6310670d8f0d09ec4c4bf6a2b83fc7d02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401636
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-01 00:46:22 +00:00
Brian Salomon
31fddc3769 MSKP support in nanobench
Bug: skia:11900
Change-Id: I97d1f2a9523252318ffb4f479b197cb0ef9cf0b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402920
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-30 20:04:08 +00:00
Chris Dalton
2579c2876a nanobench: Don't tile skps outside their cull rect
Bug: skia:11396
Change-Id: I8ce2bbc0723b318272a2005e1b8cc1ce8f6f8f31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401597
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-30 19:47:21 +00:00
Chris Dalton
82007f568d Implement a fixed count stroke tessellator
This new tessellator renders strokes as fixed-count triangle strip
instances. Any extra triangles not needed by the instance are emitted
as degenerate triangles. Since it draws in order, this tessellator
allows us to batch dynamic colors even when hw tessellation is not
supported.

Bug: skia:10419
Change-Id: If03a8b76319471ae4d4580dda019b69204d9197b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398416
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-22 20:34:04 +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
d5a676441a use GrArenas for direct glyph drawing
The existing code incorrectly uses the recordTimeAllocator.
Add a SubRunAllocator to the GrArenas, and use GrArenas to
store direct glyph drawing information.

Change-Id: I38ba25658364a48af5c775315331795d3d22121f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397476
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-04-22 16:43:31 +00:00
Chris Dalton
6ca9e18bf6 Update GrStrokeTessellator to make its own shader
Bug: skia:10419
Change-Id: I656e2508e95a47e03af431734ac06cbdb41232c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398356
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-21 22:58: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
Chris Dalton
94df572a13 Convert dmsaa to an SkSurfaceProp
Bug: skia:11396
Change-Id: I1c2a72d80679df1c11529d05cbe781f6dfae6a79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396810
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-04-20 16:24:56 +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
Chris Dalton
50f5e68b7c Use the word "precision" to describe "1/tolerance" for linearization
Bug: skia:10419
Change-Id: Ie01122ab8c9130367988fd2e264fcf4761862e89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397656
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-19 17:38:35 +00:00
Brian Osman
cbb60bd0b0 Add runtime color filter and shader modes to the SkSL compiler
These enforce stricter rules about the signature of main, and each one
uses a separate pre-include module. That prevents color filters from
being able to reference sk_FragCoord (or coords passed to main) at all.
It also limits the versions of sample() that are exposed.

In the new world, an effect created for a specific stage of the Skia
pipeline can only be used to create instances of that stage (SkShader or
SkColorFilter). For now, SkRuntimeEffect::Make uses kRuntimeEffect,
which continues to be more lenient and allow creation of either shaders
or color filters from a single effect. After we migrate all clients, we
can deprecate and then delete that mode.

Bug: skia:11813
Change-Id: I0afd79a72beeec84da42c86146e8fcd8d0e4c09f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395716
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-15 13:30:59 +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
Herb Derby
3c1ed9cbe2 add bounds generation code to SkGlyphRun
Change-Id: I29c269bce86cb50fea57d44d7760b60326aa56a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396436
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-04-14 18:05: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
Herb Derby
ef094235dc clean up drawTextUTF8 and rename to textToGlyphRunList
Pull out the glyph positioning code in anticipations of removing
simplifyDrawText.

This is part of a larger CL:
https://skia-review.googlesource.com/c/skia/+/388719

Change-Id: I935fd91f70d708a7a30785b6eea8e4e7c1f9c739
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392416
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-02 21:07:25 +00:00
Chris Dalton
8ed7a8d1c6 Extract a GrVertexChunkArray class with a builder
This will be used by the new stroke tessellator. All the other
tessellators should start chopping and chunking too. That will allow us
to quit cropping paths if we are afraid they might need more segments
than are supported.

Bug: chromium:1172543
Change-Id: I30f0ebb581f56cac099d8c05e0e181c4657c3db8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390096
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-31 17:27:52 +00:00
Eric Boren
a1db799824 Fix Python3 compatibility
Bug: skia:11768
Change-Id: I6107362457dce380e3fb1647ad58d8e33e453e2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388743
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
2021-03-25 14:15:35 +00:00
John Stiles
06b6f47950 Update blendmode benchmark to allow less than 1000 iterations.
On Mali 400 devices, 1000 iterations is way too many, causing this
benchmark to take five seconds per variation:
http://screen/5AdKPZynP7myjfR

This change should help lighten the load on the tree for older devices.

Change-Id: I3f719093c3f7fdbc81ab41c29ce6d93f36360b7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388444
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-24 21:32:23 +00:00
John Stiles
15da98ce58 Revert "Performance experiment: Disable SkSL inliner in nanobench/skpbench."
This reverts commit 3f5bee1a7a.

Reason for revert: concluding experiment

Original change's description:
> Performance experiment: Disable SkSL inliner in nanobench/skpbench.
>
> This is a reland of 045d7513d7
>
> This will allow us to measure the impact (positive or negative) of
> inlining functions before submitting a shader to the driver.
> In previous trials, we encountered an issue with overloads of cross()
> which prevented us from collecting data on some platforms.
>
> Original change's description:
> > Performance experiment: Disable SkSL inliner in nanobench/skpbench.
> >
> > This is a reland of 3f35ac10b4
> >
> > Time to run this experiment again.
> >
> > Original change's description:
> > > Performance experiment: Disable SkSL inliner in nanobench/skpbench.
> > >
> > > This will allow us to measure the impact (positive or negative) of
> > > inlining functions before submitting a shader to the driver.
> > >
> > > Change-Id: Icbd64096445a353187b30feea68573d89ca18664
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> > > Commit-Queue: John Stiles <johnstiles@google.com>
> >
> > Change-Id: I278a770d4129f4ad0bf867c33a01b49a88cea588
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387256
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Change-Id: I49a1555bde93c339fda567fc85a85e937af95628
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388396
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: Ifd63edeb06fea8eea4ac0a4242c93449b288b074
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388796
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-24 19:21:25 +00:00
John Stiles
3f5bee1a7a Performance experiment: Disable SkSL inliner in nanobench/skpbench.
This is a reland of 045d7513d7

This will allow us to measure the impact (positive or negative) of
inlining functions before submitting a shader to the driver.
In previous trials, we encountered an issue with overloads of cross()
which prevented us from collecting data on some platforms.

Original change's description:
> Performance experiment: Disable SkSL inliner in nanobench/skpbench.
>
> This is a reland of 3f35ac10b4
>
> Time to run this experiment again.
>
> Original change's description:
> > Performance experiment: Disable SkSL inliner in nanobench/skpbench.
> >
> > This will allow us to measure the impact (positive or negative) of
> > inlining functions before submitting a shader to the driver.
> >
> > Change-Id: Icbd64096445a353187b30feea68573d89ca18664
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Change-Id: I278a770d4129f4ad0bf867c33a01b49a88cea588
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387256
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: I49a1555bde93c339fda567fc85a85e937af95628
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388396
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-24 13:24:50 +00:00
Mike Klein
f2b3f916fc split off --dylib from --jit in nanobench
This makes nanobench like the other tools.

Change-Id: I145cb559489588fa27f07d7e91b96105f7afcc81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388379
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-03-23 20:57:42 +00:00
John Stiles
345f140e83 Abort in Nanobench if a shader compilation error occurs.
Currently, Nanobench is silently reporting bad performance metrics when
a shader can't be compiled; this is, at the very least, misleading, and
can often cause real problems to be magnified or ignored.

Change-Id: I7a826dfd6e680e42a0c3eeebf76cc21cbd7f9dbb
Bug: skia:11776
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388140
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-23 17:11:54 +00:00
John Stiles
2ef627aba9 Add a custom ShaderErrorHandler to Nanobench.
In this CL, the custom ShaderErrorHandler retains the existing failure
mode of the DefaultShaderErrorHandler (using SkDEBUGFAILF) to minimize
breakage on the tree.

Change-Id: I52ecbcadf2ce93eaf47bf400b5faa8955f9526ca
Bug: skia:11776
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388139
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-23 15:53:08 +00:00
Herb Derby
0da2c146fd remove paint from SkGlyphRunList
Change-Id: I0f9027f1a360d90d2c91680d414a6591bc8192cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387956
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-03-23 15:21:48 +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
John Stiles
1a4fae1a5f Revert "Performance experiment: Disable SkSL inliner in nanobench/skpbench."
This reverts commit 045d7513d7.

Reason for revert: experiment complete

Original change's description:
> Performance experiment: Disable SkSL inliner in nanobench/skpbench.
>
> This is a reland of 3f35ac10b4
>
> Time to run this experiment again.
>
> Original change's description:
> > Performance experiment: Disable SkSL inliner in nanobench/skpbench.
> >
> > This will allow us to measure the impact (positive or negative) of
> > inlining functions before submitting a shader to the driver.
> >
> > Change-Id: Icbd64096445a353187b30feea68573d89ca18664
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Change-Id: I278a770d4129f4ad0bf867c33a01b49a88cea588
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387256
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

Change-Id: I54d417e65bd134dee72ff46e9331f8fabfc724df
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387536
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-21 14:30:49 +00:00
John Stiles
045d7513d7 Performance experiment: Disable SkSL inliner in nanobench/skpbench.
This is a reland of 3f35ac10b4

Time to run this experiment again.

Original change's description:
> Performance experiment: Disable SkSL inliner in nanobench/skpbench.
>
> This will allow us to measure the impact (positive or negative) of
> inlining functions before submitting a shader to the driver.
>
> Change-Id: Icbd64096445a353187b30feea68573d89ca18664
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: I278a770d4129f4ad0bf867c33a01b49a88cea588
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387256
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-20 15:10:16 +00:00
Herb Derby
3401d5eb22 improve SkParagraph's bench accuracy
Call onDraw in onDelayedSetup to warm up the glyph cache
otherwise nanobench will mis-caclulate the loop count.

This change also reduces the variability of the benchmark.

Change-Id: I5f3f2167cc78b996fcb589644b70622d18af240b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386816
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-03-19 14:14:48 +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
fd708655ae Reland "Add tooling support for dmsaa"
Reland 188443be8d without the DMSAA bots
to ensure nothing else changes.

Original change's description:
> Add tooling support for dmsaa
>
> Adds a "fAlwaysAntiAlias" flag to GrContextOptions that can be set from
> tooling code. When dmsaa is set, SkGpuDevice draws everything
> antialiased. Adds new "gldmsaa" and "glesdmsaa" configs and creates bots
> to run them.
>
> Bug: skia:11396
> Change-Id: I165e89434b733f7b02312cea0e6649812528083b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com

Bug: skia:11396
Change-Id: Icb45097e0a34543dc577fa32f19a692e90643a35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386338
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-18 04:57:10 +00:00
Chris Dalton
22dd57b82c Revert "Add tooling support for dmsaa"
This reverts commit 188443be8d.

Reason for revert: It looks like non-dmsaa bots might have been
affected. Let's land first without the new bots to make sure nothing
else changes.

Original change's description:
> Add tooling support for dmsaa
>
> Adds a "fAlwaysAntiAlias" flag to GrContextOptions that can be set from
> tooling code. When dmsaa is set, SkGpuDevice draws everything
> antialiased. Adds new "gldmsaa" and "glesdmsaa" configs and creates bots
> to run them.
>
> Bug: skia:11396
> Change-Id: I165e89434b733f7b02312cea0e6649812528083b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ib805b417ebd34d1fad79e0e1fe625765ee487f65
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386336
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Auto-Submit: Chris Dalton <csmartdalton@google.com>
2021-03-17 23:36:12 +00:00
Mike Reed
fc32405ff2 Revert "Revert "Add bench for skparagraph""
Fix: check for successful fParagraph creation

This reverts commit ead52dc068.

Change-Id: Id122877935affaaa33ac791e6c5b69c571267adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385879
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-17 18:05:10 +00:00
Chris Dalton
188443be8d Add tooling support for dmsaa
Adds a "fAlwaysAntiAlias" flag to GrContextOptions that can be set from
tooling code. When dmsaa is set, SkGpuDevice draws everything
antialiased. Adds new "gldmsaa" and "glesdmsaa" configs and creates bots
to run them.

Bug: skia:11396
Change-Id: I165e89434b733f7b02312cea0e6649812528083b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384936
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-17 15:58:40 +00:00
Chris Dalton
180b4a1422 Update tooling code to store surface flags instead of "useDIText"
Change-Id: I4556a6222f358c4a853318703a406caea65d0fd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-17 15:09:30 +00:00
John Stiles
d2702fa155 Update SkSL benchmark code to match actual Skia output.
Our benchmarks had drifted away from actual codegen in several ways, and
were no longer representative of actual output. In particular, every
function in the existing benchmarks used a scratch `_output` variable
which would make it ineligible for return-statement-only inlining.

Updated the tests to match modern codegen. `small` and `large` use the
same sources as before. The code from `medium` is older and had diverged
quite far from today's output; I could not find a representative code
snippet at all. It has been replaced with SkSL of roughly similar
complexity.

Change-Id: Iadd32cbb6725554355ddfe384ce538f3dc49aca3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385160
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-16 13:59:23 +00:00
Mike Reed
ead52dc068 Revert "Add bench for skparagraph"
This reverts commit 1aa25c3217.

Reason for revert: crashing on windows bots

Original change's description:
> Add bench for skparagraph
>
> Change-Id: Ib33e06527660b33984b9171f51026a935ef99f79
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385156
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com,jlavrova@google.com

Change-Id: I7b8524c449f3c484b777af31f83e1372a689de55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385163
Reviewed-by: Mike Reed <reed@google.com>
2021-03-15 22:55:40 +00:00
Mike Reed
1aa25c3217 Add bench for skparagraph
Change-Id: Ib33e06527660b33984b9171f51026a935ef99f79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385156
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-15 22:32:16 +00:00
John Stiles
46e7507b0d Revert "Performance experiment: Disable SkSL inliner in nanobench/skpbench."
This reverts commit 3f35ac10b4.

Reason for revert: concluding experiment

Original change's description:
> Performance experiment: Disable SkSL inliner in nanobench/skpbench.
>
> This will allow us to measure the impact (positive or negative) of
> inlining functions before submitting a shader to the driver.
>
> Change-Id: Icbd64096445a353187b30feea68573d89ca18664
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

Change-Id: Ia7c34e3e2bb4f777a4bd18a5646e494eeb3c93ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384456
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-13 13:08:19 +00:00
John Stiles
3f35ac10b4 Performance experiment: Disable SkSL inliner in nanobench/skpbench.
This will allow us to measure the impact (positive or negative) of
inlining functions before submitting a shader to the driver.

Change-Id: Icbd64096445a353187b30feea68573d89ca18664
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384317
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-12 20:45:08 +00:00
Brian Osman
3527389e28 Add a benchmark of filterColor4f with the matrix color filter
Bug: skia:11730
Change-Id: Icbb1f6acf31e3f130cb48338a1c44ca14f40e587
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383697
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-03-11 16:21:40 +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
Herb Derby
63fe8e53dd move subrun creation to GrTextBlob::Make
Change-Id: Iee920e3751e067ff3b86ed6713b279fc2437fd14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381477
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-09 16:53:35 +00:00
Herb Derby
bf2dd2af49 Reland "rename GrSDFTOptions to GrSDFTControl"
This is a reland of 40a9061203

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Change-Id: Iba0816159a8ef99448a0040c487e56700b96be5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379845
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-05 15:24:35 +00:00
Mike Reed
9edff53a73 Revert "rename GrSDFTOptions to GrSDFTControl"
This reverts commit 40a9061203.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I0483cbada23c76bdd5ccdb51936bb20a819343cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379839
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:15:22 +00:00
Herb Derby
40a9061203 rename GrSDFTOptions to GrSDFTControl
Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-04 19:49:10 +00:00
Herb Derby
9ad09829f5 encapsulate GrSDFTOptions better
The logic for picking what type of sub run to create is spread
over several locations. Gather that altogether in drawingType().

Have GrSDFT close over all the data needed to calculate the
drawing type. This reduces plumbing to the processGlyphRun
routine.

The next CL should rename GrSDFTOptions to GrSDFTControl.

Change-Id: I99e74c11af6d3b3d9919e54fe1e7286fcfbf1bfb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378036
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-03 14:27:32 +00:00