Commit Graph

2400 Commits

Author SHA1 Message Date
Herb Derby
a08bde606a GrTextContext::Options -> GrSDFTOptions
Rename GrTextContext::Options to GrSDFTOptions. Remove GrTextContext.

TBR=reed@google.com

Change-Id: Ic89966cfe630cc6ee757977a6d63ae1da9e39ef0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296176
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-15 17:14:04 +00:00
Mike Reed
82d619699d remove (unused) clipmask from savelayer
Change-Id: I44f64a8c98c019a8f4878b0b6f6d82489aa8252c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296179
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-06-15 14:26:44 +00:00
John Stiles
616da104ab Allow printf-style formatting to be used in SK_ABORT.
(This is a simple reland of
    https://skia-review.googlesource.com/c/skia/+/293272
and is functionally unchanged, but needed to be reconstructed
manually because JavaInputStreamAdaptor.cpp was deleted.)

SK_ABORT was already using SkDebugf to print the error message to the
console, so all the moving parts were there. This CL just adds a
mechanism for the calling code to pass in arguments.

Added a use case to demonstrate usage--when an allocation fails, the
requested size is now shown in the error message.

Change-Id: If8600a9febad15b7c8b7a04479a1d92442521f21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294705
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-12 20:26:34 +00:00
Chris Dalton
b96995d05f Handle tessellated paths that require more segments than are supported
Adds a method to determine the worst-case number of tessellated line
segments that a path might require, and disables hardware tessellation
if it is more segments than are supported (falling back on indirect
draw shaders).

If the path requires even more segments than are supported by the
indirect draw shaders (1024), we crop the path to the viewport. The
required number of segments is proportional to the square root of the
bounding box's diagonal, so we won't start cropping paths until their
device-space bounding box diagonal is nearly 175,000 pixels long.

Change-Id: I8a9435e70bb93dda3464cc11a3e44fbe511744ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293691
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-06-05 15:33:19 +00:00
John Stiles
7a8e394496 Revert "Allow printf-style formatting to be used in SK_ABORT."
This reverts commit 67e50a6b5c.

Reason for revert: roller complains about LICENSE issue. cl/314177415

Original change's description:
> Allow printf-style formatting to be used in SK_ABORT.
> 
> SK_ABORT was already using SkDebugf to print the error message to the
> console, so all the moving parts were there. This CL just adds a
> mechanism for the calling code to pass in arguments.
> 
> Added a use case to demonstrate usage--when an allocation fails, the
> requested size is now shown in the error message.
> 
> Change-Id: I42f141151fb57a399c086926249816833f349ddb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293272
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

TBR=djsollen@google.com,bungeman@google.com,herb@google.com,johnstiles@google.com

Change-Id: I7a2e98bcda82bbe6edfa3d00057586754df0ee71
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293342
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-01 19:32:08 +00:00
John Stiles
67e50a6b5c Allow printf-style formatting to be used in SK_ABORT.
SK_ABORT was already using SkDebugf to print the error message to the
console, so all the moving parts were there. This CL just adds a
mechanism for the calling code to pass in arguments.

Added a use case to demonstrate usage--when an allocation fails, the
requested size is now shown in the error message.

Change-Id: I42f141151fb57a399c086926249816833f349ddb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293272
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-06-01 18:49:37 +00:00
Mike Reed
b42a327926 hide savelayer's clipmask fields
Bug: skia:9208
Change-Id: Ieff64b3132e7bf4a51ce9d70ea2f1bad492616da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223923
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-31 14:06:42 +00:00
Michael Ludwig
7c12e28cf4 Reland "GrClips provided as pointers to GrRTC"
This reverts commit 074414fed5.

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

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

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

# Not skipping CQ checks because this is a reland.

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

Reason for revert: Breaks Android roller

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

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

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

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

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

