Commit Graph

25607 Commits

Author SHA1 Message Date
Mike Klein
508fd32091 make SkBBH a public interface
I don't necessarily like this long term, but in the short term Flutter
would like to record pictures using their own type separate from
SkRTree.  This makes SkBBoxHierarchy public, and converts it to use
other public types (SkTDArray -> vector).

Change-Id: I29c5ef9da7d641d8f4ba18522b168ddf7cefe84f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270387
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-12 16:31:05 +00:00
Mike Klein
e1bad065be calculate root bounds directly
This is a long-standing TODO.  No reason to ask
the BBH subclasses to calculate the root bounds
when we can simply union them up ourselves.

Change-Id: I9dbd883c43247400e4e9d56c74d4203d34f698e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270276
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-12 16:28:56 +00:00
Greg Daniel
43956128ba Update generated effects to use views.
Bug: skia:9556
Change-Id: Iad4f7f2db2624e699184691d8aae2aaded81eb28
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270198
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-12 15:33:24 +00:00
herb
0234170cc6 Simplify SkStrike ctor
Allow a SkStrike to be created with a descriptor and a context.
Metrics can be passed in to support the diff canvas.

Change-Id: I981f929ccb6d6391b1d205cba8aaa96f8df4932c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270197
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-12 15:09:14 +00:00
Mike Reed
125d3820d6 Revert "Ensure arcTo (SVG) ends at the targeted point"
This reverts commit 31143100ee.

Reason for revert: need to guard this, to stage changes to test images

Original change's description:
> Ensure arcTo (SVG) ends at the targeted point
> 
> Floating-point errors in the calculations in arcTo can cause the final
> point to differ significantly enough from the supplied target point that
> a subsequent 'close' operation inserts a lineTo to close the curve. This
> can result in bad miters on curves with thick outlines.
> 
> The fix is to ensure that the final point used is *exactly* the point
> that was supplied.
> 
> Bug: chromium:1001768
> Change-Id: I75c740ab25fb05153bc852a204be957977674cd2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270000
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com,iapres@microsoft.com

Change-Id: If331924a4db83294769b28501bba875238a521bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1001768
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270356
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-12 14:08:03 +00:00
Ian Prest
31143100ee Ensure arcTo (SVG) ends at the targeted point
Floating-point errors in the calculations in arcTo can cause the final
point to differ significantly enough from the supplied target point that
a subsequent 'close' operation inserts a lineTo to close the curve. This
can result in bad miters on curves with thick outlines.

The fix is to ensure that the final point used is *exactly* the point
that was supplied.

Bug: chromium:1001768
Change-Id: I75c740ab25fb05153bc852a204be957977674cd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270000
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-11 22:13:08 +00:00
Brian Osman
3841d0e8fb Remove unused fields from SkSL's IRGenerator
Change-Id: If2a05c1bdf6ed1bee2244c9721307c7906acda94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270202
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2020-02-11 21:54:28 +00:00
Mike Klein
f7eb0544a8 basic, untested BGR 1010102 and 101010x
Updated every switch that yelled at me, and added support to dm and fm,
and then founds some more switches that shouldn't have defaults...

The tricky spots outside those were mips and dither,
since they aren't simply exhaustive switches.

_Now_ no diffs between RGB/BGR 1010102 and 101010x.

No GPU support.

Bug: skia:9893
Change-Id: I73ab3fd22bdef0519296dfe4cb84031e23ca0be3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270114
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-11 21:44:57 +00:00
herb
660317f6a7 Move scaler context fallback to GDI
The GDI Typeface is the only one that can fail to make a
scaler context. Move all the logic to the GDI specific code.

Change-Id: I50a0a58529bb44625068244e6ae27e54bccd9f67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269913
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-11 19:50:27 +00:00
Mike Klein
6f9a37fb1a test _MSC_VER in SkCpu
We're looking to use tools provided by the compiler toolchain,
not by the OS, so the proper check is for MSVC (or compatible
clang-cl) not for Windows.  E.g. MinGW wants the #else path.

Change-Id: Iefc43a857a1f6438c9145d7503a42c0646c5cbf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270096
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-11 16:54:07 +00:00
Greg Daniel
d11ae2eebe Update OnFlushResourceProvider for views.
Bug: skia:9556
Change-Id: I4c76192b9c4a5af9383ed131491e967741c3c743
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269909
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-11 16:34:27 +00:00
Brian Osman
f989aeaa01 Support children in SkRuntimeEffect::makeColorFilter
Change-Id: Icf8c69464a44341a08df16dce53aebedc2826bfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270064
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-11 16:20:07 +00:00
Chris Dalton
c3b67eb988 Add a "conservative raster" flag for GrFillRectOp
Adds the ability to fill a rect with conservative raster enabled, and
fixes a bug in the gpu tessellation atlas where there were artifacts
from mixed samples.

Change-Id: Ic0b4f2059129ac238fdcb08d43896fc2b9e50211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269989
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-11 15:39:57 +00:00
Greg Daniel
e32506bf66 Update GrClipStackClip and GrDeviceSpaceTextureDecalFP to use views.
Bug: skia:9556
Change-Id: I61346e31b67ca1dffc5132e0af47aff4fdfc6e22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269907
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-11 15:23:37 +00:00
Mike Reed
88417e7430 SkCreateCGImageRef needs to not rely on N32
Change-Id: I7d657e7a25293cc8a540dd1d4f8fd5fd937891f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270060
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-11 14:35:24 +00:00
Mike Reed
dc2782c380 Update OverdrawColorFilter to clarify how it interprets its input array.
1. Document that Make() takes RGBA_premul
2. Change impl so that CPU matches this behavior/definition
3. Offer a clearer factory that takes SkColor
   (perhaps migrate clients to this one in the future)

Bug: skia:9896
Change-Id: I0a81dda45834a2fbf2b28b711ba7e6b83f360aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269906
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-02-11 10:58:36 +00:00
Chris Dalton
f83d0346c0 Use mixed samples in GrDynamicAtlas
Change-Id: I0871f2e87be857ebf8577b212b318054a2ad84dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269908
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-10 22:46:45 +00:00
Herb Derby
daa19f35f8 Remove unused fields from SkScalerContextProxy
Change-Id: Ie6740ccb3302895dc9560e9a9278ab68dd64012b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269903
Auto-Submit: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-10 21:05:05 +00:00
Mike Klein
c2a0d0e9dc sub_f32 -> sub_f32_imm more sanely
Change-Id: Ic89359cd08298e73011952452ce909291d6f3fe9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269947
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-10 21:04:05 +00:00
Chris Dalton
4e9985327b Add a simple atlas to the GPU tessellation path renderer
If a path is small and simple enough, we now try to atlas it. There
is only one atlas and it caps at 2048x2048. Once it runs out of room,
everything just draws direct. The atlas is rendered using the existing
GrTessellatePathOp. It provides alpha8 coverage even for msaa render
targets.

Change-Id: I715da9ce7347b6f1ef8e28b3e13ab47f6eade1c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268724
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-10 19:38:54 +00:00
Mike Klein
5cdeb390d0 only emit _imm ops when JITing for x86
There are probably ways to make this more efficient by only optimizing
what's necessary (e.g. try JIT first, then interpreter only if it fails)
and some other performance improvements to make, but for now I want to
focus mostly on keeping things simple and correct.

The line between Builder::done() and Program::Program() is particularly
fuzzy and becoming fuzzier here, and I think that'll be something
that'll change eventually.

This makes SkVMTest debug dumps more portable, though perhaps less
useful.  Might kill that feature soon now that SkVM is tested more
thoroughly in unit tests and GMs and bots and such.

Change-Id: Id9ce8daaf8570e5bea8b10f1a80b97f5b33d45dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269941
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-10 19:26:05 +00:00
Michael Ludwig
465864cad5 Don't clip non-AA quads
Minor optimization. When non-AA, the quad corners are never moved so it
won't go through the math that requires w > 0. The GPU is perfectly
capable of clipping to w > 0, except that it produces a non-AA edge;
for AA quads this is a problem, but not so when the draw was non-AA.

Change-Id: Ibf77b678f5b3b90a5a88fb3670a31cd12ff3775f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269762
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-02-10 18:34:19 +00:00
Michael Ludwig
a49de4de63 Keep UVs consistent in degenerate quads
An earlier CL noted that the edge correction sometimes caused popping
when undering extreme perspective, so I removed the edge correction
thinking that it was unnecessary. Turns out that for actual degenerate
quads, it is necessary. However, instead of re-determining the degenerate
edge based on the local edge length, this corrects the exact same edges
that had been corrected in device space. I confirmed that this seems to
prevent the popping under extreme perspective and draws triangles correctly.
It also avoids the coordinate scale issue that comes about when the edge
tolerances had been chosen for pixel space, but many of the local coordinates
being processed had already been normalized so differed by a factor of 3ish.

Bug: skia:9889
Change-Id: Ida4c626aa982fe4fdac6695e2ad95e162e42fca2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269758
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-02-10 18:34:02 +00:00
Greg Daniel
9f0dfbd1f4 Have various software uploaders in gpu backend use views.
Bug: skia:9556
Change-Id: I1ac3744632b6e926f79e182d4cd9d59498699aee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269896
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-10 18:00:09 +00:00
Greg Daniel
573312e33e Update copy and blitTexture calls to not query origin off of proxies.
Bug: skia:9556
Change-Id: I4042f1339844186b73b807e93b1a3701c32bf112
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269366
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-10 16:19:49 +00:00
Stephen White
c03e6982f9 GrTessellator: fix for performance issue on many intersections.
On some paths with many self-intersections, performance can approach
O(N^2) in intersections, due to
"GrTessellator: always rewind to edge top when splitting",
aka b67b2354cf.

This patch reverts that change, brings back rewind_if_necessary(), and
fixes the underlying issue by continuing to rewind past any AEL
violations.

Bug: 1030306
Change-Id: I64cea1d09bf383c245a5fd2ddb6569b4041b6638
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269238
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-02-08 05:00:34 +00:00
Brian Osman
8c80b19936 Interpreter: Support returns from runStriped
Change-Id: Id84c3fb35cb61fa839691471d03a44152964bedb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268941
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-08 02:09:04 +00:00
Lam Lu
a9405c2a29 Compress color using hex instead of rgb in SkSVGDevice.
By using hex color instead of RGB in SkSVGDevice, SVG byte size can be
reduced. For example, Quora landing page SVG size: 1588515 bytes (RGB)
vs. 1587899 bytes (Hex). Size reduces by 616 bytes.

Bug: NONE
Test: dm -v --match SVGDevice
Change-Id: I1d557c9d8a925c2dde96899e23833dfb89264903
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269260
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-07 22:48:34 +00:00
Greg Daniel
e810d839a1 Use views where needed in CCPR.
Bug: skia:9556
Change-Id: Ib8c97a85ff76d3b2a9b501c2372f60e851cee46f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269479
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-02-07 22:48:14 +00:00
Chris Dalton
a550cf2e40 Extract a GrDynamicAtlas base class from GrCCAtlas
Change-Id: I85fd3a3ccc34b5616a75e2c7ddcc33af18809144
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268723
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 21:05:04 +00:00
Brian Osman
7353dc5490 Change SkSL main() from (float x, float y) to (float2 p)
Change-Id: Id046199edd63535ef07e1dfa65fbc7c0f8cefd00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269371
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-07 20:19:13 +00:00
Brian Salomon
a56a746b7e Remove GrSurfaceDesc
Replace with SkISize.
Also change some const SkISize& params to just SkISize.

Change-Id: I3c72d961662eefeda545fba17d63e877cd5ca813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269374
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-07 19:48:13 +00:00
Michael Ludwig
949ceb249f Add ClipToW0 utility function for GrQuads,
and improve perspective handling in rest of quad pipeline

This function produces 0, 1, or 2 quads clipped to w > 0, with proper
local coords. To make its signature a little easier to reason about,
I added a simple 'DrawQuad' struct that represents the combination of
device and local coordinates, and edge AA flags. I am open to suggestions
for the name.

GrQuad::bounds() remains perspective aware so that it is always correct.
I updated CropToRect to check for w < 0 and not attempt to crop in that
scenario. Theoretically, we could clip to w = 0 first and then go through
the CropToRect optimization path. However, with the current state of the
GrFillRectOp and GrTextureOp, that made it more annoying to have the bulk
APIs handle the w clipping as well.

So for now, the w plane clipping is entirely the responsibility of the
ops. A benefit of this approach is that GrRenderTargetContext doesn't need
to be modified, and in the case where the clipping produces 2 quads they
are automatically put in the same op w/o going through any batching code.

However, it is becoming clear to me that managing 4 effective code paths
(fill + texture X simple + bulk API) is more maintenance than it's worth.
I added skbug:9869 to work out how to simplify these op creation APIs further,
and if we succeed there, I think it will make applying the W plane clipping
more convenient as well.

For now, since this affects SkiaRenderer on Linux stable, I am pushing
for correctness.

