Commit Graph

2309 Commits

Author SHA1 Message Date
Mike Reed
295cdf8775 use SkM44 internally
Today we use SkM44 in canvas, and SkMatrix44 in sksl (and colormatrix).
This CL tries to move core to use a single type.

SkMatrix44 has callers in android and chrome, is loaded with double/float
variants in its API. I am suggesting moving to a private, clean-start,
API for internal use. SkM44 is much faster, and has a leaner API.

If eventually we can migrate clients to a shared impl/api, great. For now,
I want to have one we are free to optimize/use as we see fit without
worrying about changing client results.

Change-Id: Id782ac1cc8b8d7f6621970e44e1f9729964d2a94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265299
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-22 17:39:15 +00:00
Mike Reed
55f6fc3064 IWYU -- colorspace no longer includes matrix44
Change-Id: I659552466940b76a339caaf124700303806fd082
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265456
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-21 21:37:32 +00:00
Ethan Nicholas
99c54f0290 Revert "Complete rewrite of the SkSL interpreter"
This reverts commit 2cde3a1320.

Reason for revert: breaking the Chrome roll

Original change's description:
> Complete rewrite of the SkSL interpreter
> 
> Change-Id: Idf4037b04c22f8ace5c1ef16c7a28d8c3df92e91
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250817
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: If0fbc78118173e0cacbe1e01cabe3331e35aa49e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265516
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-01-21 16:07:08 +00:00
Ethan Nicholas
2cde3a1320 Complete rewrite of the SkSL interpreter
Change-Id: Idf4037b04c22f8ace5c1ef16c7a28d8c3df92e91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250817
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-21 14:49:59 +00:00
Mike Reed
215c34be2b SkMScalar is obsolete -- use SkScalar
Bug: skia:
Change-Id: I6a29039aa4dcc25cc804db4bdc685b8dc119f216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265298
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 12:47:48 +00:00
Mike Reed
d4d3b33624 Make converting from 4x4 to 3x3 explicit
Change-Id: I4d190d6831cb517d5e9f22b3f872013367bddc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264856
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-16 22:15:30 +00:00
Mike Klein
b147aceed7 DCI-P3 -> Display P3 in Skia
This keeps an alias so code keeps building.

Bug: skia:9792
Change-Id: If8575468d929d2ca28bc2f9e82de27291fb19aa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264691
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-16 21:24:16 +00:00
Mike Klein
ea4459d6f8 add new debug/profiling mechanism
Dump the program code, link it into a dynamic library,
then dlopen() / dlsym() it to get the entry point.

This makes profiling in Instruments work,
and probably also makes gdb work better.

This is quite slow so I've made it opt-in,
opting only nanobench in for now.

$ ninja -C out nanobench
$ instruments -t "Time Profiler" out/nanobench --config 8888 -m bitmap_RGBA_8888_A_scale_bilerp --skvm
~~> https://screenshot.googleplex.com/nw1L83qjqV6
~~> https://screenshot.googleplex.com/49HSo6Xpzcs

Change-Id: I9f91c675149178021a7a05030541a5965afbbcb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264748
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-01-16 19:59:54 +00:00
Mike Reed
c4b8eefe56 move SkV3 into header
Change-Id: I20284b415bbfe5ecc15fe9fe47dcbb65850d4368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 11:34:32 +00:00
Mike Klein
2a57e79921 add --skvm to nanobench and fm
This might be easier than building with SK_USE_SKVM_BLITTER defined.

Change-Id: I72c1f361195bacf5a14e6633dd49e9a5ad721cff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264383
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-14 21:53:28 +00:00
Mike Reed
064c7f9f1c Optimize concat44 on canvas
- allow clients to pass in raw-array at public level
- rewrite m44 concat to take raw-array for 2nd input

Extended canvas_matrix bench to also time 44 concats:

Before
    207.51  	canvas_matrix_4x4	8888
    100.75 ?	canvas_matrix_3x3	8888
    100.79  	canvas_matrix_2x3	8888
    140.93  	canvas_matrix_scale	8888
    133.35  	canvas_matrix_trans	8888

After
    120.80  	canvas_matrix_4x4	8888
    ...

bug: skia:9768

Change-Id: Iaa361b9897a183d930fd31aa67327caed25cd51d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263209
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-09 13:39:17 +00:00
Michael Ludwig
9abd568371 Reland "Avoid loop-dependent behavior in GrMemoryPoolBench"
This reverts commit dff4c1d5fd.

Reason for revert: Fix WIP

