Commit Graph

6793 Commits

Author SHA1 Message Date
Mike Klein
bcbf9633db Temporarily revert runtime decoder registration.
Some builds in Google3 can't find SkSharedMutex at link time.

This reverts commit ff7006ff80.
This reverts commit 05f45b21b7.

Change-Id: I889e9a3169cf017b8d5daacf75099663fc996d73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210785
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-26 15:41:56 +00:00
Mike Reed
4e1b07e09f stage naming change in colorfilter
1. want to standardize on naming convention (matching shaders asA...)
2. want to eliminate legacy asColorMatrix with its 255 bias

Bug: skia:
Change-Id: I43258aa3a406b92a3246e13e5dd996fcc207c784
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210621
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-26 01:52:53 +00:00
Mike Klein
ff7006ff80 switch test to a legal, impossible enum value
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN
Change-Id: I317106fd1e5357149d9a0151038317d7a5c92f37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210553
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-25 23:43:01 +00:00
Mike Klein
05f45b21b7 runtime registration for decoders
What do you think of this sort of thing for letting
users register codecs at runtime instead of at build time?

Change-Id: I448ea3466862326c283ad9b2f1b7eea56cffc80c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210449
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-04-25 21:43:12 +00:00
Robert Phillips
10d172169f Remove GrInternalSurfaceFlags::kNoPendingIO as it is no longer needed
Since explicit allocation is always enabled now, the resource allocator explicitly manages reuse of GrSurfaces and this flag isn't used/needed.

Change-Id: I5703bf4624e21f9aff9da76575f4ef757b1d2589
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210140
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-25 13:37:59 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Robert Phillips
c73666ff43 Implement alternate method for determining recycle-ability of allocated GrSurfaces (take 2)
With the upcoming removal of pendingIO refs the GrResourceAllocator needs a new means of determining when a backing GrSurface can be recycled and when it needs to be left assigned to a GrSurfaceProxy.

Change-Id: I2327b0f15ceb639b400a55a9c53359a4b43288c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210041
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-24 14:25:00 +00:00
Brian Salomon
24d377eedf Store tasks to execute before VK secondary command buffers generically.
Repurpose GrTRecorder for storing these tasks. It's currently unused.
Reimplement on top of SkArenaAlloc and using emplace methods now that we
have C++14.

Currently it stores copy and upload tasks. In the future it will store
transfer-out commands.

Removes the optimization that reset copy-ins on clear/discard. However,
none of our existing tests exercised it.

Change-Id: I0474f77cc2d368461d542de50a7a0c5609312001
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209643
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-23 20:43:04 +00:00
Ethan Nicholas
746035afeb added support for interpreting generic SkSL functions
Bug: skia:
Change-Id: I575b91c654393cc6cfedea617852598e8595d5ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209809
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-23 18:46:36 +00:00
Mike Klein
4941a2239e switch some idiosyncratic <includes> to ""
Change-Id: I099f8a635df7dd0ddd3902459615250ea2c120c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209874
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-04-23 17:54:48 +00:00
Robert Phillips
29c1c8029a Revert "Implement alternate method for determining recycle-ability of allocated GrSurfaces"
This reverts commit 7eec3cd688.

Reason for revert: Chrome assert

Original change's description:
> Implement alternate method for determining recycle-ability of allocated GrSurfaces
> 
> With the upcoming removal of pendingIO refs the GrResourceAllocator needs a new means of determining when a backing GrSurface can be recycled and when it needs to be left assigned to a GrSurfaceProxy.
> 
> Change-Id: I6f62a793e8aba70019dc8d0e7d585366d1097d70
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208227
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ia7098e1fcbf5623a7846b52b3b26f724e183d5ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209807
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-23 16:54:58 +00:00
Robert Phillips
7eec3cd688 Implement alternate method for determining recycle-ability of allocated GrSurfaces
With the upcoming removal of pendingIO refs the GrResourceAllocator needs a new means of determining when a backing GrSurface can be recycled and when it needs to be left assigned to a GrSurfaceProxy.

Change-Id: I6f62a793e8aba70019dc8d0e7d585366d1097d70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208227
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-23 14:39:11 +00:00
Robert Phillips
12c4629624 Remove the option of disabling explicit resource allocation
We're burning our boats behind us. Succeed or die trying!