Bug: skia:9779, chromium:224618
Change-Id: I4218a956cbe0bbc2b5c9cf133a069d54c93848e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268686
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 19:06:51 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Chris Dalton
d2e4de1c33 Add a fast codepath for SkPath.addPath(kAppend)
Change-Id: I49469f29cc10032d687b938ded379ef7e2f52da2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269190
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-07 17:01:29 +00:00
Greg Daniel
2f3cd4ff2b Views for all draw texture calls in SkGpuDevice and RenderTargetContext.
Bug: skia:9556
Change-Id: Ibb0e0cff3301554e988d5900455766b6428484ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269360
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-07 16:39:38 +00:00
Stephen White
511af2e086 Skia-Dawn: update to new GrGLSLProgramBuilder constructor.
Change-Id: I9b5929bbfea046e3ca7df45de2507536f12b3cf9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269359
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-02-07 16:31:08 +00:00
Mike Klein
4bb619554e move instruction specialization later
This adds a specialization pass to Builder::optimize() and moves the
x86-specific _imm ops there, rewriting with the Builder API itself.  I'm
only using the private Builder::push() call for the moment, but that's
enough to make me feel confident that this is a good way forward:  it's
still all going through CSE that way.

We're still doing this any time we're on x86, not when targeting the
JIT, but that'll come next, see the new TODOs.  It's mildly better for
the interpreter to not use the _imm ops, but this is really all still
warmup for optimizations with less mild opinions.

I'm not proud of the switch/goto impl but it's the clearest I found.

Change-Id: I30594b403832343528b95967724fd50324cd79d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269232
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-07 16:21:08 +00:00
Michael Ludwig
7c6a4a898b Simplify domain insetting for bulk texture ops
Previously, the normalization, origin flip, and insetting occurred
simultanesouly. The problem was that whether or not the insetting
was needed had a cyclic dependency with the overall filter level
(not known until the end of the loop). So it had an ugly hack that
kept track of the early appended quads and would update their domains
if needed.

This will no longer work when perspective clipping is implemented because
we won't have a 1-1 mapping from quads+viewcount pairs back to the
texture set entries. However, by splitting the insetting out from the
rest of the normalization step, we can defer it until we're in
onPrePrepare w/o losing any optimization capabilities and scales with
the perspective clipping change in the future. It should also make it
easier to upgrade an op from kNearest to kBilerp in onCombineIfPossible
because the prior op will not have applied the bilerp-insetting yet.

Bug: skia:9779
Change-Id: I71b269730de200b8452e2a6b39b777928967f621
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269151
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-07 16:05:48 +00:00
Stephen White
b185785499 Reland "Cleanup program building a bit"
This reverts commit 77fdf66946.

Reason for revert: Skia-Dawn breakage should not be a tree closer.

Original change's description:
> Revert "Cleanup program building a bit"
> 
> This reverts commit 4777e3adde.
> 
> Reason for revert: This CL is breaking the build on Linux FYI SkiaRenderer Dawn Release 
> 
> Original change's description:
> > Cleanup program building a bit
> > 
> > This CL:
> >    now passes the GrProgramDesc as a const&
> >    returns GrGLProgram as an sk_sp
> >    makes the parameter ordering more consistent
> >    makes GrVkPipelineState no longer ref-counted
> > 
> > This is pulled out of the DDL pre-compile CL which touches this portion of the code.
> > 
> > Bug: skia:9455
> > Change-Id: Id4d06f93450e276de5a2662be330ae9523026244
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268777
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
> 
> TBR=egdaniel@google.com,robertphillips@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: skia:9455
> Change-Id: I7019d9876b68576274e87c3b2e6bbbf9695522ba
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269261
> Reviewed-by: Austin Eng <enga@google.com>
> Reviewed-by: Kenneth Russell <kbr@google.com>
> Reviewed-by: Stephen White <senorblanco@chromium.org>
> Commit-Queue: Stephen White <senorblanco@chromium.org>
> Auto-Submit: Austin Eng <enga@google.com>

TBR=egdaniel@google.com,robertphillips@google.com,senorblanco@chromium.org,kbr@google.com,enga@google.com

Change-Id: I62f6d38a8ac351e411f4605425caec3b4783fd70
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269358
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-02-07 15:33:38 +00:00
Michael Ludwig
6b45c5d3da Use DrawQuad struct to group device+local coords
This is part of a series to make it easier to manipulate the device and
local coordinates as the ops are being created. By instantiating a
single DrawQuad and allowing the functions to avoid having to copy the
GrQuads before making modifications (e.g. cropping, normalization,
or perspective clipping).

Bug: skia:9779
Change-Id: I0c6eefaee10638bc7483049d1993addeddc97005
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269141
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 15:25:58 +00:00
Brian Osman
87e3bef6f8 Reland "Switch runtime SkSL to always sample at explicit coords"
This reverts commit d4bf54eac6.

Change-Id: I65bfea4d880de29394e25d44d781fd18508fe337
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266942
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-07 14:39:29 +00:00
Austin Eng
77fdf66946 Revert "Cleanup program building a bit"
This reverts commit 4777e3adde.

Reason for revert: This CL is breaking the build on Linux FYI SkiaRenderer Dawn Release 

Original change's description:
> Cleanup program building a bit
> 
> This CL:
>    now passes the GrProgramDesc as a const&
>    returns GrGLProgram as an sk_sp
>    makes the parameter ordering more consistent
>    makes GrVkPipelineState no longer ref-counted
> 
> This is pulled out of the DDL pre-compile CL which touches this portion of the code.
> 
> Bug: skia:9455
> Change-Id: Id4d06f93450e276de5a2662be330ae9523026244
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268777
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

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

Bug: skia:9455
Change-Id: I7019d9876b68576274e87c3b2e6bbbf9695522ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269261
Reviewed-by: Austin Eng <enga@google.com>
Reviewed-by: Kenneth Russell <kbr@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Auto-Submit: Austin Eng <enga@google.com>
2020-02-07 13:37:48 +00:00
Greg Daniel
c7672092e8 Have gpu yuv code speak in views.
Bug: skia:9556
Change-Id: Iaa071d53248dfcd6d9e1bd88b24c8b39e133ced2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269148
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-06 21:47:02 +00:00
Chris Dalton
f51a52bf09 Convert DIRTY_AFTER_EDIT to SkPath::dirtyAfterEdit
Change-Id: I0394f0956c0589597ce910f4c0ad9f44bf4ee05e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269194
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-06 21:42:37 +00:00
Brian Salomon
4bb5026301 Return after callback on failure in GrRenderTargetContext::asyncReadPixels
Bug: chromium:1048251
Change-Id: I9c18e55fd791adbf446aa776de297b857af22b64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269237
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-06 21:41:57 +00:00
Ben Wagner
121750c2ef Remove extra semicolon
Causes a warning-treated-as-error with Chromium's Clang.

Change-Id: Idd3b6492fe2a532eca387f571cc2f9b6796d07df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269196
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Ben Wagner aka dogben <benjaminwagner@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-06 21:19:47 +00:00
Greg Daniel
ee72bd921a Add move assignment operator to GrSurfaceProxyView.
Bug: skia:9556
Change-Id: I3928a3f3350b222bda429195dc7115b9303d9598
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269199
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-06 21:10:25 +00:00
Brian Osman
ab2f7c5720 Reland "In GrSkSLFP, always use a coord transform"
This reverts commit fd7fd960be.

Change-Id: Id0f39dfd906f24e5c5eb054a28fc8e96ef73835e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 20:38:33 +00:00
Brian Osman
5f3d9f76c9 Replace usage of SkTClamp with SkTPin
I prefer the SkTClamp spelling, but there were 4 uses vs. ~200. And
eventually we'll replace all of these with std::clamp anyway.

Change-Id: I418fce5080d089745c3f9eb42c36e3fc7962c895
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269155
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 20:34:13 +00:00
Mike Klein
c90a8c72af calculate program hash in bulk
Now that Builder::Instructions are dense, it's easier to just calculate
Builder::hash() all at once when requested rather than as we go along.

(I'm planning to move the other use of Builder::Instruction hashing to
optimize() later too.)

Change-Id: I3124da5a3905291a907d08a12f62e794ed88e92d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269184
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-02-06 20:27:53 +00:00
Mike Klein
ed9b1f1c1e refactor out a middle representation
Kind of brewing a big refactor here, to give me some room between
skvm::Builder and skvm::Program to do optimizations, bakend
specializations and analysis.

As a warmup, I'm trying to split up today's Builder::Instruction into
two forms, first just what the user requested in Builder (this stays
Builder::Instruction) then a new type representing any transformation or
analysis we've done to it (OptimizedInstruction).

Roughly six important optimizations happen in SkVM today, in this order:
   1) constant folding
   2) backend-specific instruction specialization
   3) common sub-expression elimination
   4) reordering + dead code elimination
   5) loop invariant and lifetime analysis
   6) register assignment

At head 1-5 all happen in Builder, and 2 is particularly
awkward to have there (e.g. mul_f32 -> mul_f32_imm).
6 happens in Program per-backend, and that seems healthy.

As of this CL, 1-3 happen in Builder, 4-5 now on this middle
OptimizedInstruction format, and 6 still in Program.

I'd like to get to the point where 1 stays in Builder, 2-5 all happen on
this middle IR, and 6 stays in Program.  That ought to let me do things
like turn mul_f32 -> mul_f32_imm when it's good to and still benefit
from things like common sub-expression elimination and code reordering
happening after that trnasformation.

And then, I hope that's also a good spot to do more complicated
transformations, like lowering gather8 into gather32 plus some fix up
when targeting an x86 JIT but not anywhere else.  Today's Builder is too
early to know whether we should do this or not, and in Program it's
actually kind of awkward to do this sort of thing while also doing
having to do register assignment.  Some middle might be right.