Original change's description:
> Revert "Avoid loop-dependent behavior in GrMemoryPoolBench"
> 
> This reverts commit f811fc331a.
> 
> Reason for revert: breaks on iOS
> 
> Original change's description:
> > Avoid loop-dependent behavior in GrMemoryPoolBench
> > 
> > This helps stability of benchmark across repeated runs, and across code
> > changes. Previously, a change to the tuned loop count could radically
> > change the allocation behavior within the loop's iteration and lead to
> > unfair comparisons.
> > 
> > In addition, this separates the stack allocation pattern into N allocations
> > followed by N LIFO releases, and a push-pop alternating pattern of N
> > allocates and releases (so still LIFO, but reuses the memory at the start
> > of a block).
> > 
> > In later CLs experimenting on the memory pool, I found that there were
> > surprising effects on performance linked to the specific interaction between
> > the allocation size, per-allocation metadata, and per-block metadata. To
> > help differentiate these coincidences, this adds two modes of allocation
> > where one should already be aligned.
> > 
> > It also moves away from a global pool, so that it's possible to benchmark
> > on different block sizes and factor in the allocation/release cost of the
> > actual blocks (vs. the cursor management of a larger sized pool). As part
> > of this, the new/delete reference operator is added as an explicit benchmark.
> > 
> > Change-Id: I12b8c11cb75db0df70460fe2e8cf6c029db7eb22
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262936
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> 
> TBR=bsalomon@google.com,michaelludwig@google.com
> 
> Change-Id: I16f2810699a378eb5a516ab9fb1834c10b65f01b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263029
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

Change-Id: I51a9db111c26b49572c3fa0928e26ef6e5a7a74c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263196
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-08 21:09:43 +00:00
Greg Daniel
e20fcad156 Reland "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit a4f207eb67.

Reason for revert: Landing with fix

Original change's description:
> Revert "Move makeDeferredRenderTargetContext calls to factory on RTC."
>
> This reverts commit 1c16b43033.
>
> Reason for revert: Red on tree
> Original change's description:
> > Move makeDeferredRenderTargetContext calls to factory on RTC.
> >
> > Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com
>
> Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: If4ec8316a952fb482471c22273f4724f9b30a998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263022
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-08 19:13:14 +00:00
Mike Reed
403c807971 Revert "Revert "Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.""
The reason for the assert was breaking an assert, that if the CTM was scale/translate, that after
a preTranslate, it should still be that.

This is true... unless the new translate values are non-finite. In that case, we might turn a zero
into a NaN, (0 * non_finite --> nan), so we either have to require finite args (which we don't
at the moment) or we can't make this assert. This re-land removes that assert.

This reverts commit 268ed57d71.

Change-Id: I3c48a0aa17649351a246c1fbab5449f2d59aaf84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263023
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-08 16:13:51 +00:00
Michael Ludwig
dff4c1d5fd Revert "Avoid loop-dependent behavior in GrMemoryPoolBench"
This reverts commit f811fc331a.

Reason for revert: breaks on iOS

Original change's description:
> Avoid loop-dependent behavior in GrMemoryPoolBench
> 
> This helps stability of benchmark across repeated runs, and across code
> changes. Previously, a change to the tuned loop count could radically
> change the allocation behavior within the loop's iteration and lead to
> unfair comparisons.
> 
> In addition, this separates the stack allocation pattern into N allocations
> followed by N LIFO releases, and a push-pop alternating pattern of N
> allocates and releases (so still LIFO, but reuses the memory at the start
> of a block).
> 
> In later CLs experimenting on the memory pool, I found that there were
> surprising effects on performance linked to the specific interaction between
> the allocation size, per-allocation metadata, and per-block metadata. To
> help differentiate these coincidences, this adds two modes of allocation
> where one should already be aligned.
> 
> It also moves away from a global pool, so that it's possible to benchmark
> on different block sizes and factor in the allocation/release cost of the
> actual blocks (vs. the cursor management of a larger sized pool). As part
> of this, the new/delete reference operator is added as an explicit benchmark.
> 
> Change-Id: I12b8c11cb75db0df70460fe2e8cf6c029db7eb22
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262936
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I16f2810699a378eb5a516ab9fb1834c10b65f01b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263029
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-01-08 15:54:21 +00:00
Michael Ludwig
f811fc331a Avoid loop-dependent behavior in GrMemoryPoolBench
This helps stability of benchmark across repeated runs, and across code
changes. Previously, a change to the tuned loop count could radically
change the allocation behavior within the loop's iteration and lead to
unfair comparisons.