Change-Id: I6a9f71b758a6ae7b090c5221ab12a5ab4d166b47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209647
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-23 12:24:26 +00:00
Brian Osman
c3186302bd Add skcms directory to public includes
skcms is part of Skia's public API now. This attempts to recognize that,
and pave the way for moving the header to another location more easily
in a follow up CL, or - at a minimum - for clients that redistribute
Skia as a library + includes to relocate the skcms.h header as part of
that.

Change-Id: I15da63b0d4ab8916a71fb7e6ab3656db87252707
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209640
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-22 20:32:23 +00:00
Mike Reed
50d79af7b7 hide internals of SkColorMatrix (so we can migrate to col-major)
Change-Id: If0eb6fb2efb6816b92ad7ca7d8caaace71397b7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209409
Commit-Queue: Ravi Mistry <rmistry@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-22 19:10:04 +00:00
Robert Phillips
5f78adf890 Add explicit GrSurfaceProxy flag to skip explicit resource allocation (take 2)
This approach eliminates a lot of edge cases where ops (e.g., the SmallPathOp) are treating their proxies in a special manner (i.e., just holding a raw ref and never adding pendingIO). Given that the atlas managers are managing the lifetime of the proxies there is no reason for the GrResourceAllocator to be aware of them.

Pulled out of:

https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)

Change-Id: I0a8d3c2d56036d568b6d49ddc78c32761642d1c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209419
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-22 18:05:33 +00:00
Mike Klein
e0eeda5756 add constexpr constructor to SkMatrix
This is an experiment in making SkMatrix less sharp.

Change-Id: Ie1881b0905b594aa1c444440fae5253970850e12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208340
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-22 15:41:29 +00:00
Mike Klein
6350cb0f4b Revert "Add explicit GrSurfaceProxy flag to skip explicit resource allocation"
This reverts commit 7bb47f2a2e.

Reason for revert: chrome roll maybe

Original change's description:
> Add explicit GrSurfaceProxy flag to skip explicit resource allocation
> 
> This approach eliminates a lot of edge cases where ops (e.g., the SmallPathOp) are treating their proxies in a special manner (i.e., just holding a raw ref and never adding pendingIO). Given that the atlas managers are managing the lifetime of the proxies there is no reason for the GrResourceAllocator to be aware of them.
> 
> Pulled out of:
> 
> https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)
> 
> Change-Id: Ia6bec5e8f5d5bc63e86ae011bcc3f8e061c066b2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209400
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Id65bd176f56aa91ff76ec1979aef6206b7665d63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209600
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-22 12:42:31 +00:00
Brian Salomon
1c0b05afde SkClipStack::isRRect succeeds if stack is an intersection of rects.
This helps enable optimizations that rely on the entire clip reducing
to a single rectangle, such as converting a drawRect to a clear.

Bug: b/122296071

Change-Id: I1fea4565644280d57610f8585b76babb557301d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209382
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-19 20:14:12 +00:00
Robert Phillips
7bb47f2a2e Add explicit GrSurfaceProxy flag to skip explicit resource allocation
This approach eliminates a lot of edge cases where ops (e.g., the SmallPathOp) are treating their proxies in a special manner (i.e., just holding a raw ref and never adding pendingIO). Given that the atlas managers are managing the lifetime of the proxies there is no reason for the GrResourceAllocator to be aware of them.

Pulled out of:

https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)

Change-Id: Ia6bec5e8f5d5bc63e86ae011bcc3f8e061c066b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209400
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-19 19:25:02 +00:00
Brian Osman
cf4ec506ec Convexity checker: Wait for significant x-product when walking edges
This effectively re-applies the logic from
https://codereview.chromium.org/298973004

The change to the unit test for 389050 is interesting.
The last convexity rewrite "fixed" that case by allowing
it to be detected as convex. In the process, it actually
broke the original bug, so that rendering of the HTML
failed. This CL causes us to give up and decide that the
path is concave, but we return to rendering correctly, so
that's a win.

The bug that initiated this (950508) is effectively the
exact same bug as 2235, which is why I haven't added a new
test case. The existing test case is much more concise than
the 100K data file needed for the new one.