Change-Id: I9c00268a084f07fbab88d05eb441f1957a0d7c67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269181
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-06 20:09:53 +00:00
Brian Osman
762b42ff73 Remove SkClampMax
Change-Id: I9709dfdfd6069d46c331d08e181e36cc9a21e71a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269149
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 19:49:53 +00:00
Michael Ludwig
6c48aad1a3 Fix compiler warning using mixed enum types
Started getting:

   error: bitwise operation between different enumeration types ('GrStencilSettings::(anonymous enum at ../../src/gpu/GrStencilSettings.h:134:5)' and 'GrStencilFlags') [-Werror,-Wanon-enum-enum-conversion]
       if ((kInvalid_PrivateFlag | kDisabled_StencilFlag) & (fFlags | that.fFlags)) {

after updating clang, which this CL fixes.

Change-Id: Ib2668e98298248ce5712d4ee9f125c78bf3445b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269140
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-02-06 18:43:11 +00:00
Brian Osman
aba642c6ac Remove SkScalarClampMax and SkScalarPin
Change-Id: Ic96a0ea2cd1bfd59ee3f236543e1d6dd102544ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269142
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-06 18:29:51 +00:00
Brian Osman
7f36405ea3 Remove SkMin32/SkMax32
Use std::max and std::min instead

Change-Id: I7fd2626ea9ea8ea09c709ff962523ca3de2f8a16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269136
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 17:31:51 +00:00
Brian Osman
116b33e8ab Remove SkMaxScalar and SkMinScalar
Use std::max and std::min instead

Change-Id: Icf3796609e5cb511687fb50bd31229ae4b6b9b39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268841
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 15:43:22 +00:00
Greg Daniel
febdedfa44 Switch SkImage_Base asTextureProxyRef to return view instead.
Bug: skia:9556
Change-Id: Ibcdf187021c22290013d99d8684f891576046052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268937
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-06 15:38:21 +00:00
Greg Daniel
cc21d0c1f2 Reland "Change refPinnedTextureProxy to return a view instead."
This reverts commit ebc00f97fa.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Change refPinnedTextureProxy to return a view instead."
> 
> This reverts commit becd2fe91d.
> 
> Reason for revert: crashing in pre-abandon
> 
> Original change's description:
> > Change refPinnedTextureProxy to return a view instead.
> > 
> > Bug: skia:9556
> > Change-Id: Iad3fbadb893d029fc39f0b682c9f8fc223c010a5
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268843
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> 
> TBR=egdaniel@google.com,brianosman@google.com
> 
> Change-Id: I496e4d9f7fc43e990b3e1ae2b2d2a461deeadb8f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9556
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268940
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Bug: skia:9556
Change-Id: I5b80c13bab080264984271e94dd0256ffb694f50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268942
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-06 14:15:31 +00:00
Greg Daniel
ebc00f97fa Revert "Change refPinnedTextureProxy to return a view instead."
This reverts commit becd2fe91d.

Reason for revert: crashing in pre-abandon

Original change's description:
> Change refPinnedTextureProxy to return a view instead.
> 
> Bug: skia:9556
> Change-Id: Iad3fbadb893d029fc39f0b682c9f8fc223c010a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268843
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I496e4d9f7fc43e990b3e1ae2b2d2a461deeadb8f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268940
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-05 21:47:47 +00:00
Greg Daniel
becd2fe91d Change refPinnedTextureProxy to return a view instead.
Bug: skia:9556
Change-Id: Iad3fbadb893d029fc39f0b682c9f8fc223c010a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268843
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-05 21:35:09 +00:00
Herb Derby
b8ffaecc32 Add a mutex to SkStrike to regulate multithreaded access
This is not needed currently because the SkStrikeCache
still uses the remove/replace method of multi-threading.
This will let me see any overhead problems. The next CL
will be a multi-threaded test.

Change-Id: Ida8255cc86816fa21b4315a4bbccfbfab5ca475c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268683
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-05 21:15:38 +00:00
Florin Malita
4a6a640299 [skottie] Add support for ADBE Pro Levels2 effect
Similar to existing ADBE Easy Levels2, but provides separate mapping
controls per channel.

Change-Id: Ibc58c58e1e8cb8793d6eb819998c1804ccbbf859
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-05 21:05:08 +00:00
Herb Derby
653d2a4eee Remove search of desperation
Change-Id: Id862057ad5b853e979a9e93fc43a559360b400d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268842
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
2020-02-05 20:04:58 +00:00
Brian Osman
0a3c57f1ad Ensure that ArithmeticFPInputs is fully initialized
Change-Id: Ia5e94704955aba33e07592711656fbeefef15912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 18:52:17 +00:00
Greg Daniel
ba51d6859e Update bicubic effect factories to take a view.
Bug: skia:9556
Change-Id: I7631299f7be37f3e12e95188f25ca0ef792b9eb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268838
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-05 18:38:38 +00:00
Robert Phillips
4777e3adde Cleanup program building a bit
This CL:
   now passes the GrProgramDesc as a const&
   returns GrGLProgram as an sk_sp
   makes the parameter ordering more consistent
   makes GrVkPipelineState no longer ref-counted

This is pulled out of the DDL pre-compile CL which touches this portion of the code.

Bug: skia:9455
Change-Id: Id4d06f93450e276de5a2662be330ae9523026244
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268777
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-05 18:11:07 +00:00
Brian Osman
3225306f82 In SkRuntimeEffect, just use hash of SkSL as the ID
Change-Id: I2ce210889452756d5d100fbb15f578bb72e2af2a
Bug: skia:9813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268687
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 17:52:48 +00:00
Brian Salomon
ed729f99af GrTextureEffect handles insets for float rects as well as integer rects.
Fix insets for clamp/nearest case.

Change-Id: I1fa2f6d172fdac59836ae73c7a5fec0d0cde020c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268397
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-02-05 17:43:07 +00:00
Chris Dalton
e13cbc3f15 Don't use tessellation FB barrier after NVIDIA 440.00
This bug has already been fixed on newer drivers.

Bug: skia:9739
Change-Id: I8407d4198bc0610dd9a239969d1cf69942494c96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268639
Reviewed-by: Mark Kilgard US <mjk@nvidia.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-05 17:12:37 +00:00
Greg Daniel
d2ccbb522e Have GrTextureEffect factories take a view as input.
Bug: skia:9556
Change-Id: I06fd7e9bc7e370a5b8891220308a6d362336be9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268632
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-05 16:19:57 +00:00
Brian Osman
9bfd5956de In GrSkSLFP, store inputs as SkData. Tighten size checks.
Simplifies interaction with users who already have inputs in this form,
and doesn't really add any overhead to other clients.

Change-Id: I6e137e02a65e007621adf481ffb994665117caf4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268836
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-05 16:19:08 +00:00
Greg Daniel
37c127f558 Rename view getters in various image subclasses.
This also changes the SkImage_Base header to return a const& view and
then removes the equivalent version in SkImage_GpuBase.

Bug: skia:9556
Change-Id: Ica096693a22c0fc590786058c055fb28387c80a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268624
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
2020-02-05 16:02:27 +00:00
Greg Daniel
c61d7e3d6e Rename various getters related to GrSurfaceProxyView.
Bug: skia:9556
Change-Id: Ib418beeb6c62854462a6023ebe410c7ca76e6dec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268620
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
2020-02-05 14:29:08 +00:00
Chris Dalton
bc3307c395 Don't do clear or round rect optimizations when a rect has stencil
Change-Id: Ib506c0cc3c46d1bf514b35a8ba78d31d3e84f22c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268666
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-02-05 06:42:53 +00:00
Greg Daniel
3b23de5878 Make sure we invalidate mapped memory from vk transfer buffers before reading.
When doing asyncRead we were not calling invalidatemappedMemory after calling
map on the transfer buffer. This is an issue if we happen to be using
non-coherent memory to back the buffer. Our normal read pixels call was manually
calling invalidate so that was working fine.

Bug: skia:9867
Change-Id: I765d12f75c914db0dba008433836463898a9712c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268681
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-04 21:33:20 +00:00
Mike Klein
e47b0e5055 remove misleading Uniforms apis
There's no really good reason to push uniforms in bulk
if there's no supported way to use them as an array.

Change-Id: Iaad133b96067fd570889ed1510705e4e98a351a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268646
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-04 18:33:48 +00:00
Mike Klein
399ef6915d thread alloc through to color filters
Change-Id: I783c32d92fac8c78e26f15a8e9bb6f43395d1d3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268648
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-04 18:17:08 +00:00
Jim Van Verth
b339e77937 Set NSError on compilation/link timeouts.
When compilation fails GrCompileMtlShaderLibrary expects the error
result to be set. This also allows us to print out all errors with
compilation and pipeline creation in central locations.

Change-Id: I7c3d5dda5bd46a95b55365cb0b8f07d79c030db6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268625
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-02-04 17:59:51 +00:00
Robert Phillips
a2406f9218 Fix BC1 SW decompression on platforms with RGBA PM color order
Bug: skia:9680
Change-Id: Ibe802ea574d749ebd601118d0e6da32b2a18fab2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268619
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-04 16:10:20 +00:00
Brian Osman
2aee7d24da Ignore warnings when compiling MSL
If there are errors, newLibraryWithSource returns nil and fills
out error. If there are warnings, it returns the compiled library,
and fills out error.

With changes to invokeChild, some lighting shaders were compiling
with warnings (unused variables).

Bug: skia:9830
Change-Id: I93f9f88998c64c8b4dbd64b81b6b7ab08921b9d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268622
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-04 15:37:00 +00:00
Florin Malita
d589916ebc Potentially-uninitialized Sk3LookAt result
Bug: oss-fuzz:20520
Change-Id: I383881571fa156c6faa5e798a1e126bb9e5e8dd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268621
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-04 15:31:30 +00:00
Mike Klein
4bcab23423 tweak screen math
Seems to help get past our r,g,b <= a asserts better.
I guess it keeps more precision from the small s*d term?

    Old:  (s+d) - (s*d)
    New:  s + (d - (s*d))

Change-Id: Ib9b9472e2c08aef688bbfdbccaf0bd45b7bf3ecd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268592
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-04 15:31:00 +00:00
Robert Phillips
d095b9f5d7 Fix SW decompression of BC1 and add a GM to check it (take 2).
Bug: skia:9680
Change-Id: I59a4c18f7ba7d04162715cfcbeefd70f84609edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268439
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-04 13:41:10 +00:00
Mike Klein
0772b4bd33 Reland "unorm/unorm -> to_unorm/from_unorm"
This is a reland of cd4e5662ac

Original change's description:
> unorm/unorm -> to_unorm/from_unorm
> 
> Just better names, no real change.
> 
> Change-Id: I7a67ccb49d5367137b6a1f100434cb866f15ea71
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268389
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Change-Id: I2843cf77a4b3c8888ef835b2ad5045d900d44e3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268516
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-04 00:19:31 +00:00
Mike Reed
f6d668ec28 Reland "add skvm for tablecolorfilter"
This is a reland of bf3087f65d

Original change's description:
> add skvm for tablecolorfilter
> 
> Change-Id: I712bf165a8af956f7447cb4c43949a4abcb2fea6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268308
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Change-Id: I76be0303a7df1db2ecd95a49ff6f29db2b8e41c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268502
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 23:50:41 +00:00
Mike Klein
59cd566536 gather pointers are not necessarily aligned
The pointers in the uniforms are copied in 4 byte
chunks and are not necessarily sizeof(void*) aligned.

Change-Id: Ied066faf8026cd30d72b88490883649c3624e763
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268498
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 23:34:02 +00:00
Mike Klein
6c80d24b5f Revert "add skvm for tablecolorfilter"
This reverts commit bf3087f65d.

Reason for revert: exposed at least one latent bug, I think.  Will reland as I can fix them.

Original change's description:
> add skvm for tablecolorfilter
> 
> Change-Id: I712bf165a8af956f7447cb4c43949a4abcb2fea6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268308
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: Iee6f64c70fed41230ad5de5c0fd34e915741102a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268497
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 22:41:21 +00:00
Mike Klein
8feac2d718 Revert "unorm/unorm -> to_unorm/from_unorm"
This reverts commit cd4e5662ac.

Reason for revert: reverting dependent changes

Original change's description:
> unorm/unorm -> to_unorm/from_unorm
> 
> Just better names, no real change.
> 
> Change-Id: I7a67ccb49d5367137b6a1f100434cb866f15ea71
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268389
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: I0afc659ad0bb9e5145873aaad559ceaf2b70ee0d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268496
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 22:40:41 +00:00
Mike Klein
c66882ebcd Revert "impl gather8/gather16 with gather32"
This reverts commit d4e3b9e8bc.

Reason for revert: will reland with fixes

Original change's description:
> impl gather8/gather16 with gather32
> 
> This is our quick path to JIT small gathers.
> 
> The idea is roughly,
> 
>    const uint32_t* ptr32 = ptr8;
>    uint32_t abcd = ptr32[ix/4];
>    switch (ix & 3) {
>      case 3: return (abcd >> 24)       ;
>      case 2: return (abcd >> 16) & 0xff;
>      case 1: return (abcd >>  8) & 0xff;
>      case 0: return (abcd      ) & 0xff;
>    }
> 
> With the idea that if we may load a given byte,
> we should also be allowed to load the four byte
> aligned word that byte falls within.
> 
> Change-Id: I7fb1085306050c918ccf505f1d2e1e87db3b8c9a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268381
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: I48d800edc6517f37e04752c91616b666a5e0f384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268490
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 21:55:22 +00:00
Herb Derby
c1d71d367c Arrange atlas image processing by frequency
Change-Id: I19948ba003c203805d145eb8dc644142573f3646
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268456
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-03 21:55:21 +00:00
Jim Van Verth
073d271864 Fix timeout for Metal compiler.
dispatch_time() takes nanoseconds, not microseconds.

Change-Id: Ia292eef0373fc8e48e6cc900f106ddf438cd74f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268440
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-03 21:36:21 +00:00
Robert Phillips
ab5da1f6b6 Revert "Fix SW decompression of BC1 and add a GM to check it."
This reverts commit 4238751bc3.

Reason for revert: This appears to be turning the PreAbandonGpuContext bot red

Original change's description:
> Fix SW decompression of BC1 and add a GM to check it.
> 
> Bug: skia:9680
> Change-Id: I8a8f9ee1aad783fc247c5516ac1effd0dab25936
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268158
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I4304f13453579eb3ee6d3c0febe8c94ebfe915b2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9680
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268438
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-03 21:03:41 +00:00
Robert Phillips
4238751bc3 Fix SW decompression of BC1 and add a GM to check it.
Bug: skia:9680
Change-Id: I8a8f9ee1aad783fc247c5516ac1effd0dab25936
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268158
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-03 20:42:31 +00:00
Greg Daniel
cc104db12c Have GrTextureProducer return views instead of proxies.
Bug: skia:9556
Change-Id: Ieedb9c48914c637278203d4d462c19b2d85b27d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268396
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-02-03 20:42:21 +00:00
Mike Klein
cd4e5662ac unorm/unorm -> to_unorm/from_unorm
Just better names, no real change.

Change-Id: I7a67ccb49d5367137b6a1f100434cb866f15ea71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268389
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 20:25:21 +00:00
Herb Derby
70c5fcc6d6 Move the bulk glyph calls up the stack
Moving this call up the stack gets thing in a better position
to bulkify this whole call stack.

Clean up some of the API to make more sense.

Change-Id: Iad7aca81f60b74a61344ff0679c1c323c49b7f48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268436
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-03 20:21:01 +00:00
Mike Reed
bf3087f65d add skvm for tablecolorfilter
Change-Id: I712bf165a8af956f7447cb4c43949a4abcb2fea6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268308
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 19:49:41 +00:00
Mike Klein
d4e3b9e8bc impl gather8/gather16 with gather32
This is our quick path to JIT small gathers.

The idea is roughly,

   const uint32_t* ptr32 = ptr8;
   uint32_t abcd = ptr32[ix/4];
   switch (ix & 3) {
     case 3: return (abcd >> 24)       ;
     case 2: return (abcd >> 16) & 0xff;
     case 1: return (abcd >>  8) & 0xff;
     case 0: return (abcd      ) & 0xff;
   }

With the idea that if we may load a given byte,
we should also be allowed to load the four byte
aligned word that byte falls within.

Change-Id: I7fb1085306050c918ccf505f1d2e1e87db3b8c9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268381
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 19:47:41 +00:00
Sean Gilhuly
23e2ad174c SkiaDawn: Connect GrIOType in onWrapBackendTexture
Pass the GrIOType parameter through to GrDawnTexture::MakeWrapped(), and
flag the texture as read-only if necessary. For renderable backend
textures, use the read-write io type.

This fixes an assertion failure in GrTextureProxy::onValidateSurface().

Change-Id: Ia55fe6ccfdd42dc426524947b69f28199de8282b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255861
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-02-03 18:33:09 +00:00
Leon Scroggins III
196f319b72 Allow decoding without color conversion
Bug: b/135133301

Especially for the Android NDK, which may not be able to report the
default profile, we should be able to decode the image without doing
any color correction. That way if the client wants to figure out
the color profile on their own (e.g. by parsing the data manually),
they can retrieve the un-corrected pixels and treat them appropriately.

Note that internally, we still require a destination profile for F16,
but we will use the source profile if there is one, or SRGB for source
and destination otherwise. Regardless, this will result in no color
correction.

Change-Id: Id1157bb99d3119a114b25f64b38620480a027f34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268157
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-02-03 18:21:35 +00:00
Herb Derby
5ddc34ca3d Remove 565 mask data from GrStrikeCache to constexpr varialbe
Move the 565 from the GrStrikeCache to the routine that uses it.
Remove all the plumbing needed to get it there.
Remove unused variable from GrStrikeCache's ctor.

Change-Id: I6d6630ace0e22ec9c4f68e4c359beda6354c323f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268168
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-02-03 16:27:05 +00:00
Brian Salomon
1fe3c3d183 Use GrTextureEffect::MakeTexelSubset instead of MakeSubset in SkGpuBlurUtils
Change-Id: Ia3dad5cb12c3eb9526322fa846409c935e26d01a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268303
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-02-03 16:13:55 +00:00
Jim Van Verth
fb39510008 Reland "Wrap page index packing in helper methods."
Also simplifies the shaders if we know there's only one atlas texture.

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266566
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: Ibb21fa19b067879da411e9f08e1cc9275627cae9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268302
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-02-03 15:38:35 +00:00
Robert Phillips
d4f68317fe Add SW decode of ETC1 and a GM
The GM exercises the compressed image formats using externally created resources

Note: the original image for the new flower resources can be found on Wikimedia Commons and has a "CC0 1.0 Universal Public Domain Dedication" license.

Bug: skia:9680
Change-Id: I6c5f9a12fcbbecdc3ba548dbb078bc21522073fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267836
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-03 13:56:15 +00:00
Herb Derby
3d05192abe Simplify subrun atlas generation tracking
The atlas generation's tracking was in two places. Gather
all into regenerate.

Gather more of the bulk use tracking into regenerate, and
cleanup some of the bulk use comments.

Change-Id: I87727b087d4605de9fa4684f4662fa49dc424863
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268164
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-01 22:06:21 +00:00
Brian Osman
5d92ae2b56 Implement constantOutputForConstantInput in GrColorSpaceXformEffect
Change-Id: I70e932a344d462e7d726d29285981f25214d9360
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268161
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-01 14:33:31 +00:00
Andrew Grieve
133177bd12 Add missing "const" to SkMD5::finish::PADDING
This moves it from .data to .rodata ELF section (more efficient)

Bug: chromium:747064
Change-Id: I4d12ce6622bd9d1264d46e48855a43f00671bee4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268200
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-01 03:21:51 +00:00
Herb Derby
4513cdde49 Rename flush -> issueDrawMaybeInlineUpload
Change-Id: Ida1cc45fa7b7f72fe60c750636c5693564531ff0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268156
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Herb Derby <herb@google.com>
2020-01-31 20:32:29 +00:00
Mike Klein
c0c0522e80 let's try to fix nullptr + k
Apply -fsanitize-recover=pointer-overflow to third_party code only.

I'm trying to keep Skia behaving the same, avoiding illegal nullptr+k:
    - Add null check in SkJSON fast string path.
    - Add null check (first alloc) and some comments to SkArenaAlloc.
    - March an int index instead dst pointer in SkBase64.

Bug: skia:9731
Change-Id: I646635558ea63ded846b746f2a1f0b4f1e1eacff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268109
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-31 19:24:21 +00:00
Robert Phillips
e0735529fa Minor GM cleanup
This CL:
1) Makes the compressed_textures GM use a red outline to indicate decompression (instead of a color rotation)