In addition, this separates the stack allocation pattern into N allocations
followed by N LIFO releases, and a push-pop alternating pattern of N
allocates and releases (so still LIFO, but reuses the memory at the start
of a block).

In later CLs experimenting on the memory pool, I found that there were
surprising effects on performance linked to the specific interaction between
the allocation size, per-allocation metadata, and per-block metadata. To
help differentiate these coincidences, this adds two modes of allocation
where one should already be aligned.

It also moves away from a global pool, so that it's possible to benchmark
on different block sizes and factor in the allocation/release cost of the
actual blocks (vs. the cursor management of a larger sized pool). As part
of this, the new/delete reference operator is added as an explicit benchmark.

Change-Id: I12b8c11cb75db0df70460fe2e8cf6c029db7eb22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262936
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-08 15:24:11 +00:00
Brian Osman
268ed57d71 Revert "Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API."
This reverts commit 98bfcc7ff3.

Reason for revert: Flutter hitting assert:
../../third_party/skia/src/core/SkCanvas.cpp:1432: fatal error: "assert(fIsScaleTranslate == fMCRec->fMatrix.isScaleTranslate())"

Original change's description:
> Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.
> 
> Devices receive the 4x4, but by default they simply downsample it to SkMatrix.
> 
> New SkM44 matrix for the impl. It differs from SkMatrix44 in a few ways
> - no tracking of "type"
> - faster for concat, as it does not use doubles for intermediates
> - much simpler API
> 
> There are some low-bit differences in some gms, so adding a flag for clients to
> stage this change. (due to faster but lower-precision in SkM44::concat)
> 
> Performance: running canvas_matrix bench
> 
> 3x3 version:
> 
>     167.93  	canvas_matrix_3x3	8888
>     209.97  	canvas_matrix_2x3	8888
>     174.87  	canvas_matrix_scale	8888
>     135.30  	canvas_matrix_trans	8888
> 
> 4x4 version:
> 
>     116.59  	canvas_matrix_3x3	8888
>     105.40  	canvas_matrix_2x3	8888
>     159.83 ?	canvas_matrix_scale	8888
>     113.47  	canvas_matrix_trans	8888
> 
> Why faster?
> - not tracking matrix_type helps a lot it seems
> - faster full concat (no doubles)
> 
> Before adding the specialized preConcats...
> 
>     318.11 ?	canvas_matrix_3x3	8888
>     339.38  	canvas_matrix_2x3	8888
>     383.28  	canvas_matrix_scale	8888
>     251.67  	canvas_matrix_trans	8888
> 
> Change-Id: I68eac942919fa5418081e789f31710a1e2a752da
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262056
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,bsalomon@google.com,herb@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,michaelludwig@google.com

Change-Id: I28c3d69c19ba44ab65ca7c059221b64c7dffef22
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263021
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-08 14:28:11 +00:00
Jim Van Verth
a4f207eb67 Revert "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit 1c16b43033.

Reason for revert: Red on tree
Original change's description:
> Move makeDeferredRenderTargetContext calls to factory on RTC.
> 
> Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-08 13:31:21 +00:00
Greg Daniel
1c16b43033 Move makeDeferredRenderTargetContext calls to factory on RTC.
Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-07 21:14:13 +00:00
Mike Reed
98bfcc7ff3 Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.
Devices receive the 4x4, but by default they simply downsample it to SkMatrix.

New SkM44 matrix for the impl. It differs from SkMatrix44 in a few ways
- no tracking of "type"
- faster for concat, as it does not use doubles for intermediates
- much simpler API

There are some low-bit differences in some gms, so adding a flag for clients to
stage this change. (due to faster but lower-precision in SkM44::concat)

Performance: running canvas_matrix bench

3x3 version:

    167.93  	canvas_matrix_3x3	8888
    209.97  	canvas_matrix_2x3	8888
    174.87  	canvas_matrix_scale	8888
    135.30  	canvas_matrix_trans	8888

4x4 version:

    116.59  	canvas_matrix_3x3	8888
    105.40  	canvas_matrix_2x3	8888
    159.83 ?	canvas_matrix_scale	8888
    113.47  	canvas_matrix_trans	8888

Why faster?
- not tracking matrix_type helps a lot it seems
- faster full concat (no doubles)

Before adding the specialized preConcats...

    318.11 ?	canvas_matrix_3x3	8888
    339.38  	canvas_matrix_2x3	8888
    383.28  	canvas_matrix_scale	8888
    251.67  	canvas_matrix_trans	8888