Bug: skia:10205
Change-Id: Ie30cc71820b92d99356d393a4c98c8677082e761
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290539
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-28 18:55:13 +00:00
Ben Wagner
ebebf6e2b5 Move SkParagraph bits into skparagraph directory.
This makes it more obvious that these files really are part of
SkParagraph and integrate with the Skia test framework and are not part
of core Skia. This is more like how Skottie is setup and helps prevent
misunderstandings about where additional files like this should go and
how the build should be structured.

Change-Id: Iaac060c97cffd2b0c29833c7b0403521d91bdb6a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292439
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-05-28 13:59:18 +00:00
Chris Dalton
1443c9df58 Create indirect index buffer for tessellation during onPrepare
Change-Id: I78d74976fa2252da2a40862c241a99b68d27fb40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292259
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-27 17:20:57 +00:00
Chris Dalton
b5391d98b8 Reland "Reland "Add a tessellation mode that uses indirect draws""
This is a reland of 477512c0b3

Original change's description:
> Reland "Add a tessellation mode that uses indirect draws"
>
> This is a reland of 02d7cf79be
>
> Original change's description:
> > Add a tessellation mode that uses indirect draws
> >
> > This mode is oftentimes faster than tessellation, and other times it
> > serves as a polyfill when tessellation just isn't supported.
> >
> > Change-Id: I7b3d57fd0194c6869bfe28ee53ff0ff2e43df479
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291036
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> TBR=brianosman@google.com
>
> Change-Id: Ia039d7897499a7dad55aff1072f9aa0d01001f9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291693
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=brianosman@google.com

Change-Id: I55704b5adf5a7677a5382d07d39cadee9b252731
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291738
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-25 02:26:58 +00:00
Chris Dalton
0e6d4f1bcf Revert "Reland "Add a tessellation mode that uses indirect draws""
This reverts commit 477512c0b3.

Reason for revert: Undefined behavior in benchmark

Original change's description:
> Reland "Add a tessellation mode that uses indirect draws"
> 
> This is a reland of 02d7cf79be
> 
> Original change's description:
> > Add a tessellation mode that uses indirect draws
> >
> > This mode is oftentimes faster than tessellation, and other times it
> > serves as a polyfill when tessellation just isn't supported.
> >
> > Change-Id: I7b3d57fd0194c6869bfe28ee53ff0ff2e43df479
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291036
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> 
> TBR=brianosman@google.com
> 
> Change-Id: Ia039d7897499a7dad55aff1072f9aa0d01001f9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291693
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=egdaniel@google.com,brianosman@google.com,csmartdalton@google.com

Change-Id: I48e8cbff90f5533ba3e2166c819fb8e34bea34ca
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291737
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-24 20:49:21 +00:00
Chris Dalton
477512c0b3 Reland "Add a tessellation mode that uses indirect draws"
This is a reland of 02d7cf79be

Original change's description:
> Add a tessellation mode that uses indirect draws
>
> This mode is oftentimes faster than tessellation, and other times it
> serves as a polyfill when tessellation just isn't supported.
>
> Change-Id: I7b3d57fd0194c6869bfe28ee53ff0ff2e43df479
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291036
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com

Change-Id: Ia039d7897499a7dad55aff1072f9aa0d01001f9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291693
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-24 20:40:19 +00:00
Mike Klein
ec31488ace Revert "Add a tessellation mode that uses indirect draws"
This reverts commit 02d7cf79be.

Reason for revert:

  Perf-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN
  Perf-Win2019-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN

Running tessellate_prepareTessellatedCubicWedges	nonrendering
../../../../../../skia/bench/TessellatePathBench.cpp:79: fatal error: "unimplemented."