2) Disallows GPU resizing of textures w/ alpha in the wacky_yuv_formats GM

3) Guards GrTwoColorBC1Compress with GR_TEST_UTILS to make it clear that it is just a testing utility

4) Fixes the wacky_yuv_formats GM on platforms with RGBA PM color order

Change-Id: I3942c4ab1d2c1fab3c8d39c6c99136b75ba10132
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268119
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-31 19:06:19 +00:00
Dominik Röttsches
c9b06ca708 Remove CGFontRef parameter from SkMakeTypefaceFromCTFont
Since the Blink side CTFontRefs are no longer created from CGFontRefs
after [1], we do not need to pass CGFontRefs to Skia any longer for
keeping them alive. Clean up related plumbing which previously passed
through the CGFontRef to the SkTypefaceMac constructor.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1964073

Bug: chromium:1033478
Change-Id: Ic85cae6289fa9b4886201c92defb54fcc5622720
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266816
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-01-31 18:35:10 +00:00
Jim Van Verth
b71f023957 Enable async MTLLibrary and MTLRenderPipelineState creation.
Renables the Programs test on the Metal bots.

Bug: skia:9817
Change-Id: Ie1f0b520e37793e5a45ab85a55fd3cdc5f775977
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266572
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-31 16:43:30 +00:00
Herb Derby
0ee16f6898 Add reverse iterators to SkSpan
Change-Id: Ie4002a97fca860f0096ad9114f707ba8476aabb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267936
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-31 02:27:11 +00:00
Herb Derby
a90ed95d13 Cleanup GrStrike management because we do not abandon strikes
Change-Id: I23e44ae389d00ae6dad6b04e24522f854dc98d75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267177
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-01-30 23:13:08 +00:00
Greg Daniel
40903af42b Update GrSurfaceProxy::Copy to return a view.
Additionally this changes updates GrRenderTargetContext drawTexture to take
a view. This was done since there were a bunch of places where the result
of the copy goes straight to the drawTexture call.

Bug: skia:9556
Change-Id: If7094eb51ed343620011d03b86d603e3c6289c17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267856
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-30 20:43:56 +00:00
Robert Phillips
314524ea80 Add compressed backend textures to Metal (take 2)
Bug: skia:9680
Change-Id: I88035added2fd1721ef98048bd3344ab90e3da5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266199
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-30 17:33:10 +00:00
Brian Salomon
64874eaa30 Avoid using kClamp domain in GrMatrixConvolutionEffect::MakeGaussian.
SkBlurMaskFilterImpl::filterMaskGPU uses full src proxy as srcBounds
passed to SkGpuBlurUtils::GaussianFilter.

Change-Id: Ia3e3b339f358f551e37b80328cfdb7382af902b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267480
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-30 14:28:09 +00:00
Mike Klein
ce9e060b48 finish up 2pt conicals
In the end it turned out best to let the subclasses
modify the mask, rather than return how to do it.
This gave more flexibility about how to calcualte it.

Add negate(x), norm(x,y).

Change-Id: Ie17050037f0441becf06897fbe31587d6709009d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267456
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-30 13:59:28 +00:00
Chris Dalton
4328e928ef Add a stencil/tessellation hybrid mode for path rendering
This is a hybrid approach where we stencil only the curves using GPU
tessellation shaders, and then tessellate the path's inner polygon on
CPU and draw it directly to the final render target, stencilled
against the curves. Tessellating just the inner polygon is more than
fast enough to do in real time, and still allows us fill in the
majority of pixels in a single render pass. It gives us most the
benefit of CPU tessellation, but at a fraction of the cost.
Furthermore, the tessellated inner polygon can potentially be cached
and reused independent of the view matrix.

Change-Id: Id45adc643b51ab80a0c655dd2045a5314bdc7507
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266456
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-01-30 01:44:15 +00:00
Greg Daniel
5c082496e1 Use views throughout gpu blur code.
Bug: skia:9556
Change-Id: I3988c8112d72d5453cf93e58542eb68b16e67e1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267452
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-29 20:37:00 +00:00
Chris Dalton
6ccc032f4b Add a "kSimpleInnerPolygons" mode to GrTessellator
The inner polygons connect the endpoints of each verb. (i.e., they are
the path that would result from collapsing all curves to single
lines.) Requiring it to be simple means the tessellator will abort if
there is any self intersection or double winding.

This exciting new mode will be used by the GPU tessellator. It will
stencil the curves only, then draw the inner polygon directly to the
canvas. This gives us most the advantage of CPU tessellation, at a
fraction of the cost. And the tessellated inner polygon can
potentially be cached and reused independent of the view matrix.

Change-Id: I4c70b18c6f8b011396e00a5b08997cdf9846c9af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266422
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-29 19:08:07 +00:00
Brian Salomon
38c85d262c Check for valid stencil buffer in GrGLGpu::clearStencilClip
Bug: chromium:984747
Change-Id: Ic71786a4de31b8836a4d28863cfaa474ed77502e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267446
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
2020-01-29 18:50:07 +00:00
Brian Salomon
37e7b36a3d Make cache RRect blur masks with exact fit textures.
I made this be kApprox here:
https://skia-review.googlesource.com/c/skia/+/264838

to resolve a TODO. However, it uses more memory and after thinking about
it I'm not sure why it was a TODO to use an approximate texture for a
cached texture. If it's worth caching it's probably worth making a trim
texture.

Bug: chromium:1044017

Change-Id: Iac8302291592231875f5619b33e8ee6e13a92a64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267444
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-29 18:31:59 +00:00
Chris Dalton
022bd3b32a Preserve triangle winding in GrTessellator
Ensures the tessellator's triangles always wind in the same direction
as if the path had been triangulated as a simple fan (a la red book).

Change-Id: I1275a6dc9c2673e5f710ca46c357409dcd233162
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263390
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-01-29 18:24:57 +00:00
Greg Daniel
8354717302 Remove asTextureProxyRef from SkSpecialImage.
We replace all uses of the function with asSurfaceProxyViewRef.

Bug: skia:9556
Change-Id: I23d425531d78e30fc401b04169d5dc96072cdd80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267181
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-29 16:47:06 +00:00
Mike Reed
a2a0c8a2c4 extract font from run
Change-Id: Ice98eeb1f815cf07f842b22ddc26e32e849a1218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-29 15:28:06 +00:00
Robert Phillips
45c9487914 Add SkImage::MakeTextureFromCompressed and deprecate MakeFromCompressed
Bug: skia:9680
Change-Id: Ifb8bc362cb2d2d3c0640f81eb6a11a613bf18de6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267178
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-29 13:21:55 +00:00
Mike Klein
caf5ee4451 start on 2pt conical gradients
Couple ways to do this masking, but since we basically
need the same for decal, seems easiest to send it up to
the common code and handle it all together.

Change-Id: Idf806d7feab12a9caf339febd30dd3a2432ec038
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267244
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-29 03:43:42 +00:00
Chris Dalton
dcc8c5431b Convert the "bool antialias" param in GrTessellator to an enum
Change-Id: I685f4fd9e4c5b01a9b727a21f525721f025957a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266421
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2020-01-29 01:27:02 +00:00
Greg Daniel
c52db71c9b Store GrSurfaceProxyViews on SkSpecial*_Gpu.
To make this change cleaner, GrMakeCachedBitmapProxy now returns a view
and all its callers updated.

Additionally some effects were updated to fully use views in cases
where they had to be updated anyways to support SpecialImages and there
wasn't much additional work to pass them around everywhere.

Bug: skia:9556
Change-Id: Ie5a631cdec481391437e2f74275f958d15676780
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267176
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-29 00:24:33 +00:00
Mike Klein
faa34c536b partial strength reduction for bit ops
We had full constant eval of these already; this adds a bunch of
degenerate cases when one argument is known to be true or false.

Change-Id: Ic0535d8a99357947fd73bd9f719eec4645dc919d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267243
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-28 23:50:01 +00:00
Greg Daniel
6f5441a2f6 Remove create function in proxyProvider that takes a raster SkImage.
Instead in proxyProvider we just have a create a bitmap call which
does no special fallback or logic. All the callers now go through
GrBitmapTextureMaker which handles and special fallbacks or caching
support that we need.

Change-Id: I71bb896cc78f64f9d6d54b54af2490d48e0f5af5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266842
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-28 23:29:32 +00:00
Mike Klein
bd1360f4d7 skvm sweep gradients
Basically the same as SkRasterPipeline version.
Need to thread uniforms through for scale/bias.

Change-Id: I27fd91469d9108d155a751dad71047eded4b6692
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267223
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-28 22:08:20 +00:00
Brian Salomon
2ea69aa297 Fix asyncRescaleAndReadPixelsYUV420 fallback w/out GL_EXT_texture_rg.
Copying the color type from the RTCs is incorrect because we may have
fallen back to GL_RGBA8 if GL_R8 is not renderable.