Change-Id: I68eac942919fa5418081e789f31710a1e2a752da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262056
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-07 18:23:04 +00:00
Brian Osman
ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00
Brian Osman
1bf3199970 Fix asserts in SkRuntimeEffect color filter benchmarks
The interpreter doesn't (yet) support all GPU intrinsics, so adjust the
code to avoid 'max' and 'saturate'.

The interpreter is more picky about uniform blocks being the correct
size, so don't pass the color matrix data to the "None" effect, which
has no uniforms.

Change-Id: I4609f913eaa762ca171b2875eb25d23141a0646c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261931
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-02 17:19:51 +00:00
Brian Osman
4ee635638f Add SkRuntimeEffect::makeColorFilter
Updated internal usage of SkRuntimeColorFilterFactory to use this
instead. Once this lands, we can update SkiaRenderer in Chrome to
use it, and remove SkRuntimeColorFilterFactory.

This doesn't support a CPU callback function in the runtime color
filter - I don't think we're going to support that in the long term.

Change-Id: I714413bd590cf5cf4416ef62809a6e1d92211688
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261681
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 15:01:46 +00:00
Mike Reed
77cf430eaf starter bench for canvas matrix operations
Change-Id: I5f064183e73492ab192895eba03d29e41b1edaa6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261739
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-30 15:48:26 +00:00
Mike Reed
8845c377c0 extend imageshader updater to handle perspective
- have to commit to a perspective stage (used to only use affine)
- coordinate between updater and shader/stages

Benches:

verts 608  --> 270
atlas 17.9 --> 5.6

Change-Id: I1d1ce9eb27b49d2ddcc610f6ea5c4720901b9e1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261136
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-19 18:56:39 +00:00
Brian Osman
9d10abe300 Remove all layout(ctype=...) from runtime SkSKL
Most of these did nothing, and I'd like to remove the feature. Also, the
benchmark was using 'in uniform' which isn't supported (it asserts in
debug build).

Change-Id: I671ca69fdd50811a2090c7a03f5f23e6b38e6f96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260043
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-13 22:02:03 +00:00
Mike Klein
f46d5ca492 use std::make_unique
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-12-12 22:32:45 +00:00
Brian Salomon
6986c6539e Make Gr[Op]MemoryPool allocate itself into its initial block.
Saves one heap allocation per DDL recorded.

Change-Id: I9393aedc3b48031cd2ea5f0160b107915077099a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259419
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-12 20:33:40 +00:00
Robert Phillips
3968fcbc3a Pull creation of GrPipeline explicitly into the Ops' onExecute methods
This is a first step towards pulling the creation of the GrProgramInfos explicitly into the Ops' onExecute methods. We need this behavior so programInfo creation can be moved forward to onPrePrepare.

For now, pipeline creation is a static member on GrSimpleMeshDrawOpHelper so GrPipeline creation can be bottle-neckedOps for Ops that don't use the helper. In some future world CreatePipeline could become non-static to reduce some of the duplicate code.

Bug: skia:9455
Change-Id: I2d35dd223db824e84616f5df0f1dca34c1b6e412
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258003
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-06 16:33:15 +00:00
Mike Klein
b78729a8f3 Fix some GCC warnings.
Drop unnecessary () in `const char* (*fText)`.  Sure, whatever.

Then a couple tweaks where we use strncpy():

    In one case in SkICC.cpp, GCC warns us we're passing sizeof(dst) as
    the copy count, which can be error prone because you may miss a
    terminating nul.  I believe the existing strncpy() behavior is what
    we want here, so I've stifled this and left a note.  We don't really
    want a terminating nul... we want a zero fill of the remaining dst.

    On the other side of that if-statment in that same function, GCC
    warns that we've passed exactly sizeof(src) as the copy count when
    writing the calculated description prefix, which again might be
    buggy due to a missed terminating nul.  Seemed like memcpy() was the
    way to go here for that prefix. Ultimately we check to make sure we
    wrote every single destination byte.

    Over in SkPDFMetadata.cpp, strncpy() is concerned once again that
    we're copying strlen(src) and thus omitting the terminating nul.  As
    usual we don't want that terminating nul, so switch to memcpy() to
    make that explicit.

I'm starting to think strncpy() is too helpful to reason about sanely.

Change-Id: I1bcd5f4e406ca388c1c236c5f3ee531bf1737705
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257408
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-12-03 16:21:40 +00:00
Brian Salomon
c241b58965 Make fragment processor iterators work with range for loops.
When iterating over the coord transforms or texture samplers of a
FP also have access to the owning FP.