Signal 5 [Trace/breakpoint trap]:
    /mnt/pd0/s/w/ir/build/nanobench(backtrace+0x3d) [0x34851fd]
    /mnt/pd0/s/w/ir/build/nanobench() [0x3db3d49]
    /lib/x86_64-linux-gnu/libc.so.6(+0x37840) [0x7fdb4722d840]
    sk_abort_no_print()
    BenchmarkTarget::caps() const
    GrTessellatePathOp::prepareTessellatedCubicWedges(GrMeshDrawOp::Target*)
    GrTessellatePathOp::TestingOnly_Benchmark::prepareTessellatedCubicWedges::runBench(GrMeshDrawOp::Target*, GrTessellatePathOp*)
    GrTessellatePathOp::TestingOnly_Benchmark::onDraw(int, SkCanvas*)
    Benchmark::draw(int, SkCanvas*)
    /mnt/pd0/s/w/ir/build/nanobench() [0x3543b81]
    /mnt/pd0/s/w/ir/build/nanobench(main+0x1347) [0x3540a17]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7fdb4721a09b]
    /mnt/pd0/s/w/ir/build/nanobench(_start+0x2a) [0x346429a]
Command exited with code 5


Original change's description:
> Add a tessellation mode that uses indirect draws
> 
> This mode is oftentimes faster than tessellation, and other times it
> serves as a polyfill when tessellation just isn't supported.
> 
> Change-Id: I7b3d57fd0194c6869bfe28ee53ff0ff2e43df479
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291036
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=egdaniel@google.com,brianosman@google.com,csmartdalton@google.com

Change-Id: I4257d5ae5c0aafeebd61d8f1b78eca755ad977ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291642
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-05-22 13:46:16 +00:00
Chris Dalton
02d7cf79be Add a tessellation mode that uses indirect draws
This mode is oftentimes faster than tessellation, and other times it
serves as a polyfill when tessellation just isn't supported.

Change-Id: I7b3d57fd0194c6869bfe28ee53ff0ff2e43df479
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291036
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-05-21 22:32:45 +00:00
Mike Reed
1f60733fb3 Revert "Revert "move onto new factories for SkMatrix""
This reverts commit c80ee456ad.

fix: update flutter's gn file to add guard

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

Reason for revert: need to update/guard flutter

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

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

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

Change-Id: Id77ab1cf6b1cab35087a7c56000750912cf47383
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290831
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-05-21 15:04:09 +00:00
Leon Scroggins III
87caae61cd Move SkBitmapRegionCodec into client_utils/android
Bug: skia:10154

This will make it clear that these files are for Android use and
avoid compiling them for other clients.

Update testing tools to use android::skia::BitmapRegionDecoder, but
only if SK_ENABLE_ANDROID_UTILS is defined.

Take this opportunity to clean up the class:
- The base class, which was originally designed to allow switching
  amongst different implementations, is no longer needed. Rename
  SkBitmapRegionCodec to android::skia::BitmapRegionDecoder
  (following the new convention and matching the Java API name).
  Continue to inherit from SkBitmapRegionDecoder temporarily, to
  allow Android to switch to the new API.
- Use std::unique_ptr instead of passing raw pointers.

Add a test to verify that we only create a BitmapRegionDecoder if
it is one of the supported types.

Change-Id: Ied13fc8acb105fde042553331846d95ae15d6b57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287498
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2020-05-20 20:06:48 +00:00
Chris Dalton
e5a141d0f6 Reland GrRectanizerPow2
This brings back the pow2 rectanizer for use with various ongoing
atlas experiments. If we can further optimize the skyline rectanizer,
then pow2 will be good to have around as a baseline comparison. And
if skyline gets fast enough, then we can delete pow2 again.

Change-Id: I79088c53fba7ba0d120534af99bee7840c135e42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290810
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-19 18:35:13 +00:00
Brian Osman
08f986dde7 Added SkSL unpremul intrinsic
Change-Id: I5303f6f5210628a0a5d941b2f4a6376b5e158b60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289577
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-05-14 20:57:15 +00:00
Greg Daniel
0a2464f51f Update internal skia uses to use flushAndSubmit and submit calls.
Bug: skia:10118
Change-Id: Ieb7c0eece56d3d9df56ecb52e00e76c01f038de8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289888
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-05-14 20:26:44 +00:00
Chris Dalton
f6bf516926 Reland "Add an implementation and log2 variants for Wang's formula"
This is a reland of e278e1c1c7