Change-Id: Ie8effabfe60c2410d200b1775f463d5edb13fe81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267179
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-01-28 21:46:50 +00:00
Mike Klein
ba9da466cc radial gradients in skvm
- Add sqrt(), vsqrtps for x86.
- Hook into SkRadialGradient.

Change-Id: I66a4598e30fe16610c59a512f7d962323ee5134a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267196
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-28 21:04:36 +00:00
Herb Derby
0ef780befd Use a monotonic counter for atlas and plot generations
Currently when the GPU resources are freed, the generation counters
are reset back to 1. This could allow stale data to be retained in the
SubRun texture coordinates. In addition, it confuses managing the
GrStrikes.

Use monotonic counters so that no number is ever repeated. This allows
for a simple check of equality without any additional checks or constrinats.

Bug: chromium:1045016

Change-Id: Ib58abf9a99107a37927fa73aef88a95900f70a5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266618
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-01-28 21:01:36 +00:00
Mike Klein
d352529216 incorporate r,g,b,a into shaderHash
Today's shader hash changes if the unordered set of {r,g,b,a} values we
produce changes, but is not sensitive to simple order changes like
sampling RGBA vs BGRA.

Folding in a hash of each value's ID in order will fix this.

This has been difficult to track down (thread-local caches),
so I've added a GM that reliably reproduces the bug.

Live demo: https://fiddle.skia.org/c/30f2e5b731c2e53a6f092424c585ca41

Bug: skia:9819
Change-Id: Iceb09d89eb036735028ae97dc79c576787199ac5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267119
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-28 20:58:37 +00:00
Robert Phillips
162e04b9a9 Expand the compressed_textures GM
This CL adds testing for some edge cases in compressed texture handling

Bug: skia:9680
Change-Id: I4915f46bca9e2fb5c827a51152f28dc1e9d22942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266201
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-01-28 20:34:18 +00:00
Herb Derby
6d54a1e5f0 Atlas generation numbers is not tracking plot changes -- disable it
The atlas generation number is used avoid checking if each glyph has
a valid plot location. If the atlas generation number ever misses
an eviction of a plot, then some glyph atlas coordinates will be considered
valid when in fact they are stale.

Fix: Always check the texture coordinates of every glyph. Don't use the
atlas generation numbering to reduce work.

Bug: chromium:1045016
Change-Id: I287d3bbcd0a5d679327002595ae50e0f775dca12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267096
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-28 19:35:34 +00:00
Stephen White
f03c116021 Roll dawn and adjust for new SwapChain API.
Split GrDawnImageInfo into GrDawnTextureInfo and GrDawnRenderTargetInfo.
The former holds only a wgpu::Texture, and the latter holds only a
wgpu::TextureView. This split is necessary because Dawn SwapChains now
vend TextureViews, not Textures.

The TextureView held by GrDawnRenderTargetInfo is always 1-mip, since
it's a requirement for rendering to a texture in Dawn.

Change-Id: Id6e99b5e4bf18f97e939170856a665e2038253ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254810
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-28 18:26:44 +00:00
Brian Salomon
6aa65053d9 Add fallback for asyncRescaleAndReadPixelsYUV420 without PBOs.
Uses synchronous read pixels.

Change-Id: I6dac88a6d33a4771fc3108b43825a2f10dd7b51d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267044
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-28 17:48:14 +00:00
Kevin Lubick
f76da63fbd [canvaskit] Update build script to support latest Emscripten
Add workaround for https://github.com/emscripten-core/emscripten/issues/10072

Note to reviewer, please check out the steps I added
in canvaskit/README.md to document this process.

Bug: skia:9816
Change-Id: Idbe7ff08ac62f4f4d70e656384831b8d24c4a684
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266941
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-28 15:41:58 +00:00
Robert Phillips
99dead9830 Add SkImage::MakeRasterFromCompressed and make MakeFromCompressed fall back to decompression for unsupported compression types (take 2)
This is intended to make using compressed textures easier since developers can just provided compressed data and it will be uploaded to the GPU in some way, shape or form.


TBR=reed@google.com
Change-Id: I8c672ccc7db5cd098f629c3469ae7cbdc7436392
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266939
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-28 14:03:14 +00:00
Brian Salomon
7ee8ca5a32 Fix bug in NPOT shader wrap mode impl
TBR: michaelludwig@google.com

Change-Id: Ib44081d8ad2cb6fdb7be0fd6a088eda0eeb653bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266947
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-28 03:18:00 +00:00
Brian Osman
fd7fd960be Revert "In GrSkSLFP, always use a coord transform"
This reverts commit 36d6c599c3.

Reason for revert: May be responsible for Chrome roll failure? (Less likely than asyncRescaleAndReadPixels, just want to be safe).

Original change's description:
> In GrSkSLFP, always use a coord transform
> 
> The old logic would use sk_FragCoord if no matrix was supplied, but this
> was just wrong. Note that many uses of this class already supply a
> matrix (runtime shader), but some don't. In those cases, child effects
> that were expecting local coords as input would produce the wrong
> results.
> 
> Change-Id: I1d1092fc6c555225ddcfc9f19f346618ef777646
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266855
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

Change-Id: Ib7fd122ac625e8f8792518d82ff4c9cbdd37e448
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266946
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-28 00:28:02 +00:00
Herb Derby
4d72171297 Rename AtlasID to PlotLocator
I also tried to update variables and constants to match.

Change-Id: I2bbcc212f89bdecafb8a6b832c0de021ff03f2b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266569
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-27 21:21:16 +00:00
Brian Salomon
a7e5c7cd1a Fix case of asyncRescaleAndReadPixelsYUV420 for case where SkSurface is
backed by non-textureable FBO and no scaling/color space conversions is
performed.

Bug: chromium:1040643

Change-Id: I9fe9dc759fc8b2803569afaf874debd05efbfa33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266850
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-27 21:17:56 +00:00
Robert Phillips
3da9e94289 Revert "Add SkImage::MakeRasterFromCompressed and make MakeFromCompressed fall back to decompression for unsupported compression types"
This reverts commit 3234ce1347.

Reason for revert: missing etc1.h

Original change's description:
> Add SkImage::MakeRasterFromCompressed and make MakeFromCompressed fall back to decompression for unsupported compression types
> 
> This is intended to make using compressed textures easier since developers can just provided compressed data and it will be uploaded to the GPU in some way, shape or form.
> 
> Change-Id: Ieed008f083d6e3594eaa9a02bc5348e00ee60d2a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265601
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ia497e6767c43ab6f8bfeb28e70244107a1442cf2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266937
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-27 21:05:46 +00:00
Brian Osman
36d6c599c3 In GrSkSLFP, always use a coord transform
The old logic would use sk_FragCoord if no matrix was supplied, but this
was just wrong. Note that many uses of this class already supply a
matrix (runtime shader), but some don't. In those cases, child effects
that were expecting local coords as input would produce the wrong
results.

Change-Id: I1d1092fc6c555225ddcfc9f19f346618ef777646
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266855
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-27 20:43:56 +00:00
Robert Phillips
3234ce1347 Add SkImage::MakeRasterFromCompressed and make MakeFromCompressed fall back to decompression for unsupported compression types
This is intended to make using compressed textures easier since developers can just provided compressed data and it will be uploaded to the GPU in some way, shape or form.

Change-Id: Ieed008f083d6e3594eaa9a02bc5348e00ee60d2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265601
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-27 20:15:36 +00:00
Herb Derby
2bdf95cb4c Swap dtor order of SkSTArenaAlloc and SkArenaAlloc v.2
The dtor of SkSTArenaAlloc is called before SkArenaAlloc which
technically invalidates the pointers stored in SkSTArenaAlloc's
inline memory. This causes MSAN to flag the pointers stored there
as uninitialized.

bugs:
b/72759286 b/148266659

Change-Id: If532399a93d558ea6eb1616e1a051e3263669564
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266851
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-01-27 20:07:56 +00:00
Brian Salomon
d4bf54eac6 Revert "Switch runtime SkSL to always sample at explicit coords"
This reverts commit b1e9971eb7.

Reason for revert: crbug_905548 GM drawing incorrect
before: https://gold.skia.org/img/images/32964364a8ac12af5a68bf95c24fb90c.png
after : https://gold.skia.org/img/images/0918b58c93c770c20cf475c37a70b528.png

Original change's description:
> Switch runtime SkSL to always sample at explicit coords
> 
> Change-Id: I4647d0f4a098acf399e1add1d87ca0752d0fdf90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266381
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

Change-Id: I0fb892148a424d5928878a49e3ccd5bfb9485b23
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-27 17:50:56 +00:00
Jim Van Verth
28a9b122f5 Revert "Wrap page index packing in helper methods."
This reverts commit cb93a20d9a.

Reason for revert: Still seeing some corruption issues with Chrome text that may be related to this.

Original change's description:
> Wrap page index packing in helper methods.
> 
> Also simplifies the shaders if we know there's only one atlas texture.
> 
> Change-Id: I81063d423fd56cf91caee83ba9eae9d988aa249b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266566
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=jvanverth@google.com,herb@google.com,brianosman@google.com

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

Change-Id: I031f27c07929b1f66581ed8e94e1056d9107bf75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266633
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-27 16:30:25 +00:00
Brian Osman
b1e9971eb7 Switch runtime SkSL to always sample at explicit coords
Change-Id: I4647d0f4a098acf399e1add1d87ca0752d0fdf90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266381
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-27 15:31:05 +00:00
Sergey Ulanov
f1b2b42613 Fix GrSmallPathRenderer to respect max texture size.
Previously GrSmallPathRenderer was always trying to create a 2048x2048
atlas texture, ignoring texture size limits of the target device. As
result the allocation fails when max texture size is below 2048. Fixed
GrSmallPathRenderer to use GrDrawOpAtlasConfig to calculate appropriate
atlas texture dimensions.

Bug: fuchsia:43693
Change-Id: Ieb5d32ab385dcd65a734c22fcb87cf50546109a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266425
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-01-27 15:18:05 +00:00
Mike Klein
f93a8436ce support dither in skvm
Dither is handled here by the blitter itself,
when requested and the shader is not constant.

A little refactoring to hang onto the integer (dx,dy)
dst coordinates we need, a little math using them,
and some plumbing to pass around whether or not to
dither and if so how much.

Left another TODO to think about unpremul dither.

Change-Id: Ia660cf12cc729578684233a48088aa703563ecd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266362
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-26 23:10:54 +00:00
Mike Klein
d92e4e9de7 cache only when SkVM has a JIT
It's not nearly as important to cache interpreted programs
as it is to cache JIT'd programs.

This should also fix the broken Flutter roll: they don't have
__cxa_thread_atexit(), but SKVM_JIT is not set, avoiding the
cache.

Change-Id: Id006b5909fb0c81c2ba9a0f2bbb66fd124ba19fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266759
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-26 20:17:54 +00:00
Mike Reed
d3963a3302 offer raw-array variant of remaining 44 methods
Change-Id: I11f938255dc0f8e5587a881159ebf8eac06870f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266624
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-26 18:40:04 +00:00
Mike Reed
00a9764319 consolidate examples to 1 matrix type
Change-Id: I40fcf8290608b838cd6bd189f2905b6ce16a12f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266681
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-26 00:06:20 +00:00
Mike Reed
78184a3ce6 Revert "convert sample completely to SkM4"
This reverts commit e455d2e708.

Reason for revert: more testing

Original change's description:
> convert sample completely to SkM4
> 
> Change-Id: Ib8fdf0f9c326f0809d132da650eaccc20e58f9f8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266676
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I946dbeb166b00a53aa7b3f470322c46d6263e9a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266678
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-25 03:20:39 +00:00
Mike Reed
e455d2e708 convert sample completely to SkM4
Change-Id: Ib8fdf0f9c326f0809d132da650eaccc20e58f9f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-25 03:05:39 +00:00
Ethan Nicholas
2329da078a add SkSLInterpreter vector instructions
Change-Id: I93c8754d55b9d462b056a77e95b852fc61f1fd66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266560
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-01-24 22:25:09 +00:00
Mike Reed
b4cce3fa50 Revert "Revert "add rotate to SkM44""
Fix: update the generator code itself for the vec --> ptr change

This reverts commit 44aa1ab584.

Change-Id: Idfec2b42239429e58501ca2ba108ec852891e237
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266575
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-24 21:00:28 +00:00
Brian Osman
978693cdaa Make invokeChild just return a string containing the child function call
Also removes several unused chunks of code that were declaring unused
variables, etc.

Change-Id: I47458736b189d59c0448c6f58b60a9b4ab046db2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266565
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-24 20:23:33 +00:00
Mike Reed
44aa1ab584 Revert "add rotate to SkM44"
This reverts commit a6272de86d.

Reason for revert: doh -- modified a generated file (again)

Original change's description:
> add rotate to SkM44
> 
> Declares that Skia is right-handed
> 
> Change-Id: Ie98773f0f0d748eadc0d1abcd860f6e8dbb56bcf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266564
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,reed@google.com,michaelludwig@google.com