Bugs: skia:2235 chromium:389050 chromium:950508
Change-Id: I0de65db8644f37e335c47e9d41c676b8e8b020fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209164
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-19 18:01:54 +00:00
Ethan Nicholas
cb0f409af4 added error detection for writing to a constant swizzle mask
Bug: oss-fuzz:14089
Change-Id: Ie5c51c2de8b9a53aebfae19373cc5a3d7d8e594b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209325
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-04-19 16:54:34 +00:00
Brian Osman
309de7904d Remove SK_TREAT_COLINEAR_DIAGONAL_POINTS_AS_CONCAVE
This was rebaselined and removed from Chrome long ago.
Planning to fix more bugs in the Convexicator, but want
to get this out of the way first.

Change-Id: I4f299d56a81be509a861d1e9c9f0e48a47170096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209322
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-19 14:11:49 +00:00
Brian Osman
14ac42b280 Remove the axis-aligned vector special case to convexity checker
There are bugs in the other code path that will require more state,
and maintaining this special case in parallel is going to be tricky.

Change-Id: I0083b0aa2af16391504f0993e765faa0f5522502
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209163
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-18 17:50:37 +00:00
Ben Wagner
2c2240f668 Make more SkTypeface virtuals pure.
This ensures that proxy typefaces are really proxying these calls. Also,
sometimes the defaults aren't really the right thing.

Change-Id: Ifac417452136adca8152f4cd7670fd40553bd3b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209105
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-18 15:38:56 +00:00
Robert Phillips
396673870c Non-substantive changes
These changes are pulled out of:

https://skia-review.googlesource.com/c/skia/+/208227 (Implement alternate method for determining recycle-ability of allocated GrSurfaces)

Change-Id: I1126f0e0c149d07f5febb352c4e86a676960409f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209103
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-17 20:43:33 +00:00
Greg Daniel
e6bfb7daf0 Add struct to wrap all the gpu flush options.
Bug: skia:8802
Change-Id: Ia92807034a8f54067cead59e29c233f91e11f175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208674
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-17 20:03:29 +00:00
Mike Reed
64670cb1b8 Reland "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"
This is a reland of fde841de44

Original change's description:
> Simplify SkTypeface::charsToGlyphs API to require UTF32 input
> 
> Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I5162c93b3ea6146d09334545744b791d993397b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208679
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-17 17:56:39 +00:00
Brian Salomon
105d7c24c9 Add flag to map buffer flags in GrCaps to indicate whether mapping a
GrGpuBuffer for reading is synchronous or not.

Update transfer-from test to not call GrGpu->finishFlush() when maps
are synchronous.

Bug: skia:8962
Change-Id: I5eb003081725e5199157473faf7f916a65408dc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208509
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-17 17:34:18 +00:00
Robert Phillips
33906ad1e2 Reland "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
This reverts commit 652b007a4c.

Reason for revert: Potentially causing Google3 errors

Original change's description:
> Revert "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
> 
> with legacy guard for google3
> 
> Needs this to land first: https://critique.corp.google.com/#review/243924283
> 
> This reverts commit 70ed05e53a.
> 
> Change-Id: I3e821dfcdbf3004382092338ebad7cceaf40cefd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208668
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

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

Change-Id: Id2b3ed8a6157b5e33721b0c5168c5680bfac15b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208669
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-17 12:03:53 +00:00
Mike Reed
652b007a4c Revert "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input""
with legacy guard for google3

Needs this to land first: https://critique.corp.google.com/#review/243924283

This reverts commit 70ed05e53a.

Change-Id: I3e821dfcdbf3004382092338ebad7cceaf40cefd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208668
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-17 03:08:40 +00:00
Mike Reed
70ed05e53a Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"
This reverts commit fde841de44.

Reason for revert: used in headless on google3, need to add a guard

Original change's description:
> Simplify SkTypeface::charsToGlyphs API to require UTF32 input
> 
> Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

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

Change-Id: I1d28ed5c31deaa76aa3c4b627454b0ad3356a6fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208800
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-04-17 00:02:12 +00:00
Mike Reed
fde841de44 Simplify SkTypeface::charsToGlyphs API to require UTF32 input
Change-Id: I486713c496c40103eef13fa6068ac4d69e32f606
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207865
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-04-16 21:34:10 +00:00
Mike Klein
9a885b27f3 pass SkVx::Vec arguments as const&
Yet another surprising finding when looking at ARM code generation is
that passing these values to functions by const& does make a difference,
even when fully inlined.  I can only guess that the compiler's somehow
more sure that way that the values won't change?  Anyway, convert all
skvx functions that take Vec arguments to take const Vec& instead.