Original change's description:
> Add an implementation and log2 variants for Wang's formula
>
> Wang's formulas for cubics and quadratics (1985) tell us how many line
> segments a curve must be chopped into when tessellating. This CL adds
> an implementation along with optimized log2 variants, as well as tests
> and a benchmark.
>
> Change-Id: I3f777b8d0312c57c3a1cc24307de5945c70be287
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288321
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=bsalomon@google.com

Change-Id: Ie3822c62439fc579a59ea8adb49583224de41aa5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289680
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-14 02:57:59 +00:00
Chris Dalton
2f2d81c434 Fix tessellation benchmarks to not allocate new data every iteration
Change-Id: I86bb6f2690ad349e640ea997e0b71387613ebffb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289460
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-05-14 00:28:43 +00:00
Mike Klein
6c3db04c8b Revert "Add an implementation and log2 variants for Wang's formula"
This reverts commit e278e1c1c7.

Reason for revert: i think we need to do that add with an unsigned, or test instead of always += (1<<23)-1.

Original change's description:
> Add an implementation and log2 variants for Wang's formula
> 
> Wang's formulas for cubics and quadratics (1985) tell us how many line
> segments a curve must be chopped into when tessellating. This CL adds
> an implementation along with optimized log2 variants, as well as tests
> and a benchmark.
> 
> Change-Id: I3f777b8d0312c57c3a1cc24307de5945c70be287
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288321
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I24dfd8549054b632f38f7b05b4d857b640cf5cd1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289658
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-05-13 22:10:47 +00:00
Chris Dalton
e278e1c1c7 Add an implementation and log2 variants for Wang's formula
Wang's formulas for cubics and quadratics (1985) tell us how many line
segments a curve must be chopped into when tessellating. This CL adds
an implementation along with optimized log2 variants, as well as tests
and a benchmark.

Change-Id: I3f777b8d0312c57c3a1cc24307de5945c70be287
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288321
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-13 21:39:24 +00:00
Brian Osman
9aaec36e45 Plumbing SkMatrixProvider into the raster backend
Change-Id: Ic5786b995fdb439871f2e3ab94cd07a945de19af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288776
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-05-13 18:05:32 +00:00
Adlai Holler
684838f1f5 Mark SkStringPrintf as SK_PRINTF_LIKE
Change-Id: I3d2ee8dca1d2e962794ce8c3c391779bff357f0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288762
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-05-12 15:22:14 +00:00
Chris Dalton
8650d33f7a Update PathIterBench to use the new RangeIter instead of RawIter
Change-Id: I9508790d67bf62b5a064ff5222a74e9566354351
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287888
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-05-07 17:59:20 +00:00
Ben Wagner
e2a944384c Fix SkBitSet.
Rename methods to be more like std::bitset and boost::dynamic_bitset.
Also fix findFirst to actually find the first and add tests.

Change-Id: Ic812c0a6d0ce1740c1cda900516f609ebbf5811c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287676
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-05-05 20:04:11 +00:00
Robert Phillips
273f107a2d Dump out path-mask generation and caching stats
These stats would've helped block https://skia-review.googlesource.com/c/skia/+/286902 (Add path bounds to SW path mask key) from landing.

Change-Id: I684f39de53fb2678c7a679e4e4aafdbb39a154ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287499
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-05-05 18:21:49 +00:00
Greg Daniel
6d2febd632 Reland "Add create backend texture with color upload bench."
This reverts commit 1ff415d5a1.

Reason for revert: relanding with fix