Change-Id: Ic65428b839468d6065eb1d1d539162499b10be9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266573
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-24 20:21:08 +00:00
Brian Salomon
9b553273b9 Detect implementation read formats on ES.
This can allow for more efficient glReadPixels (e.g. read back of GL_R8
as GL_RED, GL_UNSIGNED_BYTE rather than GL_RGBA, GL_UNSIGNED_BYTE).

skia:8962

Change-Id: Ifa219517f1ce14b79e8af88c799cd5ef35f3a24c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266567
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-24 20:18:29 +00:00
Mike Reed
a6272de86d add rotate to SkM44
Declares that Skia is right-handed

Change-Id: Ie98773f0f0d748eadc0d1abcd860f6e8dbb56bcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266564
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-01-24 19:57:38 +00:00
Ben Wagner
f33dcc2aa2 Preserve FcConfig in SkFontConfigInterface_direct methods.
It is possible that some other thread will change the default FcConfig
out from under one of these methods, which is a terrible race. Prevent
this by taking a reference to the default FcConfig in the method and
keeping it alive while it is being used.

Previously an attempt was made to hold onto the FcConfig for the
lifetime of the SkFontConfigInterface_direct object. Unfortunately, some
users are holing onto SkFontConfigInterface_direct as a global and so it
is not obvious to free all instances before calling FcFini, which will
asert that no instances are still using the cache.

Bug: chromium:1004254
Change-Id: Ia173e90b95c43c40d91b366095eb97c0e466ab86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246216
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-01-24 18:54:18 +00:00
Jim Van Verth
cb93a20d9a Wrap page index packing in helper methods.
Also simplifies the shaders if we know there's only one atlas texture.

Change-Id: I81063d423fd56cf91caee83ba9eae9d988aa249b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266566
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-24 18:08:29 +00:00
Brian Salomon
ca6b2f4fc9 Revert "Revert "Move GrDomainEffect functionality into GrTextureEffect and delete""
This reverts commit 1c3e6cf313.

Fixes ES2 without NPOT support

Change-Id: I489e95f2b566d09e1b974421fb92c643e7da5135
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266563
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-24 16:58:37 +00:00
Robert Phillips
ba5c7adfef Make GrGpu::createBackendTexture match createCompressedBackendTexture
This is pulled out of the omnibus parameter reordering CL - which has become too large.

Change-Id: Ia647f4aac9f31600c6f72098233fe401895f23df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266537
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-01-24 16:30:47 +00:00
Jim Van Verth
2f2c77ae79 Revert "Reland "Reland "Add new method for storing DrawOpAtlas texture index."""
This reverts commit 3b9c544bf8.

Reason for revert: Probably causing text issues in Chrome

Original change's description:
> Reland "Reland "Add new method for storing DrawOpAtlas texture index.""
> 
> This is a reland of dea2f34f09
> 
> Original change's description:
> > Reland "Add new method for storing DrawOpAtlas texture index."
> > 
> > This is a reland of c8b2e61540
> > 
> > Original change's description:
> > > Add new method for storing DrawOpAtlas texture index.
> > > 
> > > Storing the texture index in the lower bit of each texture coordinate
> > > seems to have issues on certain iOS devices. Rather than do that, we
> > > use the sign of the texture coordinate to act as our storage bit.
> > > To manage encoding 0 we map [0, N] to [-1, -N-1] to represent a bit.
> > > 
> > > Change-Id: Ic588ee92cf858915a1833cf482d4b23bd11c1000
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263561
> > > Commit-Queue: Jim Van Verth <jvanverth@google.com>
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> > 
> > Change-Id: I901502c3d83ff9727c51ad4447b0cee733257649
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264566
> > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > Commit-Queue: Jim Van Verth <jvanverth@google.com>
> 
> Change-Id: I000bb74ca57e321084ca2d1d9dc2f0274880c0da
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264689
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,brianosman@google.com
Bug: 1045016

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

Change-Id: Ie376c7b3cb359f5378e4dd983a103da81ec92e5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266557
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-24 16:18:18 +00:00
Brian Osman
cddfc5e7ef Remove invokeChild variants that write to output color
Change-Id: I1788cd621704f580ff0c7d930138d463b724f314
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266556
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-24 15:54:22 +00:00
Mike Klein
b81e6975f2 clean up caches at thread exit
Change-Id: I9012a2769eb92d0d393e0eeb684a8bee8519323d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266522
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-24 15:50:17 +00:00
Brian Salomon
1c3e6cf313 Revert "Move GrDomainEffect functionality into GrTextureEffect and delete"
This reverts commit 988af46dd2.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Move GrDomainEffect functionality into GrTextureEffect and delete
> the former.
> 
> New factories for GrTextureEffect have two main variants:
> MakeTexelSubset(): adjusts the input integer rectangle to account for
> filtering
> 
> MakeSubset(): assumes caller has calculated the exact rectangle needed
> as floats.
> 
> Currently this disables filtering for shader-based mirroring or repeat.
> Will fix this later. The old effect also did not support this.
> 
> Change-Id: If47d8ecfbb349b0d7b39ab5ba864fe3cc1b139e4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265518
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: Ib81a79798668cd7df7d07f72a5113be9fc74180c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266536
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-24 14:50:07 +00:00
Ethan Nicholas
b962eff76c Revert "Revert "Complete rewrite of the SkSL interpreter""
This reverts commit 99c54f0290.

Change-Id: I010ac4fdb6c5b6bfbdf63f4dcac5dbf962b0ad9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266205
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-01-24 14:42:37 +00:00
Brian Salomon
988af46dd2 Move GrDomainEffect functionality into GrTextureEffect and delete
the former.

New factories for GrTextureEffect have two main variants:
MakeTexelSubset(): adjusts the input integer rectangle to account for
filtering

MakeSubset(): assumes caller has calculated the exact rectangle needed
as floats.

Currently this disables filtering for shader-based mirroring or repeat.
Will fix this later. The old effect also did not support this.

Change-Id: If47d8ecfbb349b0d7b39ab5ba864fe3cc1b139e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265518
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-24 14:23:55 +00:00
Brian Salomon
8675bcbaf9 Add support for GL_NV_fence.
Will be used for YUV420 readback on ANGLE ES 2 contexts in Chrome.

Marks the functions as required as Chrome now adds inits these on
GrGLInterface.

Bug: 1040643
Change-Id: I5504d4c9209874991592c9f86aaf7987c316aa40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265602
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-01-24 01:53:33 +00:00
Michael Ludwig
a7e557f3e3 Reland "Increase precision of some quad AA calculations"
This reverts commit 5195673c7a.

Reason for revert: Just waiting for the test suppression
Original change's description:
> Revert "Increase precision of some quad AA calculations"
> 
> This reverts commit 40a1353126.
> 
> Reason for revert: layout tests need rebaseline
> 
> Original change's description:
> > Increase precision of some quad AA calculations
> > 
> > This stops using the low precision rsqrt and instead does a divide + sqrt.
> > It also separates the single kTolerance value used in GrQuadUtils' math
> > into a fairly fuzzy tolerance for edges/distances being close to zero
> > (e.g. a degenerate quad), and a more precise tolerance for linear systems
> > solutions.
> > 
> > The smaller tolerance value used for denominators in these solutions prevents
> > the solved-for coordinates from being mis-classified as "bad". The bad coord
> > resolution works on the assumption that its correcting points that are
> > co-located, but if the input coords were sufficiently large the linear
> > equations would have small denominators that were less than the fuzzy tolerance
> > and then the geometry would be improperly collapsed to a line.
> > 
> > For the selected zoom level of GM_crbug_10141204, this change is sufficient
> > to prevent the draw from being discarded. However, when animating the zoom
> > level, the input shape is sometimes still considered a fullscreen clear when
> > it shouldn't be. A follow up change will improve precision in CropToRect()
> > 
> > Bug: skia:9779, chromium:10141204
> > Change-Id: Id1518a908c03e7813868c4eff014d18388f8f62e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265976
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=robertphillips@google.com,michaelludwig@google.com
> 
> Change-Id: I44012a2728f75e235678f733c6da8870b84ae3ab
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9779, chromium:10141204
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266220
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: Ie7f19c1f7c4b742f34b24157aa7800f2a974e5bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9779, chromium:10141204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266221
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-01-24 00:54:21 +00:00
Mike Klein
6b6727375e use longer-lived alloc in CacheKey()
The gradient shader allocates data in the SkArenaAlloc
and points into it via its uniforms (as if it were a
bitmap or image), so we need to keep that alive while
it may be used.  The scope of CacheKey() is not long
enough.

When the cache is disabled or we get a cache miss,
everything was fine, since we were working out
of the long-lived fAlloc in Builder().

But when we hit something in the cache, we'd be left
trying to draw from data in this temporary scoped
SkArenaAlloc in CacheKey(), a use-after-free.

Change-Id: Ie873d57339180f4cd320c940a72aeb0563b93325
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266356
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-23 21:45:46 +00:00
Mike Klein
20b16bd5e1 force skvm interpreter in ASAN builds, add bots
I think this should catch the use-after-free when it runs
gm/lumafilter.  Reassuring to have running... may also want
to add MSAN bots.

Change-Id: Ia8ed9acdb66b2e5fca02d91922d01dddbd7f2207
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266359
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-23 21:44:56 +00:00
Brian Osman
300fe1db40 Use PipelineStageArgs throughout GrSkSLFP and PipelineStageCodeGenerator
Making it easier to modify the objects that are emitted by the generator
and consumed by the FP (as a pre-cursor to sampling children with
explicit coords).

Change-Id: Id746a23537c97ba7a8ac27a63622503f59c902f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266377
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-23 21:18:27 +00:00
Chris Dalton
d081dce968 Move GrTessellator::VertexAllocator to GrEagerVertexAllocator
Moves the interface up to Ganesh level and starts using it from other
locations.

Change-Id: I939d2b357d3ae8551976d0d71b877b72da403712
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266063
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-01-23 20:14:07 +00:00
Herb Derby
1a496c507e Convert evict callback from function to interface
This allows me to find uses of the eviction registratoin
easier in my IDE.

Change-Id: I127911f769d90716f6c8bb69d71b2255786aec21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265981
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-23 19:45:16 +00:00
Brian Osman
7abc7aa2db Remove unused functions and members from PipelineStageCodeGenerator
Change-Id: Ib5318575ab929f1e911c8cb13753fd6d19d48818
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266202
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-23 19:40:36 +00:00
Mike Klein
7d0861b202 more bits for shader program hash
gm/lumafilter is drawing wrong for me with SkVMBlitter,
but only when I enable its cache.  I thought it must be
a collision between program fingerprints, but on further
inspection that doesn't seem to be the case, even 32-bit.

But now that I've done this, might as well keep it.
Even if p(collision) is small, p^2 is smaller.

Other small cleanups to what we hash and how:
   - don't include derived fields in Instruction equality and hashing
   - use SkOpts::hash() instead of manual std::hash/xor hack

Small struct layout changes to keep everything dense.

Change-Id: I5ba817296f0bfefa0e18f62d103094d0c63bd50d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266282
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-23 19:08:07 +00:00
Robert Phillips
2716daf18e Clean up some "const SkISize& dimensions" usages w/in Ganesh
This is pulled out of the parameter reordering CL - which has become too large.

Change-Id: Id36875dd4a670611ab94a08a3a6df41c474e9022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266217
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-23 18:24:16 +00:00
Mike Reed
11b05bc11f Don't make promises about rowbytes
Since we just rely on SkBitmap to manage rowbytes, we don't need to
separately track it in the surface.

Bug: 1038304
Change-Id: Iea2d486019bf4c5bf4f2a87eabc5f00ad71949fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266219
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-23 17:58:36 +00:00
Greg Daniel
cce65006ad Treat GrTextureAdjusters mip copy like other producers, i.e. no fallback.
This makes sure that when we are not using repeat mode the colorType of
the producer will match the colorType of the returned proxy.

Bug: chromium:1044862
Change-Id: I9627517c383ff7c3e9801da21ddafdacfb747871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266218
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-23 17:35:46 +00:00
Michael Ludwig
5195673c7a Revert "Increase precision of some quad AA calculations"
This reverts commit 40a1353126.

Reason for revert: layout tests need rebaseline

Original change's description:
> Increase precision of some quad AA calculations
> 
> This stops using the low precision rsqrt and instead does a divide + sqrt.
> It also separates the single kTolerance value used in GrQuadUtils' math
> into a fairly fuzzy tolerance for edges/distances being close to zero
> (e.g. a degenerate quad), and a more precise tolerance for linear systems
> solutions.
> 
> The smaller tolerance value used for denominators in these solutions prevents
> the solved-for coordinates from being mis-classified as "bad". The bad coord
> resolution works on the assumption that its correcting points that are
> co-located, but if the input coords were sufficiently large the linear
> equations would have small denominators that were less than the fuzzy tolerance
> and then the geometry would be improperly collapsed to a line.
> 
> For the selected zoom level of GM_crbug_10141204, this change is sufficient
> to prevent the draw from being discarded. However, when animating the zoom
> level, the input shape is sometimes still considered a fullscreen clear when
> it shouldn't be. A follow up change will improve precision in CropToRect()
> 
> Bug: skia:9779, chromium:10141204
> Change-Id: Id1518a908c03e7813868c4eff014d18388f8f62e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265976
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I44012a2728f75e235678f733c6da8870b84ae3ab
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9779, chromium:10141204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266220
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-01-23 17:31:26 +00:00
Mike Klein
85754d5855 basic pass at gradients
This is looking pretty good.