Pass a coord transform range to GPs rather than a pointer to an
iterator.

Change-Id: If7c829a67dce6600d7f49e12d6f49f685dcace3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256216
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-27 14:32:43 +00:00
Mike Reed
7d34dc7747 Revert "Revert "switch to new filltype for SkPath""
This reverts commit 3e7af41224.

Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-11-26 17:43:14 +00:00
Mike Reed
3e7af41224 Revert "switch to new filltype for SkPath"
This reverts commit 3a50981a83.

Reason for revert: chrome win build found compile-problem in xpsdevice

Original change's description:
> switch to new filltype for SkPath
> 
> Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: Iacb3566da61c2512b9bd6b7e42b592febc85e031
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256530
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-26 03:34:30 +00:00
Mike Reed
3a50981a83 switch to new filltype for SkPath
Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-25 22:31:46 +00:00
Mike Reed
30bc527fd6 Revert "Reland "Revert "Use flat version of path-direction enum"""
This reverts commit 7cda6f3743.

Reason for revert: legacy convexity code removed -- google3 should be ok

Original change's description:
> Reland "Revert "Use flat version of path-direction enum""
>
> This reverts commit 1792b19485.
>
> Reason for revert: need to update legacy_convexity, still used by google3
>
> Original change's description:
> > Revert "Revert "Use flat version of path-direction enum""
> >
> > This reverts commit 0dacc6b7d3.
> >
> > Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> > Auto-Submit: Mike Reed <reed@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
>
> TBR=reed@google.com
>
> Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3529139bb391c4f62ce5cd0744cdf38a13b71d78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255984
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-22 19:09:54 +00:00
Mike Reed
7cda6f3743 Reland "Revert "Use flat version of path-direction enum""
This reverts commit 1792b19485.

Reason for revert: need to update legacy_convexity, still used by google3

Original change's description:
> Revert "Revert "Use flat version of path-direction enum""
> 
> This reverts commit 0dacc6b7d3.
> 
> Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> Auto-Submit: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-22 11:03:34 +00:00
Mike Reed
1792b19485 Revert "Revert "Use flat version of path-direction enum""
This reverts commit 0dacc6b7d3.

Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-22 00:51:22 +00:00
Mike Reed
0dacc6b7d3 Revert "Use flat version of path-direction enum"
This reverts commit e0fbe94351.

Reason for revert: need to add guard flag to flutter

Original change's description:
> Use flat version of path-direction enum
> 
> Bug: skia:9663
> Change-Id: I00077d9f2b14b3e983e6a46ef6f560cabdb1678d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242557
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: If47173d9b203b2d3a175af290a15d986accb4703
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9663
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255831
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-21 22:10:32 +00:00
Mike Reed
e0fbe94351 Use flat version of path-direction enum
Bug: skia:9663
Change-Id: I00077d9f2b14b3e983e6a46ef6f560cabdb1678d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242557
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-11-21 21:45:20 +00:00
Robert Phillips
7cd0bfe769 No longer ref count GrGeometryProcessors
This CL is 100% plumbing. We ultimately want all GrPrimitiveProcessor-derived objects to not be refCounted. This will make several helper objects POD and, by putting them into an arena, will make managing their lifetime easier (e.g., for DDL prePreparing).

Note: the CCPR GrGeometryProcessor-derived classes only ever appear on the stack so aren't forced into arenas.

Bug: skia:9455
Change-Id: Ib9be503d2fbf8c2578642df93fc301156629829d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255304
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-20 21:36:52 +00:00
Mike Reed
a2b3b9efb8 Expose the owning surface to a canvas?
Handy if you want to flush, or otherwise understand the underlying buffer(s).

Change-Id: I3d6610695c8603232192b26c687c6c74512165dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254803
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-15 21:48:32 +00:00
Mike Reed
2319b803c2 remove unused (by clients) SkMultiPictureDraw
More cleaning to do if we like this idea...

Change-Id: I608143db085911565dd5f5426f7ee6436ec58cdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254680
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-15 18:18:36 +00:00
Robert Phillips
cea290f9d5 Add GrPrimitiveType to GrProgramInfo
This further consolidates the information required to compute the program key (esp. for Vulkan). This CL mainly comprises the plumbing portion - a follow up CL will actually use it.