Original change's description:
> Revert "Add create backend texture with color upload bench."
> 
> This reverts commit 690b4c4644.
> 
> Reason for revert: breaking bots
> 
> Original change's description:
> > Add create backend texture with color upload bench.
> > 
> > Change-Id: Id4994cb809d6e19ca511b63dba71b45257eca927
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287618
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> 
> TBR=egdaniel@google.com,robertphillips@google.com
> 
> Change-Id: I2ac38977abc0004b38a94dacf0a235ae4fbac5d3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287636
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I287a1d829d4d861d149b0f1d9adf556a38e44abb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287638
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-05-05 00:43:52 +00:00
Brian Osman
d5f937bfca Add min/max/clamp/saturate intrinsics to ByteCodeGenerator
Change-Id: I357f9b0d3f2c8315b67a9ead6ddbb6633524ec3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287577
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-05-04 20:45:27 +00:00
Greg Daniel
1ff415d5a1 Revert "Add create backend texture with color upload bench."
This reverts commit 690b4c4644.

Reason for revert: breaking bots

Original change's description:
> Add create backend texture with color upload bench.
> 
> Change-Id: Id4994cb809d6e19ca511b63dba71b45257eca927
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287618
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I2ac38977abc0004b38a94dacf0a235ae4fbac5d3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287636
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-05-04 20:20:29 +00:00
Greg Daniel
690b4c4644 Add create backend texture with color upload bench.
Change-Id: Id4994cb809d6e19ca511b63dba71b45257eca927
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287618
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-05-04 19:33:17 +00:00
Adlai Holler
6f994a880d Add benchmarks for large kernel matrix convolutions
Change-Id: I999881aae3666fa92d83a9cb23582d8fa3f5cf81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286998
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-05-01 20:40:04 +00:00
Mike Klein
77083c7d74 Revert "replace SkSharedMutex"
This reverts commit cfdc07aa0e.

Reason for revert: nope, flutter windows bots don't have it.  we got caught.

Original change's description:
> replace SkSharedMutex
> 
> I am debugging an issue with SkSharedMutex and noticed
> how sparsely it is used.  That got me curious to see if
> we can replace it with a std::shared_mutex (from C++17).
> 
> Bug: skia:10177
> Change-Id: I1ce4d2a5897af198d6ae5fb850548ff917a58f50
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285691
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,bungeman@google.com,herb@google.com

Change-Id: Iab4e55d749e386233ff0e2ba2c1cd10d5e6f1615
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10177
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286124
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-29 18:50:39 +00:00
Mike Klein
cfdc07aa0e replace SkSharedMutex
I am debugging an issue with SkSharedMutex and noticed
how sparsely it is used.  That got me curious to see if
we can replace it with a std::shared_mutex (from C++17).

Bug: skia:10177
Change-Id: I1ce4d2a5897af198d6ae5fb850548ff917a58f50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285691
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-29 14:15:42 +00:00
Chris Dalton
f5132a05c8 Reland "Optimize GrTessellatePathOp's code to emit inner triangles"
This is a reland of 0f9ebd100e

Original change's description:
> Optimize GrTessellatePathOp's code to emit inner triangles
>
> Previously we used a naive algorithm to generate "middle-out" topologies
> for inner polygons, including copying all endpoints to a new array.
>
> This CL adds a "GrMiddleOutPolygonTriangulator" class that
> accomplishes the same thing in 1/5th the time using a small O(log N)
> stack.
>
> Change-Id: I3a7059e5d133a730b7084a17d8fbaaa3aaa81336
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285531
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

TBR=ethannicholas@google.com

Change-Id: I8402e5455e14aef9c5e92ee21100fcd7ace222ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285740
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-04-28 06:09:59 +00:00
Ethan Nicholas
5f56cb1d3b Revert "Optimize GrTessellatePathOp's code to emit inner triangles"
This reverts commit 0f9ebd100e.