Some egregious diffs, some invisible,
and a handful in-between I've investigated.

The egregious diffs look like bad shader caching.  I need to fix that,
but its brokenness is simply helpfully exposed here, not made any worse.
To repo, run: lumafilter, srcmode.

These in-between diffs all fall within the existing variance:
   crbug_938592               ok
   analytic_gradients         ok
   gradients_dup_color_stops  ok
Probably different geometry math, FMAs, reordering, etc.

I will follow up with radial etc,
and shallow gradients also demonstrate we're missing dither.

Change-Id: I5a046ee42accdf1faed50b3b65efb4a6787b5e04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265821
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-23 17:03:36 +00:00
Mike Reed
07d32b4d2d remove some memory-based methods, add rc()
Change-Id: I44d6f67dcd3d042127ad20ebdaa332e94f1b0829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266216
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-23 16:52:06 +00:00
Stephen White
3c0a50f038 Implement support for framebufferOnly render targets.
This reflects Dawn and Metal functionality.
Implement a FramebufferOnly flag on GrSurface and GrBackendRenderTarget.
Forward the state from GrBackendRenderTarget to GrSurface.
Check the GrSurface flag in GrGpu::readPixels() and GrGpu::writePixels()
and early-return.

Change-Id: I27d3c9c912b366791bfd0e1db49638d8925742f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262802
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2020-01-23 16:34:06 +00:00
Greg Daniel
4cb293392c GrPixelConfig is DEAD!!!!!
Bug: skia:6718
Change-Id: Iecad0943b428f7f0e22b45c4cdc7798df00f3e84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265982
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-23 16:25:26 +00:00
Michael Ludwig
8098e63c9e Increase precision in barycentric_coord calculations
For quads with very large coordinates, the barycentric coordinate
calculations could be very inaccurate in 32 bit. This lead to
erroneously thinking the render target was contained within the
quad's triangles, instead of just intersecting it.

By scaling the coordinates to a more reasonable magnitude before
multiplying and subtracting the coordinate values, reasonable
accuracy is preserved w/o needing to do everything in 64 bit.

Because it produces coordinates relative to the triangle vertices,
the computed values remain the same as if the unscaled coordinates
were used with higher precision math.

This seems to prevent GM_crbug_10141204 from being misclassified as
a fullscreen clear when its large rect geometry just intersects
the device.

Bug: skia:9779, chromium:10141204
Change-Id: Ia97c2c4e288907ddbb7058d3e7ed97112143b7dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265977
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-01-23 16:04:07 +00:00
Greg Daniel
b58a3c7331 Remove fConfig from GrSurfaceDesc.
Bug: skia:6718
Change-Id: I586e10c828d5d0a0b3e46d8efd7400991b98d5c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265978
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-23 15:53:36 +00:00
Brian Salomon
899985245a Fix issue introduced in 33c0f260d2
Wrong edge used for left rect in y-pass.

Change-Id: I3040c5b45fcaaddb321aff3a8bc341b4baa67fd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266198
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-23 15:37:06 +00:00
Michael Ludwig
40a1353126 Increase precision of some quad AA calculations
This stops using the low precision rsqrt and instead does a divide + sqrt.
It also separates the single kTolerance value used in GrQuadUtils' math
into a fairly fuzzy tolerance for edges/distances being close to zero
(e.g. a degenerate quad), and a more precise tolerance for linear systems
solutions.

The smaller tolerance value used for denominators in these solutions prevents
the solved-for coordinates from being mis-classified as "bad". The bad coord
resolution works on the assumption that its correcting points that are
co-located, but if the input coords were sufficiently large the linear
equations would have small denominators that were less than the fuzzy tolerance
and then the geometry would be improperly collapsed to a line.

For the selected zoom level of GM_crbug_10141204, this change is sufficient
to prevent the draw from being discarded. However, when animating the zoom
level, the input shape is sometimes still considered a fullscreen clear when
it shouldn't be. A follow up change will improve precision in CropToRect()

Bug: skia:9779, chromium:10141204
Change-Id: Id1518a908c03e7813868c4eff014d18388f8f62e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265976
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-01-23 15:33:17 +00:00
Herb Derby
73c75877bd Reland "Specialize SkRectanzier to SkRectanizerSkyline"
This is a reland of 77e1f84a84

Original change's description:
> Specialize SkRectanzier to SkRectanizerSkyline
> 
> It looks like the pow2 rectanizer has never been used. Remove
> the unneeded abstraction for rectanizer everywhere.
> 
> Change-Id: Iba33f1c6faf37201d03928ce8409751c212480a0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265983
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

Change-Id: I09729ba2b0e4b8b1a229fef4b95e65195b33fdc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266180
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-23 15:28:26 +00:00
Mike Reed
05b729709c remove obsolete flag SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS
Change-Id: I7f8dabe249a29ffa59e3e6224292895831be13d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266196
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-23 15:12:46 +00:00
Mike Reed
e4ddb8a7cd Revert "Specialize SkRectanzier to SkRectanizerSkyline"
This reverts commit 77e1f84a84.

Reason for revert: breaking google3 roll?

Original change's description:
> Specialize SkRectanzier to SkRectanizerSkyline
> 
> It looks like the pow2 rectanizer has never been used. Remove
> the unneeded abstraction for rectanizer everywhere.
> 
> Change-Id: Iba33f1c6faf37201d03928ce8409751c212480a0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265983
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

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

Change-Id: I2573534f3ea95c98d089f9c19b027564e77015db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266116
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-23 10:13:46 +00:00
Herb Derby
77e1f84a84 Specialize SkRectanzier to SkRectanizerSkyline
It looks like the pow2 rectanizer has never been used. Remove
the unneeded abstraction for rectanizer everywhere.

Change-Id: Iba33f1c6faf37201d03928ce8409751c212480a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265983
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-01-23 02:28:32 +00:00
Greg Daniel
ce3ddaa50f Pass readSwizzle into more proxy creation to not use config.
This is similar to the earlier change to createProxy but needs to be done
for all the lazy ones as well.

Bug: skia:6718
Change-Id: I3f5721541929e2e3fbfa746b5a2c4221b1af5b49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265960
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-23 02:21:02 +00:00
Greg Daniel
d51fa2f1e3 Remove GrPixelConfig from GrSurface and GrSurfaceProxy.
This also requires us to compute a scratch key from backend format instead of config.

Bug: skia:6718
Change-Id: I6bf4c5ba8188e354ddc5307ebf2ca10080df27cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265768
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-23 01:14:32 +00:00
Robert Phillips
3a83392c9a Add missing 'GrProtected' parameter to createCompressedTexture call chain
This makes creation of a compressed textures better parallel creation of uncompressed textures

This CL is pulled out of the parameter reordering CL - which has become too large.

Change-Id: Iabdaced780af206c2398e55986d3e7698a083342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265582
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-22 23:28:32 +00:00
Michael Ludwig
52c68c4111 Account for negative w in GrQuad::bounds
Also avoids loading coordinates into SIMD for the simple 2D case. This
moved the 2d bounds benchmark from 3.2us to 2.2us on my Windows machine,
but there was no movement on my Linux workstation (stayed ~2.2us on it).

This will regress the 3d bounds benchmark because there is a fair bit
more work that happens when any w < 0 (about 1/10 of the executions in
the benchmark). While the math for w > 0 stays the same as the old
code in projectedBounds(), that case still has the overhead of checking.
The regression is necessary since the prior "fast" 3d code was incorrect.

This does not fix the panorama case described in 224618, because that test
still uses anti-aliasing. However, with this change applied and forcing
non-AA, it draws correct albeit not smoothed. Further work will be needed
to safely handle AA inset/outsetting when the coordinates have w < 0.

Bug: skia:9779, chromium:224618
Change-Id: I3b7b052b448850ed098b6c819d3acb578437d2b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265767
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-01-22 23:14:52 +00:00
Alan Screen
9ae6732c1f Update font descriptor selection workaround
Existing code in create_descriptor() has hard-coded removal of certain
font traits because of issues in recent operating system versions. [1]

With the arrival of a newer version of macOS there is yet another quirk
to be dealt with. [2]

Modify create_descriptor() to avoid problematic traits based on the
version of CoreText in use.

This is a temporary workaround until typefaces can be serialized instead
of relying upon identical selection in different processes.

[1] https://skia-review.googlesource.com/c/skia/+/158443/
[2] https://crbug.com/1018581

Bug: chromium:1018581
Change-Id: I4c4c675e77f15a092f4b738c932edfb0876efa27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260346
Commit-Queue: Alan Screen <awscreen@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2020-01-22 22:36:03 +00:00
Ben Wagner
470e0ac14a Revert "Revert "Revert "Complete rewrite of the SkSL interpreter"""
This reverts commit 7deb1c26ba.

Revert "maybe fixed?"

This reverts commit 7ad3f229c7.

Revert "removed extraneous change"

This reverts commit 682f299aa8.

Revert "test change"

This reverts commit 5f40986cef.

Revert "derp"

This reverts commit 4f830b8df3.

Revert "let's see what happens"

This reverts commit d5290563f0.

Change-Id: Ib3c13c2a6ade9fc42382509d036e212c7fe50cc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265979
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2020-01-22 21:59:48 +00:00
Ethan Nicholas
d5290563f0 let's see what happens 2020-01-22 16:45:31 -05:00
Ethan Nicholas
4f830b8df3 derp 2020-01-22 16:45:31 -05:00
Ethan Nicholas
5f40986cef test change 2020-01-22 16:45:31 -05:00
Ethan Nicholas
682f299aa8 removed extraneous change 2020-01-22 16:44:31 -05:00
Ethan Nicholas
7ad3f229c7 maybe fixed? 2020-01-22 16:44:31 -05:00
Ethan Nicholas
7deb1c26ba Revert "Revert "Complete rewrite of the SkSL interpreter""
This reverts commit 99c54f0290.
2020-01-22 16:44:31 -05:00
Mike Reed
b26b4e7340 Revert "Revert "use SkM44 internally""
This reverts commit f79aacba2b.

Fix: had transposed when converting from colormatrix to m44

Change-Id: I6bc81d0c50bb1bf8d771e4dfa0c25c39de265b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265765
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-22 20:19:16 +00:00
Brian Salomon
988f109b94 Fix usage enum with GL_NV_pixel_buffer_object.
This extensions adds PBOs but not new enum values for <usage>. Only the
ES2 enum values of STREAM_DRAW, STATIC_DRAW, and DYNAMIC_DRAW are valid.

Also change TransferBufferType to enum class.

Bug: skia:1040643
Change-Id: Id36808267a86548a25ac6c92f9b753c11764742e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265577
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-22 20:00:57 +00:00
Greg Daniel
7c165a4b8c Reland "Reland "Pass in a SkColorType into SkImage_Gpu ctor.""
This reverts commit 9ed88b3101.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "Reland "Pass in a SkColorType into SkImage_Gpu ctor.""
> 
> This reverts commit 938106dccc.
> 
> Reason for revert: Most likely cause of Chrome roll failure:
> https://chromium-review.googlesource.com/c/chromium/src/+/2013502
> 
> Original change's description:
> > Reland "Pass in a SkColorType into SkImage_Gpu ctor."
> > 
> > This reverts commit 42032cb88f.
> > 
> > Reason for revert: Relanding now that pre CLS that fix initial issue landed
> > 
> > Original change's description:
> > > Revert "Pass in a SkColorType into SkImage_Gpu ctor."
> > > 
> > > This reverts commit 1d17543133.
> > > 
> > > Reason for revert: android bots
> > > 
> > > Original change's description:
> > > > Pass in a SkColorType into SkImage_Gpu ctor.
> > > > 
> > > > This allows us to get rid of using the GrPixelConfig on proxy to create
> > > > the SkColorType
> > > > 
> > > > Bug: skia:6718
> > > > Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> > > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > 
> > > TBR=egdaniel@google.com,robertphillips@google.com
> > > 
> > > Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Bug: skia:6718
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
> > > Reviewed-by: Mike Klein <mtklein@google.com>
> > > Commit-Queue: Mike Klein <mtklein@google.com>
> > 
> > TBR=egdaniel@google.com,mtklein@google.com,robertphillips@google.com
> > 
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> > 
> > Bug: skia:6718
> > Change-Id: I8088b4e96d1f2c73be03d150fb8f8280a21db5de
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265496
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,robertphillips@google.com
> 
> Change-Id: Idded694199b5c090a727e9b84251ba4700716c1f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6718
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265603
> Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
> Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>

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