Bug: skia:9455
Change-Id: Iaac716c289916981a1757a333bfa57b3051fd35b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252161
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-07 13:30:42 +00:00
Robert Phillips
e94cdd2dbc Use QuadHelper and PatternHelper in more places
Propagating usage of these helpers will, hopefully, improve code reuse and centralize future changes.

This is pulled out of https://skia-review.googlesource.com/c/skia/+/252161/ (Add GrPrimitiveType to GrProgramInfo)

Bug: skia:9455
Change-Id: I9b46e42db8561d98fb724a41a1f7a3bec4bf97b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252484
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-04 20:32:36 +00:00
Michael Ludwig
1beb8ae9a2 Reland "Add variety of bulk API benchmarks"
This reverts commit 659b21d480.

Reason for revert: Fixed skipping nonrendering benchmark

Original change's description:
> Revert "Add variety of bulk API benchmarks"
>
> This reverts commit e63595dd85.
>
> Reason for revert: Breaking the Perf tests:
>
> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
> Command exited with code 139
> #######################################
> symbolized stacktrace follows
> #######################################
> build/nanobench BulkRectBench<1000, (RectangleLayout)1, (ImageMode)2, (DrawMode)2>::onPerCanvasPreDraw(SkCanvas*) at skia/bench/BulkRectBench.cpp:218
> build/nanobench main at skia/bench/nanobench.cpp:1277
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f1213dad2e1]
> build/nanobench _start at ??:?
>
>
>
>
>
> Original change's description:
> > Add variety of bulk API benchmarks
> >
> > Covers drawing 1000 anti-aliased rectangles, either sharing 1 image, using
> > a unique image, or as a solid color. Tests using the bulk APIs and regular
> > one-at-a-time drawing.
> >
> > Change-Id: Icdf5a1f6df229aed785212d0941b89c11aa785c0
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251003
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,egdaniel@chromium.org,michaelludwig@google.com
>
> Change-Id: I3b26d5a04c472993585242a108c2764ea2b96940
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251213
> Reviewed-by: Joe Gregorio <jcgregorio@google.com>
> Commit-Queue: Joe Gregorio <jcgregorio@google.com>

Change-Id: I83538faa29ada5ab1b02ff07ae9fe90734ed198e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251238
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-10-28 18:48:32 +00:00
Joe Gregorio
659b21d480 Revert "Add variety of bulk API benchmarks"
This reverts commit e63595dd85.

Reason for revert: Breaking the Perf tests:

ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Command exited with code 139
#######################################
symbolized stacktrace follows
#######################################
build/nanobench BulkRectBench<1000, (RectangleLayout)1, (ImageMode)2, (DrawMode)2>::onPerCanvasPreDraw(SkCanvas*) at skia/bench/BulkRectBench.cpp:218
build/nanobench main at skia/bench/nanobench.cpp:1277
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f1213dad2e1]
build/nanobench _start at ??:?
  




Original change's description:
> Add variety of bulk API benchmarks
> 
> Covers drawing 1000 anti-aliased rectangles, either sharing 1 image, using
> a unique image, or as a solid color. Tests using the bulk APIs and regular
> one-at-a-time drawing.
> 
> Change-Id: Icdf5a1f6df229aed785212d0941b89c11aa785c0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251003
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,egdaniel@chromium.org,michaelludwig@google.com

Change-Id: I3b26d5a04c472993585242a108c2764ea2b96940
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251213
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2019-10-28 16:29:35 +00:00
Michael Ludwig
e63595dd85 Add variety of bulk API benchmarks
Covers drawing 1000 anti-aliased rectangles, either sharing 1 image, using
a unique image, or as a solid color. Tests using the bulk APIs and regular
one-at-a-time drawing.

Change-Id: Icdf5a1f6df229aed785212d0941b89c11aa785c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251003
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-28 16:20:04 +00:00
Hal Canary
5dfefa2452 nanobench: option to execute directory of TextBlobTraces as benches
Follow on to https://review.skia.org/250259

Change-Id: I794a59dd8227042423c094bd5f7825cfa27da94c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250756
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-10-25 13:28:49 +00:00
Hal Canary
2362ae7b8c [minor] nanobench: use default member initializer
Change-Id: I0324b89d44805b18d5d31a27ec3825633daeb32d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250659
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-24 20:15:03 +00:00
Hal Canary
e107faa062 SkRemoteGlyphCache Add tracing to diff canvas
Use `extra_cflags=["-DSK_CAPTURE_DRAW_TEXT_BLOB"]` to enable.

Change-Id: I1d6db478ee91696cdce090647b889c17a83a2718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250259
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-24 17:09:31 +00:00