Reason for revert: breaking a couple of bots (e.g. https://chromium-swarm.appspot.com/task?id=4bd6ccc785fa3110)

Original change's description:
> Optimize GrTessellatePathOp's code to emit inner triangles
> 
> Previously we used a naive algorithm to generate "middle-out" topologies
> for inner polygons, including copying all endpoints to a new array.
> 
> This CL adds a "GrMiddleOutPolygonTriangulator" class that
> accomplishes the same thing in 1/5th the time using a small O(log N)
> stack.
> 
> Change-Id: I3a7059e5d133a730b7084a17d8fbaaa3aaa81336
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285531
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I8ebca7078f2b9c12246447759efa9ce0cbb7e46b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285719
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-04-27 23:38:10 +00:00
Chris Dalton
0f9ebd100e Optimize GrTessellatePathOp's code to emit inner triangles
Previously we used a naive algorithm to generate "middle-out" topologies
for inner polygons, including copying all endpoints to a new array.

This CL adds a "GrMiddleOutPolygonTriangulator" class that
accomplishes the same thing in 1/5th the time using a small O(log N)
stack.

Change-Id: I3a7059e5d133a730b7084a17d8fbaaa3aaa81336
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285531
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-04-27 20:33:09 +00:00
Chris Dalton
7f0b8973e9 Add CPU benchmarks for individual methods on GrTessellatePathOp
Change-Id: Ica5d3229fc602d17cf568a25742612c94b87ae9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285215
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-04-24 15:23:41 +00:00
Brian Osman
449b1157a7 Plumb SkMatrixProvider throughout Ganesh
Renames the provider to SkMatrixProvider, which is now also able to
provide the local-to-device matrix. Everywhere that does paint
conversion and FP generation now has access to the entire matrix
provider, instead of just the CTM.

This will allow the SkSL FP (and others) to fetch other matrix state.

Change-Id: Iffb00bae0d438da0e8de3eebe75183ed6d440fd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284040
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-20 13:48:40 +00:00
Mike Klein
45d9cc86b3 remove i16x2 ops
These are neat but mostly just a distraction for now.
I've left all the assembly in place and unit tested
to make putting these back easy when we want to.

Change-Id: Id2bd05eca363baf9c4e31125ee79e722ded54cb7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283307
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-04-13 19:08:11 +00:00
Mike Reed
3ef77ddf9e clean up public m44 and camera api
saveCamera() is no longer experimental

In a separate CL, will stage changes to concat virtual to take M44.

Change-Id: Iaf37ce2f24ab1223c54aeb1e79eaebf18f87fece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281589
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-04-06 15:34:17 +00:00
Brian Osman
b08cc024cd Switch back to stack-based SkSL interpreter
It's slower, but code size is quite a bit smaller, memory usage is
smaller, and we think that mapping it to SkVM is just as easy.

This effectively reverts all of the following commits:

"Fix gcc9 warning around size of memset."
https://skia-review.googlesource.com/c/skia/+/279861

"Remove unused (and misleading) 'instruction' from SkSLInterpreter.h"
https://skia-review.googlesource.com/c/skia/+/278177

"Interpreter: Fix intrinsics when called with vector types"
https://skia-review.googlesource.com/c/skia/+/272721

"Make it easier to add vector versions of byte code instructions"
https://skia-review.googlesource.com/c/skia/+/272527

"Interpreter: Support returns from runStriped"
https://skia-review.googlesource.com/c/skia/+/268941

"add SkSLInterpreter vector instructions"
https://skia-review.googlesource.com/c/skia/+/266560

"Fix crash when editing particle scripts"
https://skia-review.googlesource.com/c/skia/+/269487

"Revert "Revert "Complete rewrite of the SkSL interpreter"""
https://skia-review.googlesource.com/c/skia/+/266205

Change-Id: I4258596399c4ca94489d4faf8aacfec88afeee13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281205
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-04-03 17:20:04 +00:00
Brian Salomon
8afde5f395 Rename outputView->writeView and outputSwizzle->writeSwizzle
Change-Id: Ib09550201bc1556e04555fc7dc9408ab469684a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280964
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-04-02 15:06:16 +00:00
Brian Osman
f5ecf51f47 Stop including SkVertices.h from so many places
Change-Id: I50c1f230803faef731b32cad7cd60b7b421678e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281160
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-02 14:07:46 +00:00