Bug: skia:6718
Change-Id: Iaed2c5de04bfedcc85f75fb581f1c1fd2775bcde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265762
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-22 18:41:06 +00:00
Mike Reed
f79aacba2b Revert "use SkM44 internally"
This reverts commit 295cdf8775.

Reason for revert: wacky gm colors, must have busted colormatrixfilter

Original change's description:
> 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>

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

Change-Id: I35fcd636f1b57001bb65684e78523b6a94cfebee
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265764
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-22 18:05:34 +00:00
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
Chris Dalton
f9aea7f7e5 Add a tessellation mode that triangulates the inner polygon separately
Wedges fanning out from the center work fine for relatively simple
paths, but for paths made up of thousands of verbs, a fan is an
inefficient triangulation to give the rasterizer. This CL adds a
tessellation mode that draws the inner polygon and standalone cubics
separately, and triangulates the inner polygon by recursive
subdivision.

This reduces the stencil time from 7.4ms -> 3.0ms on desk_ynevsvg.skp.

Change-Id: Ie56e760d98e6c69e9a97752fe851726f36a7f574
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265522
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-01-22 17:01:06 +00:00
Herb Derby
dbc9f64e11 Reduce error control flow in addGlyphToAtlas
Change-Id: I56cc4b53400ca266f0d25caac1c69db95d92e7c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265581
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-22 16:58:46 +00:00
Leon Scroggins III
3eedc971f5 Make SkImageInfo::validRowBytes consider alignment
SkSurface will already reject a rowBytes that does not align on a pixel
boundary. Push that check into SkImageInfo. This will make SkBitmap,
SkPixmap, SkMallocPixelRef, and SkImage_Raster, which already call
validRowBytes, make the same check. If an SkSurface cannot use a
non-pixel-aligned rowBytes, then an SkCanvas wrapping an SkBitmap should
not either.

Update MallocPixelRefTest to use a rowBytes that is still valid.

Change-Id: I848d94dbeab8b58b92877104dd67ea23a9d19ca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265599
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-01-22 16:40:34 +00:00
Brian Salomon
33c0f260d2 Rework spefication of src/dst rects/translates throughout SkGpuBlurUtils.
Add comments, document some shortcomings in convolve_gaussian.

Prefer fillRectToRect over fillRectWithLocalMatrix.

Towards a more consistent param order for helper functions.

Remove an out param from decimate().

Change-Id: If3ca5ac9327c0495c98d41862709187d728790c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265376
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-22 16:28:35 +00:00
Brian Osman
6f5e94089e Clamp GrSkSLFP output to valid premul
Added this as an option to GrSaturateProcessor (also renamed it to
be more generic and end with FragmentProcessor).

Added a tweak to the unit test to check the new behavior.
(Raster was already doing the clamp).

Change-Id: Ic49fa5cd72b6c63430fb773baf8121546bf2b80d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265580
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-22 16:10:04 +00:00
Brian Salomon
87c314210a Add functions for GL_NV_fence to GrGLInterface.
Also add macro for ALL_COMPLETED

We plan to use this with ANGLE ES2 contexts.

Change-Id: I6c967fa9b9aefc41c31cd806aece8533f846f940
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265756
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-22 16:02:45 +00:00
Robert Phillips
3dfe7caf25 Revert "Add compressed backend textures to Metal"
This reverts commit b19c78ebad.

Reason for revert: iOS failures

Original change's description:
> Add compressed backend textures to Metal
> 
> Bug: skia:9680
> Change-Id: I7a3759d60549fd5f9051f57df0f4918c307ea3c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265402
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: If0d3ddf061b693084e15438fe3c0ddd58a6fec88
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9680
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265759
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-22 15:54:44 +00:00
Mike Klein
1feceb3b97 split SkBBoxHierarchy into public/base types
This just does the boring work, keeping the
old type as an empty, now public, base type,
with all the existing methods on _Base.

Bug: skia:9796
Change-Id: I96d93d25955430c0586deca4bb562913d1d7815a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265447
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2020-01-22 15:33:55 +00:00
Robert Phillips
b19c78ebad Add compressed backend textures to Metal
Bug: skia:9680
Change-Id: I7a3759d60549fd5f9051f57df0f4918c307ea3c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265402
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-22 15:01:54 +00:00
Brian Osman
808f021b51 Improve error handling in SkSL ByteCode
- Allow for $floatLiteral and $intLiteral when determining type
  categories. These could slip into the IR, leading to asserts.
- We weren't propagating the source text in specialize(), so errors in
  the ByteCodeGenerator would actually assert about a missing fSource.
  It's held by unique_ptr on Program, so we wastefully clone the
  string, but we don't have that many specializations yet, so not too
  bad?

Change-Id: I9c79acfb084e6dc8628625dea039c085ec46dba7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265598
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-21 23:07:12 +00:00
Brian Osman
ea7711d4a8 Tweak pointlight3d sample to work in Raster backend
- Once we add all the missing intrinsics, the locally defined ones
  can go away.
- Having the default interpreter vector width match the raster pipeline
  is a huge perf win.

Change-Id: I482e409e57791b78a0e6fb15929ae77eb0e76bf3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265600
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-21 22:47:12 +00:00
Ben Wagner aka dogben
9ed88b3101 Revert "Reland "Pass in a SkColorType into SkImage_Gpu ctor.""
This reverts commit 938106dccc.

Reason for revert: Most likely cause of Chrome roll failure:
https://chromium-review.googlesource.com/c/chromium/src/+/2013502

Original change's description:
> Reland "Pass in a SkColorType into SkImage_Gpu ctor."
> 
> This reverts commit 42032cb88f.
> 
> Reason for revert: Relanding now that pre CLS that fix initial issue landed
> 
> Original change's description:
> > Revert "Pass in a SkColorType into SkImage_Gpu ctor."
> > 
> > This reverts commit 1d17543133.
> > 
> > Reason for revert: android bots
> > 
> > Original change's description:
> > > Pass in a SkColorType into SkImage_Gpu ctor.
> > > 
> > > This allows us to get rid of using the GrPixelConfig on proxy to create
> > > the SkColorType
> > > 
> > > Bug: skia:6718
> > > Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > 
> > TBR=egdaniel@google.com,robertphillips@google.com
> > 
> > Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: skia:6718
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
> > Reviewed-by: Mike Klein <mtklein@google.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
> 
> TBR=egdaniel@google.com,mtklein@google.com,robertphillips@google.com
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: skia:6718
> Change-Id: I8088b4e96d1f2c73be03d150fb8f8280a21db5de
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265496
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: Idded694199b5c090a727e9b84251ba4700716c1f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265603
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
2020-01-21 22:24:22 +00:00
Mike Reed
38380dfe85 remove the last vestiges of SkMScalar
Change-Id: I2a91c73dd6c372a450b5f42dbe184c368e260a45
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265597
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-21 21:44:32 +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
Greg Daniel
47c20e81bc Pass swizzle into createProxy instead of inferring from GrPixelConfig.
This whole change is basically work that will all get reverted shortly
when GrSurfaceProxy no longer stores swizzle. But for now this helps
get rid of a use of pixel config.

Bug: skia:6718
Change-Id: If911360a8a9d2c52a58b5795386484634885b3f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265579
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-21 20:58:32 +00:00
Robert Phillips
4277f01736 mv BackendTextureData to end of parameter list
This is split out the parameter reordering CL - which has become too large

Change-Id: I2574985bff3cc6e9825a45a92ac531f00c33e28d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265578
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-21 20:11:13 +00:00
Greg Daniel
938106dccc Reland "Pass in a SkColorType into SkImage_Gpu ctor."
This reverts commit 42032cb88f.

Reason for revert: Relanding now that pre CLS that fix initial issue landed

Original change's description:
> Revert "Pass in a SkColorType into SkImage_Gpu ctor."
> 
> This reverts commit 1d17543133.
> 
> Reason for revert: android bots
> 
> Original change's description:
> > Pass in a SkColorType into SkImage_Gpu ctor.
> > 
> > This allows us to get rid of using the GrPixelConfig on proxy to create
> > the SkColorType
> > 
> > Bug: skia:6718
> > Change-Id: I1758b79152fa1e8a1796e55d19f5e8ca0b0e8b7b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264396
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> 
> TBR=egdaniel@google.com,robertphillips@google.com
> 
> Change-Id: I449e6b0750d611346791beb1dd1346106ad01741
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6718
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264469
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

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

Bug: skia:6718
Change-Id: I8088b4e96d1f2c73be03d150fb8f8280a21db5de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265496
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-21 19:21:00 +00:00
Mike Klein
196e9fbbf0 let picture record take a bbh directly
I'm not sure I see a compelling reason for BBH factory objects
to exist, as opposed to say, factory functions.  I don't see any
major harm in letting people hold onto BBH objects themselves.

This allows the caller to create and hang onto the BBH themselves,
allowing use cases like the slight extension I've made to the unit
test PictureNegativeSpace as a demo.  Not super useful yet, as
SkBBoxHierarchy is not a public type...

And add test that mini pictures fill the bbh, which had never been
an interesting question until now we let the user hold onto the BBH.

Bug: skia:9796
Change-Id: I14737f25b31a457a8716669183af0c3bbf01859b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265445
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-21 18:59:11 +00:00
Mike Klein
7a7ee94919 modernize some picture internal types
More sk_sp, unique_ptr, less ownership convention.
A little bit of warmup for the work in the bug.

Bug: skia:9796
Change-Id: If6ce37883e4175617d377e74c8cc44353ea47e16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265443
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-21 18:58:00 +00:00
Robert Phillips
b8757359e0 Add GrTexturable type
This is split out of the parameter reordering CL (which has gotten too big)

Change-Id: If78a63474af8c5927bcb4efa96514414e0b36e5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265521
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-21 18:35:50 +00:00
Greg Daniel
82c6b10b76 Better handle colorTypes in GrTexutreProducer.
This change does a bunch of stuff that all sadly needs to land together.

First this moves the fallback for bitmap upload from proxyprovider to
GrBitmapTextureMaker. This is mostly a code organization cleanup but also
allows us to manager all colorType changes in the GrTextureProducers
directly.

Next this change hides colorType and deletes colorInfo getters from
public. Looking at the colorType of the producer doesn't really make
sense (outside the producer) since we have multiple fallbacks that
could happen in terms of format for the produced textures.

Next this makes sure that after the ctor is called, the internal
colorType stored will always be the used colorType by returned textures.
The only caveat to this is if a texture needs a copy for repeat mode
and we end up needing to render to fallback configs. Modulo repeat issue
the only other thing to change colorType is uploading a CPU bitmap if
we fallback to 8888, but this can be known in the ctor if this will
happen.

Finally, the only users of GrTextureProducer that really need to know
the correct colorType to use with the returned texture are those that
are then creating an Image. However, non of these cases even need to
pass in sampling params so we don't hit the need for repeat copies
and thus colorType changes. So now the refTextureProxy call (the one
without params) returns a pair of the proxy and colorType. The producer
just returns its colorType cause nothing could have changed that.

Bug: skia:6718
Change-Id: Ic5b5810606440ff943910933a3880d62875c9c16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264836
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-21 18:34:10 +00:00
Herb Derby
ee5f142d4f Simplify 1 pixel padding calculation
Change-Id: I780182ef9d39a19e1b9795b615733091d22f8f63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265519
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-21 18:10:49 +00:00
Mike Reed
d468d21333 use safe cast when converting double to float
Change-Id: I8904389baad54b3df3e3aeabc8739e23487ec024
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265517
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 17:24:29 +00:00
Mike Reed
cedab52222 remove debugging dump
Change-Id: Idb6acbd80f11fa86c4b41487e515bf293b992adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265406
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 16:08:09 +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
Ben Wagner
d5eebba99e Fix 'trak' and system variable fonts on macOS.
The 'trak' suppression was only applied if the 'opsz' was specified.
Change the 'trak' suppression to always apply.

Incidentally, this fixes issues with system variable fonts only working
at named instances on macOS 10.12 through 10.14. Versions 10.11 and
earlier still have issues with system variable fonts only working at
named instances. In general on macOS different code is run depending on
whether the attributes parameter to CTFontCreateWithGraphicsFont is
nullptr or not. The code which runs when the parameter is nullptr has
the issue until 10.15, but the code run when the parameter is
non-nullptr does not appear to have the issue in 10.12 through 10.14.

Bug: skia:9747,skia:9544
Change-Id: Icbd3a909f544437fb9811fff9bf6a630f1e2b6dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264694
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-01-21 15:27:04 +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
Florin Malita
a6a794533b Cleanup remainig SkMSCalar literals
(post https://skia-review.googlesource.com/c/skia/+/265298)

Change-Id: I7171d737b4501c9ab0c8b925ceddd689dd2a5fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265398
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-21 14:41:09 +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
Brian Salomon
71b8b765a2 Remove proxy offset param to SkGpuBlurUtils::GaussianBlur.
Do offsetting to rects in SkBlurImageFilter. All others were already
passing {0,0}.

Change-Id: I834eab11722c528e157cf071e433c8d014c6a3da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265297
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-21 02:24:38 +00:00