This tweak is enough to let the natural implementation of mull()
actually produce good code generation, so I've promoted that to SkVx.h
and added a unit test.  Notice in the NEON case we've got a base case at
N=8 and two recursive cases, one down to 8 as usual when N > 8, but also
one up to 8 when N < 8.

This also is another big speedup for ARMv7 NEON, bringing it to nearly
the same speed as ARMv8 NEON on the same device.

Bug: chromium:952502
Change-Id: I0f19bab45cf02222ccc8090053ea2a4a380f1dfe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208582
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-04-16 19:24:50 +00:00
Greg Daniel
4aa13e7da3 Remove deprecated SkSurface::prepareForExternalIO and related uses of the name.
In a future CL I intend to use prepareForExternalIO to be a specific operation
to do to an SkSurface/SkImage so this is a pre CL that removes our use of that
phrase when related to flushing.

Bug: skia:8802
Change-Id: I3efe4c4061fe962e2fc1339185feb5ded6e23005
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208223
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-16 14:08:09 +00:00
Brian Salomon
26de56ef09 GrSurface -> GrGpuBuffer transfer improvements:
GrCaps now only provides the offset alignment requirement. The row bytes
is always bpp * width.

GrGpu::transferPixelsFrom now just returns bool since row bytes value is
implicit. It now asserts offset is aligned with GrCap's provided value
in base class.

Implement caps for GL.

Bug: skia:8962
Change-Id: I3299b62efe9fe05bfe02f2a6a4c2704f647d0f8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206686
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-04-16 14:05:34 +00:00
Brian Osman
6c431d5202 Towards a simpler SkSL -> GLSL pipeline (and better shader reflection)
The pretty printer didn't actually need the original (separate) strings,
so make it just operate on a single SkSL::String. Also remove the unused
line numbering, and the unit test. (Testing of test code, yay!)

With that done, cut down on passing around arrays of char* + length, and
just do the compaction to a single SkSL::String in the program builder.

Change-Id: Ieef9d9a8e3c5620c011b17477f1b0f9a9faa6273
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208226
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-16 13:49:17 +00:00
Mike Reed
194cab0fd3 use slope-guess for faster charToGlyph
Made up a threshold between linear and slope searching.
For a count of 100 here are the before and after timings.
The first two lines are being changed. The latter 2 are
the native look-ups for mac.

Before

  15/15  MB	115	2.33µs	2.34µs	2.34µs	2.34µs	0%	▆▁▄█▇▇▂▄█▆	nonrendering	cmap_findcache_charToGlyph
  15/15  MB	66	3.47µs	3.48µs	3.49µs	3.55µs	1%	█▁▁▁▂▁▁▁▁▄	nonrendering	cmap_addcache_charToGlyph
  15/15  MB	1	1.1µs	1.13µs	1.21µs	1.98µs	22%	█▂▁▁▁▁▁▁▁▂	nonrendering	cmap_face_charToGlyph
  15/15  MB	190	1.09µs	1.1µs	1.19µs	1.64µs	17%	▁▁▁▆█▁▁▁▁▁	nonrendering	cmap_font_charToGlyph

After

  15/15  MB	447	448ns	449ns	448ns	449ns	0%	▂▅█▅▁▆█▂▁▆	nonrendering	cmap_findcache_charToGlyph
  15/15  MB	95	2.79µs	3.03µs	3µs	3.06µs	3%	▇▇▇▇▇███▄▁	nonrendering	cmap_addcache_charToGlyph
  15/15  MB	1	1.15µs	1.16µs	1.25µs	1.99µs	21%	█▂▁▁▁▁▁▁▁▁	nonrendering	cmap_face_charToGlyph
  15/15  MB	186	1.09µs	1.1µs	1.12µs	1.27µs	5%	█▁▁▁▂▁▁▁▁▁	nonrendering	cmap_font_charToGlyph


Bug: skia:
Change-Id: If7da4eef3cce248393815071f342607f0c8140bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208044
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-15 19:35:59 +00:00
Greg Daniel
a3aa75ab29 Add callback to flush for knowing when gpu is finished work.
Bug: skia:8802
Change-Id: I093c2a4e879b635b169a849d9af3e9f7a3d84a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207870
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-04-15 13:52:28 +00:00
Robert Phillips
831a29341c Plumb sk_sp through the GrOpList class hierarchy
This is preparing the ground for having proxies be atomically reffed

Change-Id: Ice48c41120d4ec10a758f696a69028b6363e8a7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207762
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-04-15 12:21:45 +00:00
Mike Reed
0c60708737 add utility for caching char2glyph
Try: out/release/nanobench --match _charToGlyph

Pseudo plan to use this:
- attach to whatever typeface backends need it (probably just freetype)
- have a purge/limiting scheme (e.g. only cache N entries)
- if we care, make the search fancier (e.g. binary, slope, etc.)

Bug: 951647
Change-Id: Ib1042ca5891d2742499faf1314579c402121a855
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207703
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-13 00:03:58 +00:00
Mike Reed
bb85b8b3f3 remove dead code from old factories, enum
Change-Id: I12d46c2c60539689949a08636c3a654d2298285a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207868
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-12 17:11:25 +00:00
Ben Wagner
f55fa0d0cf Make SkPaintFilterCanvas paints no longer COW.
The two existing external users of SkPaintFilterCanvas always end up
making a copy of the paint when the canvas is in use. As a result, the
extra overhead of doing COW is being wasted. In general, it seems easier
for users to optimize by simply not using the filter canvas when it
won't be making any changes. Also, no users are using the 'Type'.

After users are updated to this new API, the old onFilter can be
removed.

Change-Id: Iee1ce3cd22bce8c00664de078375b105abd7c866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/149806
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-04-11 22:42:13 +00:00
Mike Klein
1dcc55b372 rewrite new SkVx unit test
- be more explicit about casting
 - general rewrite for clarity

Cq-Include-Trybots: skia.primary:Test-Win2016-MSVC-GCE-CPU-AVX2-x86_64-Debug-All-MSRTC
Change-Id: I924d6d247e6b9afcefb27c690715fdad84635a5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207721
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-11 19:14:04 +00:00
Mike Klein
4b44a0d01a add SkVx helpers for working with unorm8
These replicate the base logic of Sk4px::Wide::div255() and
Sk4px::approxMulDiv255(), and will come in handy replacing them.

No platform specializations yet... want to remind myself what
codegen they get from these vanilla versions first, and then
I'll fill in the platform specific stuff as needed.  The tests
should cover everything pretty exhaustively.

Change-Id: I5854d1bc0902a85cbb2351f669c4da7cc31a8775
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207683
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-04-11 17:54:23 +00:00
Ben Wagner
25e371f7ee Make SkFontMgr_fontconfig respect the sysroot.
An FcConfig has the concept of a sysroot against which file names should
be resolved. Add support for this so that it is possible to use
relocatable FcConfigs. Also adds a test that this works.

Change-Id: I523d5fb1233830434a88dc52b27728aaf83bb5a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206278
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-04-11 15:42:20 +00:00
Greg Daniel
b9990e4492 Add more general flush call to GrContext.
This is to match the current features of SkSurface::flush and to prepare
for adding additional features to flush.

Bug: skia:8802
Change-Id: I5d68272e1277b416af357e6ffaf426841ceda943
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207301
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-04-10 21:19:10 +00:00
Mike Reed
e3f17b911f remove SkMixer, since we have explicit lerps/blends in SkShader
Change-Id: I937861df9d8ae89c0587ea59dd740989bebd35a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207305
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-10 20:59:30 +00:00
Jim Van Verth
9896a0d790 Add mipmap generation for Metal
Bug: skia:8243
Change-Id: Id71073dffe6e2b42d099f0c92059b53c48b46c4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206717
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-04-10 20:19:00 +00:00
Mike Klein
da7b053527 tweak SkVx to play nicely with others
Was starting to use this and ran into a few problems with clashing
symbols, namely SI and cast().  Seemed simple enough to not use SI,
and to move all the free-standing types into skvx: skvx::cast,
skvx::shuffle, etc.

Change-Id: Ia5d8ef6d0ae5375bf80d76be88d16f0c9cde56e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207340
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-04-10 19:40:05 +00:00