Commit Graph

7784 Commits

Author SHA1 Message Date
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
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 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
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
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
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
Leon Scroggins III
42a604f431 Allow decoding without color conversion - part 2
Bug: b/135133301

Follow-on to 196f319b.

- Add SkCodec::getICCProfile to match the SkAndroidCodec version.
- Update comments on getPixels() regarding how the SkColorSpace on the
SkImageInfo is treated.
- Add two new images that have ICC profiles that do not map to an
SkColorSpace. Add a test to verify that they have the un-transformed
color we expect.
- Stop uploading ColorCodecSrc images decoded to a null SkColorSpace to
Gold. Though they may be correct, they do not match other images they're
compared against. The new test above verifies that we do not do color
conversion with a null SkColorSpace.

Change-Id: I08635e4262f16500fab32ef97511d305c2c06483
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269236
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-02-07 19:24:33 +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
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
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
Julia Lavrova
c0360582d2 Cache should work with INF values
Change-Id: I1ae8d95bb85d28fdce9e0cf270583f0224e4dfed
Bug: skia:9874
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268938
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-06 19:44:43 +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
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
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
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
Julia Lavrova
d3a32c5425 RTL fixes + few small bugs
1. Removed unnecessary iterators (use SkShaper iterators instead)
2. More careful hash function and comparison (ParagraphStyle)
3. computeEmptyMetrics should go after resolveStrut
4. longestLine for line with spaces only should not be 0
5. LTR/RTL * left/right align * latin/arabic * leading/trailing spaces positioning
6. Height for MaxHeight rect (to follow Gary's change)

Change-Id: I3507ff9fb93148e5ef882a2f514078fcea9cfef3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268301
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-05 14:40:48 +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
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
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
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
Mike Klein
bc1ce2c0ca test premul/unpremul are no-ops when a==1.0f
Constant propagation means we can always notionally
unpremul and premul at the right points, and if alpha
was already opaque, they'll just drop away.

This has been true, but it's nice to put a test on it.

Change-Id: Iacd2002d9e1a10b73e800a452f377001d5ba3777
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268336
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-03 18:51:05 +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
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
Julia Lavrova
db543f60a8 Memory leak in cache
Change-Id: I3edebd64a28584412e0dfac6849ee8d608243262
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267441
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-01-29 17:39:37 +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
Robert Phillips
99044e1a6a Update wacky_yuv_formats GM to demonstrate YUV resizing on the GPU
Change-Id: Idd2b75ca84c1d7984aa983820b4325fbbda2b753
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266203
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-29 14:16:36 +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
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
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
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
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
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
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
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
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
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
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
Julia Lavrova
c88a3bc3f5 Bidi segmentation BEFORE anything else
Change-Id: I94637e663bc1ffc7d9d6e1c0fb0b28509af45f60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266200
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-01-23 20:38:26 +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
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
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
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
26df65c8fb row/col methods
Change-Id: I5b306b15070899d0091b974b09869ff50dcd9c7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265980
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-23 15:22:26 +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
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
5f40986cef test change 2020-01-22 16:45: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
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
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 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
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 Reed
9262555222 remove fun operator overloads
Change-Id: I6ae2d5d1cbe2fc5d9d782aa96900acd5703080e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265757
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-22 15:42: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
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
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
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
Mike Reed
8c2ccc07ba use real normal-map texture
transpose(inverse(localToWorld)) does not seem to be working, so skipping
it for now.

Change-Id: I7dd5a01020f590dec02b36f54752092643acf3d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 15:29:00 +00:00
Ethan Nicholas
2cde3a1320 Complete rewrite of the SkSL interpreter
Change-Id: Idf4037b04c22f8ace5c1ef16c7a28d8c3df92e91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250817
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-21 14:49:59 +00:00
Mike Reed
215c34be2b SkMScalar is obsolete -- use SkScalar
Bug: skia:
Change-Id: I6a29039aa4dcc25cc804db4bdc685b8dc119f216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265298
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 12:47:48 +00:00
Robert Phillips
07f0e41dde Test readPixels on compressed textures
Bug: skia:9680
Change-Id: Ic31ec99b349a1b6585d06f36186b7e9d1d46048c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265096
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-17 20:49:03 +00:00
Greg Daniel
3155f7fc0d Pass in a GrColorType into our Copy call.
This allows us to remove looking at the config to infer a color type when
setting up a Surface/RenderTargetContext for the copy.

Bug: skia:6718
Change-Id: I75b63480a84558c96b5eeb248cc6165f96b2a243
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264563
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-16 22:55:32 +00:00
Mike Reed
d4d3b33624 Make converting from 4x4 to 3x3 explicit
Change-Id: I4d190d6831cb517d5e9f22b3f872013367bddc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264856
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-16 22:15:30 +00:00
Robert Phillips
b0855273ab Add SkImage::CompressionType::kBC1_RGBA8_UNORM support
This is mainly so we can test the compression code on macOS.

Bug: skia:9680
Change-Id: Ie0a2eacfe9100ee4ce4cc94c878d3032d6985832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264480
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-16 21:45:33 +00:00
Mike Klein
b147aceed7 DCI-P3 -> Display P3 in Skia
This keeps an alias so code keeps building.

Bug: skia:9792
Change-Id: If8575468d929d2ca28bc2f9e82de27291fb19aa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264691
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-16 21:24:16 +00:00
Mike Reed
c4b8eefe56 move SkV3 into header
Change-Id: I20284b415bbfe5ecc15fe9fe47dcbb65850d4368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 11:34:32 +00:00
Robert Phillips
e4720c6864 Expand SkImage::MakeFromCompressed to support mipMapping
Bug: skia:9680
Change-Id: I41357439cdc087e4cc98d5d1659ae2ee19f49004
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264398
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-14 20:57:28 +00:00
Mike Klein
93d3fabcc3 improve scalar gather32
This loads 32 bits instead of gathering 256 in the tail part of loops.

To make it work, add a vmovd with SIB addressing.

I also remembered that the mysterious 0b100 is actually a signal that
the instruction uses SIB addressing, and is usually denoted by `rsp`.

(SIB addressing may be something we'd want to generalize over like we
did recently with YmmOrLabel, but I'll leave that for Future Me.)

Slight rewording where "scratch" is mentioned to keep it focused on
scratch GP registers, not "tmp" ymm registers.  Not a hugely important
distinction but helps when I'm grepping through code.

Change-Id: I39a6ab1a76ea0c103ae7d3ebc97a1b7d4b530e73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264376
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-01-14 18:24:56 +00:00
Mike Klein
b2b6a99dca impl gather32 for x86
Some TODOs left over to make the scalar
tail case better... as is it issues a
256-bit gather for each 32-bit load!

I added a trimmed down variant of the existing
SkVM_gathers unit test to test just gather32,
covering this new JIT code.

Change-Id: Iabd2e6a61f0213b6d02d222b9f7aec2be000b70b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264217
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-14 17:24:45 +00:00
Greg Daniel
3912a4b1da Update GrSurface/RenderTargetContexts to take and store GrSurfaceProxyViews.
Bug: skia:9556
Change-Id: Ie1aed1b16c237e9c9d1b582ac4ff02fdaaad238f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263205
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-14 15:31:07 +00:00
Mike Klein
c322f634a3 add movq
This does the equivalent of dst = *(src + off),
which we use to find our gather base pointer in gather32.

Change-Id: I09ca7bfd404d7dce6de454ef1ed4eee78ab29932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264216
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-01-14 03:02:35 +00:00
Mike Klein
beaa108018 add vgatherdps
A complicated instruction to say the least!

A "fun" wrinkle is that all the ymm registers must be unique!
(And the mask register is cleared by the instruction...)

Still kind of TODO is what that 0b100 r/m in the mod_rm() means.  Every
variant of the instruction I've assembled seems to have it set to 0b100
(e.g. 0x0c or 0x04) but I'd feel better if I knew what it meant.

Change-Id: Ia4ff5f8175bff545e2d10bb2d1b14f49073445a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264116
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-01-13 23:51:35 +00:00
Robert Phillips
c558f72165 Compressed texture API cleanup
Change-Id: I020bf6e79b5511adbd89931120feb76f359d83aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-01-13 21:11:21 +00:00
Brian Salomon
bfb72113a7 Reland "Remove GrPaint::addColorTextureProcessor"
Chrome layout test suppression has landed.

This reverts commit 67d0f3fd72.

Change-Id: I5b9963b306f29a41cf36e1802e7eebda010f186d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264016
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-13 16:46:42 +00:00
Greg Daniel
f6d60d32a7 On ARM disable blend when src-over has src with alpha of 1.
Change-Id: Ibb8ed86b8753718dfd12a24ad9497f79093eea40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263200
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-01-13 15:27:53 +00:00
Mike Reed
9403c3897f Revert "Reland "Revert "allow clients to opt into new didTranslate/didScale"""
This reverts commit f66bba6018.

Reason for revert: sheriff thinks it may be the bot, so landing

Original change's description:
> Reland "Revert "allow clients to opt into new didTranslate/didScale""
> 
> This reverts commit d7ce7ac8d1.
> 
> Reason for revert: breaks Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker
> 
> Original change's description:
> > Revert "Revert "allow clients to opt into new didTranslate/didScale""
> > 
> > This reverts commit 4a46758db8.
> > 
> > Add guard to Flutter
> > 
> > Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
> 
> TBR=reed@google.com
> 
> Change-Id: I3291c4dfe18d6e751e61f55ed9b22a01f0c8ad72
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263860
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3111a034291c2320e5ff33f8c2072354f836440f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263939
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-13 14:41:12 +00:00
Mike Reed
f66bba6018 Reland "Revert "allow clients to opt into new didTranslate/didScale""
This reverts commit d7ce7ac8d1.

Reason for revert: breaks Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker

Original change's description:
> Revert "Revert "allow clients to opt into new didTranslate/didScale""
> 
> This reverts commit 4a46758db8.
> 
> Add guard to Flutter
> 
> Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3291c4dfe18d6e751e61f55ed9b22a01f0c8ad72
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263860
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 20:06:08 +00:00
Mike Reed
d7ce7ac8d1 Revert "Revert "allow clients to opt into new didTranslate/didScale""
This reverts commit 4a46758db8.

Add guard to Flutter

Change-Id: Ief0e5cb36af13c8f00a36a617d0384622012d644
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263937
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 19:53:18 +00:00
Mike Reed
4a46758db8 Revert "allow clients to opt into new didTranslate/didScale"
This reverts commit cb6b9e3c35.

Reason for revert: flutter-roll, and possibly Debian10?

Original change's description:
> allow clients to opt into new didTranslate/didScale
> 
> Before
>     148.97  	canvas_matrix_4x4	8888
>     139.96  	canvas_matrix_3x3	8888
>     139.81  	canvas_matrix_2x3	8888
>     183.13  	canvas_matrix_scale	8888
>     153.72  	canvas_matrix_trans	8888
> 
> After
>     ...
>     114.68  	canvas_matrix_scale	8888
>     112.96  	canvas_matrix_trans	8888
> 
> Change-Id: I79d20ea6ab6aa9609143c7abf4acaa8ca08dd58f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263818
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I49f6c7af4917cf268fa2ed009677748b7d4a3bbc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-12 10:56:38 +00:00
Mike Reed
cb6b9e3c35 allow clients to opt into new didTranslate/didScale
Before
    148.97  	canvas_matrix_4x4	8888
    139.96  	canvas_matrix_3x3	8888
    139.81  	canvas_matrix_2x3	8888
    183.13  	canvas_matrix_scale	8888
    153.72  	canvas_matrix_trans	8888

After
    ...
    114.68  	canvas_matrix_scale	8888
    112.96  	canvas_matrix_trans	8888

Change-Id: I79d20ea6ab6aa9609143c7abf4acaa8ca08dd58f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263818
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-12 01:40:57 +00:00
Brian Salomon
fb28c6fb7f Enable transfer from texture to buffer on ANGLE.
This is necessary to support the async readback API on Windows Chrome.

Transfer from buffer to texture is still disabled as the unit test
still fails.

Bug: chromium:1040643

Change-Id: I0e16437c066fadfdd8dbbbcaf376c6901a538063
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263528
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-10 19:20:21 +00:00
Brian Osman
504032e575 SkRuntimeEffect: Fix 'in' variables in CPU backend
We were never calling specialize() to bake in the values of ins,
so do that. Add uniformSize() to get the size of just the uniform
values. (The interpreter asserts that the size of the uniforms
being passed in matches the expected size from the ByteCode,
so these need to match up).

Added a unit test that uses both 'in' and 'uniform'.

Change-Id: I595822171211d35a17d5977fa790de0d1bbd6c78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263519
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-10 15:46:22 +00:00
Mike Reed
a092028439 Revert "new virtuals for canvas ctm"
This reverts commit 2076b04d15.

Reason for revert: speculative: breaking google3 flutter scuba?

Original change's description:
> new virtuals for canvas ctm
> 
> 1. Feature: Clients need to override didConcat44() (new data)
> 2. Perf: Clients need to override didTranslate (and now didScale) so our
>          default impls can be empty.
> 
> Need SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS flag to stage this in
> clients (anyone who subclasses SkCanvas)
> 
> Before (with flag)
>     120.87  	canvas_matrix_4x4	8888
>     108.10 ?	canvas_matrix_3x3	8888
>     108.13 ?	canvas_matrix_2x3	8888
>     141.54  	canvas_matrix_scale	8888
>     128.04  	canvas_matrix_trans	8888
> 
> After (without the flag)
>     ...
>      90.79  	canvas_matrix_scale	8888
>      94.51  	canvas_matrix_trans	8888
> 
> bug: skia:9768
> 
> Change-Id: I6f500138dd6b2b24754dc065c650d0bd3c341540
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263349
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: I9c2e39ea0aa2b19d40eb6454c233258ab7f35829
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263564
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-10 14:26:41 +00:00
Mike Reed
2076b04d15 new virtuals for canvas ctm
1. Feature: Clients need to override didConcat44() (new data)
2. Perf: Clients need to override didTranslate (and now didScale) so our
         default impls can be empty.

Need SK_SUPPORT_LEGACY_CANVAS_MATRIX_VIRTUALS flag to stage this in
clients (anyone who subclasses SkCanvas)

Before (with flag)
    120.87  	canvas_matrix_4x4	8888
    108.10 ?	canvas_matrix_3x3	8888
    108.13 ?	canvas_matrix_2x3	8888
    141.54  	canvas_matrix_scale	8888
    128.04  	canvas_matrix_trans	8888

After (without the flag)
    ...
     90.79  	canvas_matrix_scale	8888
     94.51  	canvas_matrix_trans	8888

bug: skia:9768

Change-Id: I6f500138dd6b2b24754dc065c650d0bd3c341540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263349
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-10 13:30:11 +00:00
Jim Van Verth
67d0f3fd72 Revert "Remove GrPaint::addColorTextureProcessor"
This reverts commit a92320d4e6.

Reason for revert: Blocking Chrome roll.

Original change's description:
> Remove GrPaint::addColorTextureProcessor
> 
> Just make the effect and then add it.
> 
> Makes it easier to make changes to GrTextureEffect::Make going forward.
> 
> Also add default param for matrix (identity).
> 
> Change-Id: I52073f11a0a78b971bb512627198ee1724bfdac7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263518
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I2618844f5a8f5f1873dd79142caafd8939384e9e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263560
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-09 21:33:24 +00:00
Brian Salomon
a92320d4e6 Remove GrPaint::addColorTextureProcessor
Just make the effect and then add it.

Makes it easier to make changes to GrTextureEffect::Make going forward.

Also add default param for matrix (identity).

Change-Id: I52073f11a0a78b971bb512627198ee1724bfdac7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263518
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-09 19:28:24 +00:00
Brian Salomon
ccb6142956 Allow implicit conversion from GrSamplerState::Filter to GrSamplerState
constexprify GrSamplerState

pass/return GrSamplerState by value (it's 3 bytes).

Remove unused function from GrTexturePriv

Change-Id: Iffecd941500acf5653f01cc88b42ff1d45678b54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263346
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-09 17:29:54 +00:00
Herb Derby
eca1091a52 Add first, last and subspan to SkEnumerate
Change-Id: I0cfd2f710acdb8070325b950a4502c99a668c8b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262943
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-01-09 15:04:44 +00:00
Mike Klein
f22faaf254 add vroundps, impl Op::floor on x86
Change-Id: Iad94adda2da74fefb5657d883120f85ad362327e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263461
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-09 14:19:14 +00:00
Mike Klein
92ca3baba6 JIT today's new _imm ops
- Add YmmOrLabel struct to represent the concept that many
  x86 instructions can take a final argument as either a
  register or memory address, and that they all handle them
  the same way.
- Convert existing overloads like vmulps() to use YmmOrLabel.
- upgrade some other instructions to take YmmOrLabel
- use them to implement today's new _imm ops

This feels like a good spot for implicit constructors, no?

Change-Id: I435028acc3fbfcc16f634cfccc98fe38bbce9d19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263207
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-08 23:38:13 +00:00
Greg Daniel
ba0ff78359 Move the remainder of GrRenderTargetContext factories.
This mostly handles cases where we are wrapping a GrBackend* or an already
made proxy.

Change-Id: Ieb33eb51f7db84611ade0f8243b6d9023ce8e390
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262234
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-08 21:30:21 +00:00
Mike Klein
a6434a5ef5 refactor bit ops
- Remove extract... it's not going to have any special impl.
  I've left it on skvm::Builder as an inline compound method.
- Add no-op shift short circuits.
- Add immediate ops for bit_{and,or,xor,clear}.

This comes from me noticing that the masks for extract today are always
immediates, and then when I started converting it to be (I32, int shift,
int mask), I realized it might be even better to break it up into its
component pieces.  There's no backend that can do extract any better
than shift-then-mask, so might as well leave it that way so we can
dedup, reorder, and specialize those micro ops.

Will follow up soon to get this all JITing again,
and these can-we-JIT test changes will be reverted.

Change-Id: I0835bcd825e417104ccc7efc79e9a0f2f4897841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263217
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-08 21:20:54 +00:00
Brian Osman
f72deddb89 Expose the Input variable and Child name collections in SkRuntimeEffect
Add framework for unit tests that draw (CPU and GPU) with a runtime
shader, as well as couple example tests.

Change-Id: I43b3b39e86634ec55521a2689a4c55c21939dce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262809
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-08 19:23:13 +00:00
Greg Daniel
e20fcad156 Reland "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit a4f207eb67.

Reason for revert: Landing with fix

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

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

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

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

This reverts commit 268ed57d71.

Change-Id: I3c48a0aa17649351a246c1fbab5449f2d59aaf84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263023
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-08 16:13:51 +00:00
Brian Osman
268ed57d71 Revert "Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API."
This reverts commit 98bfcc7ff3.

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

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

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

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

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

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

Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-01-08 13:31:21 +00:00
Greg Daniel
1c16b43033 Move makeDeferredRenderTargetContext calls to factory on RTC.
Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-07 21:14:13 +00:00
Brian Salomon
b8f098d372 Reland "Rename GrSimpleTextureEffect->GrTextureEffect"
This reverts commit d7436a37ff.

Restores old file order in gpu.gni until Mac/Metal issue can be
debugged.

Change-Id: I6e2ee3bdc3b39270aeaaf28b9613e4ac49d38e1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262801
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-07 18:44:42 +00:00
Mike Reed
98bfcc7ff3 Extend SkCanvas matrix stack to be 4x4, but with (basically) the same public API.
Devices receive the 4x4, but by default they simply downsample it to SkMatrix.

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

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

Performance: running canvas_matrix bench

3x3 version:

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

4x4 version:

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

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

Before adding the specialized preConcats...

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

Change-Id: I68eac942919fa5418081e789f31710a1e2a752da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262056
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-07 18:23:04 +00:00
Brian Salomon
d7436a37ff Revert "Rename GrSimpleTextureEffect->GrTextureEffect"
This reverts commit 90673ec665.

Reason for revert: Causes metal bot failures

Original change's description:
> Rename GrSimpleTextureEffect->GrTextureEffect
>
> It will become less simple.
>
> Change-Id: I409d0faba386597ae05738273d5ff773501eb358
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262383
> Auto-Submit: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: Id25c9cde3c2048149409745f163e42c588de70c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262514
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-01-07 15:07:09 +00:00
Brian Salomon
90673ec665 Rename GrSimpleTextureEffect->GrTextureEffect
It will become less simple.

Change-Id: I409d0faba386597ae05738273d5ff773501eb358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262383
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-06 21:49:44 +00:00
Brian Osman
8783b78b38 Add a few more SkRuntimeEffect unit tests
Validating that only certain types are allowed as in or uniform.

Change-Id: I941da448bffec06158e67fbf653833846d9fe3db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262222
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-06 20:32:54 +00:00
Mike Klein
6dbd7ff34a first foray into SkVM image shaders
Basic support for clamp/clamp/nearest/RGBA-8888/premul images.

A couple little changes to make this work:
   - add pixel-center offset to shader (x,y)

   - change the signature of gather??() calls to work
     more naturally with how we let effects build uniforms.
     Instead of gathering directly from one of the program
     arguments, load the gather base pointer off another
     uniforms pointer, just like any other uniform.

   - remove the default argument to uniform??() so that
     they parallel the new gather??() calls more closely.
     There was only one place that was using the default
     and I think it's clearer as an explicit 0 offset.

   - centralize some more helpers onto skvm::Builder so
     we can use the in both SkVMBlitter and SkImageShader.

Some diffs:
   - very, very small color diffs probably due to slightly
     different math converting between byte and float or blending;
   - small sampling coordinate diffs where skvm + SkRP agree,
     and the legacy shaders disagree.  That's fine by me.

Change-Id: I72634e7fed4f13e6cb41b8067104760f392ea3bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262368
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-06 19:45:53 +00:00
Brian Salomon
e994380d00 Some GrTypes cleanup.
Remove some unused functions/macros.

Move two functions only used by GrBufferAllocPool there.

We only ever used GrSizeAlignUp with pow 2 alignments. Require that,
rename, move to GrTypesPriv.h (along with GrSizeDivRoundUp).

Change-Id: I1a7248952d1905f16f02de2028d65768b186acee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262061
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-03 19:49:07 +00:00
Ethan Nicholas
2a099dae1e SkSL description methods are now only present in debug mode
As they are a significant chunk of code, this reduces the size of the
release executable.

Change-Id: Ib764b3ec6244629e50941b0101a540e49d56c320
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261955
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-01-03 16:56:27 +00:00
Brian Osman
ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00
Brian Salomon
94724c6594 Fix GrColorMatrixFragmentProcessor handling of premul transparent black.
Use the original alpha in the unpremul color.

Bug: chromium:1024935
Change-Id: I6a721431781f0ef42a3f162d39f8bbac924a2c30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261680
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-02 14:55:06 +00:00
Brian Osman
82d49704ce More SkRuntimeEffect tests
- 'in' variables can't be arrays (applies to all SkSL)
- 'in' and 'uniform' variables are restricted to a fixed
  list of types.

Change-Id: I957ce1ad33aaf6b5970ca7204c568bb533bc86d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261436
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-30 19:26:06 +00:00
Brian Salomon
0a7ca7a2a3 Avoid div by zero in ProcessorTest to please UBSAN
Change-Id: I1e49ab46975bb8e5eff08bc5afe7ffed1c078309
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261550
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-27 18:06:24 +00:00
Brian Salomon
bc73eb4fcc Make ProcessorOptimizationTest for canTweakAlphaForCoverage more robust
Change-Id: Ic43bebee6a0036eff5b718cc505d85bf839cb8a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260898
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-27 15:34:44 +00:00
Brian Salomon
9c4ee9c79a Disable advanced blend equations on Imagination driver 1.10 and earlier
Causes shader compilation to fail in Programs test on Tecno Spark 3 Pro.

Hopefully this doesn't affect performance as this GPU has framebuffer
fetch support.

Also reduce the effect depth limit in ProgramsTest.

Change-Id: I1fa5b8a670b3a074808cdba09c2ac97492067d33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261192
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-20 22:17:09 +00:00
Robert Phillips
8f259a0329 Add BC1_RGB8_UNORM support
This is working in the GL and Vulkan back ends. MacOS only supports the RGBA8 variants.
For mobile devices, probably only nVidia GPUs will support this.

Bug: skia:9680
Change-Id: I9d886b72232a031603e93e46059a97a8aa288b3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261093
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 21:41:09 +00:00
Michael Ludwig
28b0c5d4b3 Pass Arenas* to GrOpsTask and GrOps instead of multiple pointers to each pool type
Change-Id: I47ac0b069334cb9702473b1bb923f585712f38ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261087
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-20 21:02:49 +00:00
Chris Dalton
34280e29cf Shorten argument lists in GrMesh::SendToGpuImpl
Replaces several of the arguments with a single GrMesh object. The
call signatures were a bit unruly, and would have become more so with
extra required arguments for tessellation.

Change-Id: I4834b03d9c107dd233a91019c0a3189030e52bef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260977
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-12-20 21:01:39 +00:00
Mike Reed
aebe4390af move clip-stencil function into GpuDevice
Will follow-up with a change that doesn't use SkRegions!

Note:

The previous code flow gathered a region for all devices (in the canvas method).
However, it only tried to draw into the top device. The new code just focuses on
the top device, which ought to give the same results.

Change-Id: Ic5ed47e7908d646700c09b10faa538415522c645
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261283
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-20 20:31:08 +00:00
Robert Phillips
9f744f7ece Change GrGpu::onCreateCompressedTexture signature
In the previous form there was some duplication between the backend format and the SkImage::CompressionType being passed around.

Bug: skia:9680
Change-Id: I04455b7a4289bec83d87be17b75b4e9d4d6ef2e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261184
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 15:37:26 +00:00
Robert Phillips
ca0f837c1e Prepare CompressedBackendAllocationTest for new compression formats
Bug: skia:9680
Change-Id: Ia11219dff9880b78903d8e4b73565cfed5ccf9de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261185
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-20 15:25:56 +00:00
Greg Daniel
bfa19c4e76 Add factories to GrSurfaceContext and clean up creation flow.
This CL updates all callers that ending up in GrDrawingManager::makeSurfaceContext
to use the new factory or directly call ctors.

A follow on change will get the rest of the calls which go to
GrDrawingManager::makeRenderTargetContext

Change-Id: I662da654a1ec8b8972c50fe9ce45a9185d4c3dc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260901
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-20 15:05:56 +00:00
Noah Lavine
334d0ba9d7 Optimize SkSL xor where one argument is constant
Change-Id: I9ea41625fd80433f7f6480fe539321d8df7b7930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258877
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-20 14:50:46 +00:00
Brian Salomon
3a09a3770b Ungenerate GrSimpleTextureEffect
There is no change to the code (yet).

Change-Id: I1997d7ac070691a3384441028503f6dc8565bbf8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261182
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-12-20 14:18:56 +00:00
Brian Osman
088913a63b Start adding unit tests of SkRuntimeEffect
- Change SkRuntimeEffect::Make so *it* can fail, and returns
  [Effect, ErrorText].
- Initial tests just test for expected failure conditions.
  Next steps are to add tests for effects that should work,
  and to validate results on CPU and GPU.

Change-Id: Ibac8c3046104577434034263e9e4a4b177e89129
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261095
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-20 14:15:06 +00:00
Robert Phillips
3e5e2f2c95 Add test for the GrContext::createCompressedBackendTexture API
Bug: skia:9680
Change-Id: Ib51613e6bacb36ff59b2e1e3c3cf13221d0382fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261083
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-19 16:48:09 +00:00
Mike Reed
2c38315710 hide/remove obsolete/tricky SkMatrix methods
Change-Id: Iee399b929e8ca1a7326a326a643539d05e333d81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260818
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-12-18 22:29:52 +00:00
Brian Salomon
766098de94 Make sure random unit test processors use an alpha type compatible with
texture data.

It'd probably be good to provide an opaque texture that has an alpha
channel and widen the range of color types that are present in the
future.

Change-Id: I5587a479f7e2f3991f8ae27a4cd44afc533324e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260696
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-18 19:40:11 +00:00
Robert Phillips
0d7e2f158e Change signature of several gpu backend methods
This makes:

onCreateBackendTexture better match onCreateCompressedBackendTexture to better reflect our mipMapping assumptions.

GrCompressedDataSize better match GrComputeTightCombinedBufferSize to allow the used of generated mipmap data.

createVkImageForBackendSurface and createMtlTextureForBackendSurface take a GrRenderable instead of a raw bool

Change-Id: Ifb7d60bc0e626dfbf1cea0d362bcb04093a71ba7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260780
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-18 18:27:15 +00:00
Brian Salomon
4dea72a987 Reland x3 "Remove most of GrConfig.h"
This change makes this safe for Chrome:
https://skia-review.googlesource.com/c/skia/+/260779

This reverts commit 3f1a98b779.

Change-Id: Ic6886ceabbf626040fc527ea10fe06cbe74a3854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260783
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-18 17:14:45 +00:00
Robert Phillips
ee94693c7a Fix a sprinkling of GPU issues
Change-Id: I0123fdc3b492f56f8bc9ff592ffe74f854be380b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260816
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-18 16:53:55 +00:00
Mike Reed
190b82d67c Add clipping for perspective triangles
more UI for halfplanes in SampleClip

bug: skia:9698
Change-Id: I9463fe9860fa482ef05fc2113114e61524c38fc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260500
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-17 23:24:18 +00:00
Greg Daniel
3f1a98b779 Reland "Revert "Remove most of GrConfig.h""
This reverts commit 5b9c7ba313.

Reason for revert: Looks to still be breaking chrome

Original change's description:
> Revert "Revert "Remove most of GrConfig.h""
> 
> This reverts commit b0047b57b7.
> 
> Change-Id: I0c6df9e9d5c3984987398d2b7f675005828ab3de
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260697
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com

Change-Id: Ia9860b39c562368f8a2f84283c52f55593333075
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260642
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-17 23:16:58 +00:00
Greg Daniel
14b57216e3 Rename GrCaps textureSwizzle to readSwizzle.
Change-Id: Ia5e2c4d3ca7346a1ad7559cd158ed632a70145bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260699
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-17 21:59:08 +00:00
Brian Salomon
5b9c7ba313 Revert "Revert "Remove most of GrConfig.h""
This reverts commit b0047b57b7.

Change-Id: I0c6df9e9d5c3984987398d2b7f675005828ab3de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260697
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 21:23:48 +00:00
Brian Salomon
682ba43ba3 Revert "Blend functions as SkSL built ins."
This reverts commit 3794db84e1.

Reason for revert: Still breaking Pixel3 processor optimization test

Original change's description:
> Blend functions as SkSL built ins.
> 
> GPU-only for right now.
> 
> Use in GrGLSLBlend::AppendMode.
> 
> Remove unused GrGLSLBlend::AppendRegionOp.
> 
> Change-Id: I23affe255a1adafa55f3a07ca6291dc84e18e213
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254678
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I0675c0fe00d6540202ca0676fd9b07f3007d0404
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260639
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 20:20:46 +00:00
Brian Salomon
3794db84e1 Blend functions as SkSL built ins.
GPU-only for right now.

Use in GrGLSLBlend::AppendMode.

Remove unused GrGLSLBlend::AppendRegionOp.

Change-Id: I23affe255a1adafa55f3a07ca6291dc84e18e213
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254678
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 19:56:47 +00:00
Greg Daniel
46e366ae21 Remove GrTextureContext.
This change mostly just removes GrTextureContext and switches users to
directly creating GrSurfaceContexts. Outside of updating types, the factory
functions for creating Gr*Contexts have not been updated in this but will
be done in a followup.

Change-Id: I55257568d4c096c5fb48c5e38bfa2c01b824e7b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260289
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-16 20:45:10 +00:00
Robert Phillips
48257d74cd Spruce up GrDataUtils in preparation for compressed backend texture support
This fixes a bug in the computation of a solid colored ETC1 block and adds support for mipmapped ETC1 data.

Bug: skia:9680
Change-Id: I50be60d652bd974e0f11966d72228bea5441696c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259977
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-16 20:14:03 +00:00
Herb Derby
26300d64ca Make allocation of SkDescriptor do initialization
The SkDescriptor fuzzer did not call init. This caused
mysterious failures.

Make SkDescriptor's constructor initialize its fields.
Remove init().

Change-Id: Icab79c53b2d2878fceecfec06c886b71613cea6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260287
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-12-16 19:55:42 +00:00
Robert Phillips
df6c734253 Add GrCaps::getConfigFromCompressedBackendFormat
When wrapping a backend texture we currently need to derive a GrPixelConfig from the backend format. The normal caps method (i.e., getConfigFromBackendFormat) is inappropriate for the compressed backend texture use case.

Bug: skia:9680
Change-Id: Ic4de7550c9a11f6e6207374c27d0ea23b8ab1575
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260044
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-16 19:19:11 +00:00
Robert Phillips
d6df7b55a5 Switch GrCaps::isFormatCompressed virtual to be 'compressionType'
Most call sites really only want the Boolean so I also added an isFormatCompressed helper.

Change-Id: I77f16033b69bc99329344201d2c85599d60cb757
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259168
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-16 18:00:00 +00:00
Mike Reed
cf0e3c63fd remove dead code around old SkPath enums
Change-Id: I8dc06da48e881d3a9c40b47c799afe27bdcce819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257689
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-14 01:58:10 +00:00
Ben Wagner
ab51c2ce08 Add more variation support on Mac.
With the recent transition to creating fonts from data as CTFonts and
dropping variation support from macOS 10.11 and earlier, it is now
possible to reliably make variation clones and get the axis information.

Change-Id: Ia9a0922ac94a29e1508d2e74d4ce973751044866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259421
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-12-13 18:16:13 +00:00
Michael Ludwig
d0840ecf58 Provide record time allocator to onCombineIfPossible()
Change-Id: I3acf5d5fdb29bfbd3407a8065b7567dff43503a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259427
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-13 14:13:43 +00:00
Herb Derby
2fc9fa6d08 Add filter to SkTHashTable and SkTHashMap
Filter takes a bool function where fales means remove the entry.

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

Change-Id: I9393aedc3b48031cd2ea5f0160b107915077099a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259419
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-12 20:33:40 +00:00
Mike Reed
bb59dfa9e3 perform perspective clip by default
- this adds new (default) parameter to control clipping when transforming
  rects and paths

Bug: skia:9698
Change-Id: I4cfb36b60bd6bbfcdac0226e374dbc27d5284952
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259431
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-12-12 20:19:59 +00:00
Michael Ludwig
cb10e4d323 Reland "Detach op memory pool from recording context"
This reverts commit ed58654e39.

Reason for revert: Fix field order in SkDeferredDisplayList to deconstruct
dependent types in the proper order.

Original change's description:
> Revert "Detach op memory pool from recording context"
>
> This reverts commit 6b95516728.
>
> Reason for revert: breaking some Win10 bots
>
> Original change's description:
> > Detach op memory pool from recording context
> >
> > This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
> > either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
> > is held somewhere else. The culmination of this is that DDLs explicitly
> > detach the memory pool from the recording context instead of the GrOpsTask
> > maintaining a strong ref that preserved the memory somewhat sneakily.
> >
> > Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
>
> Change-Id: I942ae1e07fdc63d9311f6ee482bd71beca090502
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259696
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

Change-Id: Ia82fa6e42fc8d75b8aa57e5172894e8dfc7e83d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259816
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-12-12 20:11:40 +00:00
Nathaniel Nifong
20b177a9bf Parse android layer annotations in debugger, play back layers
Bug: skia:9626
Change-Id: I3ae8fa83520690f9af534e9ab0b70834d7890fb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256100
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-12 16:32:44 +00:00
Derek Sollenberger
ed58654e39 Revert "Detach op memory pool from recording context"
This reverts commit 6b95516728.

Reason for revert: breaking some Win10 bots

Original change's description:
> Detach op memory pool from recording context
> 
> This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
> either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
> is held somewhere else. The culmination of this is that DDLs explicitly
> detach the memory pool from the recording context instead of the GrOpsTask
> maintaining a strong ref that preserved the memory somewhat sneakily.
> 
> Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: I942ae1e07fdc63d9311f6ee482bd71beca090502
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259696
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2019-12-12 16:07:33 +00:00
Robert Phillips
a27d625ca6 Add compression to Mock backend
Bring the Mock backend up to speed since we're expanding compression support.

Bug: skia:9680
Change-Id: I7fd7bed9351d3534d238feca0add54eced31cb4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 15:42:53 +00:00
Michael Ludwig
6b95516728 Detach op memory pool from recording context
This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
is held somewhere else. The culmination of this is that DDLs explicitly
detach the memory pool from the recording context instead of the GrOpsTask
maintaining a strong ref that preserved the memory somewhat sneakily.

Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-12 15:37:04 +00:00
Robert Phillips
bd99c0cf43 Reland "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
This reverts commit c5c024791b.

Reason for revert: Doh

Original change's description:
> Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
> 
> This reverts commit acf5929ae0.
> 
> Reason for revert: May be blocking Chrome roll
> Original change's description:
> > Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> > 
> > In future CLs I will update the Ops that create the TextureSamplers to pass
> > the GrSurfaceProxyView in.
> > 
> > Bug: skia:9556
> > Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=egdaniel@google.com,michaelludwig@google.com
> 
> Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9556
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: If2af5b5b323858e59c0c8db3b75477d74d78abfd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259434
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 13:27:21 +00:00
Robert Phillips
c5c024791b Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
This reverts commit acf5929ae0.

Reason for revert: May be blocking Chrome roll
Original change's description:
> Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> 
> In future CLs I will update the Ops that create the TextureSamplers to pass
> the GrSurfaceProxyView in.
> 
> Bug: skia:9556
> Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 13:24:51 +00:00
Greg Daniel
acf5929ae0 Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
In future CLs I will update the Ops that create the TextureSamplers to pass
the GrSurfaceProxyView in.

Bug: skia:9556
Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-11 23:17:15 +00:00
Leon Scroggins III
ae834f5781 SkWebpCodec: enable a loop count of 1
Commit 557fbb added animation support to SkWebpCodec, with the intent to
match Chromium. This was during the ~1.5 year period between
crbug.com/592735 and crbug.com/649264 when Chromium attempted to align
WebP with GIF, and play the animation once more than the stored number
(see crbug.com/592735). This was later reverted, because it means that a
WebP is unable to play an animation a single time (see
crbug.com/649264). This commit catches SkWebpCodec up with Chromium.

Add a legacy build flag (SK_LEGACY_WEBP_LOOP_COUNT) so we can stage the
change on Android.

Change-Id: If07e00d5e070847ceeb9ce27cd78a846974cdb4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259161
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2019-12-10 21:41:10 +00:00
Greg Daniel
9715b6c450 Add GrSurfaceProxyView to the various draw atlas ops.
Bug: skia:9556
Change-Id: I9eb825ab241fd0d0d4e63408af270a89e872d1c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258802
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-10 20:29:27 +00:00
Julia Lavrova
c5313e6b2a Font features
Change-Id: I8ae44d715fd2fa195c209c8ecb514db3e9644c31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259100
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-10 19:19:24 +00:00
Robert Phillips
ab2b722fdd Switch SkImage::CompressionType to be an enum class
Following CLs use CompressionType much more widely so let's switch it first.

Bug: skia:9680
Change-Id: Ie8847f24936e90dd85e0ad79cbe5542d68c87b12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258882
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-10 15:58:23 +00:00
Julia Lavrova
90bfd1c1c3 Small changes
Change-Id: Ic9c41a2dd11b4df8ab24037df0109e36536ec6c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257892
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-09 21:58:13 +00:00
Michael Ludwig
379e4961fd Merge consecutive entries that share proxy in bulk texture op
Previously, a batch draw that reused the same proxy consecutively
would create a ViewCountPair for each set entry, with its count == 1.
This turned into 1 draw per entry, so although there'd still be a single
pipeline, it didn't take advantage of merging those consecutive entries
into a larger draw to reduce draw count as well.

Initially, the thinking for the batch API was that it was for tilers
that used unique images for each tile or render pass. However, Chrome's
compositor is also responsible for rendering 9 patches as part of the UI.
These appear as 9 consecutive entries in the image set that all refer to
the same texture. With this CL the texture op will automatically merge
such occurrences into one ViewCountPair with a count of 9.

The bulkrect_1000_[grid|random]_sharedimage_batch leverages this case.
Before this CL its op would hold 1000 view count pairs that each drew
one quad. Now its op will hold 1 view count pair with a count of 1000.
On my linux workstation, the bulkrect_1000_grid_sharedimage_batch time
went from 377us to 206us. For reference, the _ref variant (which already
was a 1 view count pair with ct == 1000 due to merging of each op) has
a time of 497us. The difference between 497us and 206us represents the
overhead of calling through SkCanvas, op creation, quad optimization
analysis 1000x.

Interestingly the bulkrect_1000_random_sharedimage_batch benchmark did not
change on my workstation. My conjecture is that it is bottlenecked by
overdraw of the many overlapping rectangles.

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

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

Bug: skia:9455
Change-Id: I2d35dd223db824e84616f5df0f1dca34c1b6e412
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258003
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-06 16:33:15 +00:00
Brian Salomon
b0047b57b7 Revert "Remove most of GrConfig.h"
This reverts commit 80e334dad8.

Reason for revert: Chrome is including our private headers which means this breaks the Chrome roll:
https://chromium-review.googlesource.com/c/chromium/src/+/1953757

Original change's description:
> Remove most of GrConfig.h
> 
> Change-Id: I0f693bed0778151f93d07cd42c6b597566695ab1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257999
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ie206db9865a7f9a7e334eb248de8cff38dd31d15
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258356
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-05 19:52:48 +00:00
Brian Salomon
80e334dad8 Remove most of GrConfig.h
Change-Id: I0f693bed0778151f93d07cd42c6b597566695ab1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-05 18:37:33 +00:00
Greg Daniel
f0e04f0c31 Always destroy resources instead of simply "abandoning" them in Vulkan backend.
This also now requires that when using a vulkan GrContext, the backing VkDevice,
Queue, and Instance must be alive when the GrContext is first destroyed or
abandoned. Additionally any GrBackendTextures created from the GrContext must
be deleted before destroying or abandoning the GrContext.

Bug: skia:9603
Change-Id: Ibf194d2ffdcddd61e34214d7d59a2d9a33c880e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257921
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-05 14:45:45 +00:00
Mike Klein
7a671982cd work around GCC 8 mips release bug?
This feels kind of bad, but at least it's just a unit test?

Change-Id: I18740f846680218a00add40eb2398876c4fd19be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258023
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-12-04 21:14:13 +00:00
Greg Daniel
1a5d2d590a Remove unneeded abandon/release check in GrGpuResource message processing.
Change-Id: Ib11405be82e8ff7fd1edcaca2f19c44cce2abbd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257889
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-04 18:11:16 +00:00
Mike Klein
f78aa16af1 work around GCC false positive warning?
On 32-bit Release builds, GCC warns about this line in this test,

    ../../tests/SkRasterPipelineTest.cpp:225:40:
    error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’
    reading 8 bytes from a region of size 0 [-Werror=stringop-overflow=]
                                 !memcmp(&data[j][0], &buffer[j][0], sizeof(buffer[j])));
                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don't really see anything wrong, and I'm not really sure why it takes
offense here testing load_f16 and not in the very similar next chunk of
code testing load_af16.  Anyway, it's simple enough to write a loop.

Change-Id: Ie4f598328dd7109660b9ae97a5a27b386e833fd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257869
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-12-04 17:07:46 +00:00
Mike Klein
0f9df470ca remove pointless tests
Why are we testing how memset() and snprintf() work in
tests/StringTest.cpp.  Nevermind, I don't want to know...

Change-Id: Ic8608fea95635ee2fbb7da34a195de73d7a1444a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257415
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-12-02 21:27:39 +00:00
Julia Lavrova
3281b961c5 A new API call on Paragraph: a number of unresolved glyphs
Change-Id: Iba33c0df4aa9f2dc9b816c0954980ac8a971909b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257326
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-02 19:23:45 +00:00
Herb Derby
126d7a2636 Cleanup unit test output
Change-Id: Ic6467a505f50c9bd10c29099aa45e265a0434169
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257046
Auto-Submit: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-11-27 17:12:23 +00:00
Brian Salomon
c241b58965 Make fragment processor iterators work with range for loops.
When iterating over the coord transforms or texture samplers of a
FP also have access to the owning FP.

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

Change-Id: If7c829a67dce6600d7f49e12d6f49f685dcace3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256216
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-27 14:32:43 +00:00
Herb Derby
81777ac947 Make SkEnumerate make flatten tuples
The new c++17 only has a single level of destructuring;
append the index instead of nesting it.

Change-Id: I26bb1ca387d1de57233dbf7096dcf4bb7aaedecf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254637
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-27 05:16:23 +00:00
Robert Phillips
933484f6bb Stop using GrPixelConfig in Metal & Dawn's GrProgramDesc creation
In order to be able to create GrProgramDescs pre-flush we would like as little reliance on the GrRenderTarget as possible (also GrPixelConfig is going away).

Bug: skia:9455
Change-Id: Ie35c87758bb1ed97c99c6e9e130eaeb3355f4139
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256457
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-26 17:51:34 +00:00
Mike Reed
7d34dc7747 Revert "Revert "switch to new filltype for SkPath""
This reverts commit 3e7af41224.

Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-11-26 17:43:14 +00:00
Emircan Uysaler
17096c763c Revert "Disable VkProtectedContext_DDLMakeRenderTargetTest"
This reverts commit 6b4afb27fd.

Reason for revert: Fuchsia fix landed on https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=40061#c11.

Original change's description:
> Disable VkProtectedContext_DDLMakeRenderTargetTest
> 
> Bug: fuchsia:40061
> Change-Id: I9d6293298bc27b81f5b4202d56c930f976c86cfc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254336
> Commit-Queue: Emircan Uysaler <emircan@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

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

Bug: fuchsia:40061
Change-Id: I3db60ae3376cd8fe1719b482d2788eb9d48338f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256659
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-26 15:59:04 +00:00
Michael Ludwig
704d5408db Allow Tessellator to operate on provided GrQuads
To facilitate this, the GrQuadBuffer::Iter's local GrQuads that are
modified on each next() are now allowed to be operated on for the AA
inset/outsetting. Previously this required additional GrQuads on the
stack to hold the results, and additional guards for accessing localQuad()
when the entry didn't have actual coords.

With this change, a 2D op should have its device and src GrQuads' Ws
set to 1 once, and then they are completely ignored for all iteration
and tessellation, without any more redundant initialization. In all
likelihood we won't see the needle move on powerful platforms, but may
help lower end devices.

Change-Id: I457205786766403a760918e779d36ba056d69cde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256097
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-11-26 14:57:44 +00:00
Mike Reed
3e7af41224 Revert "switch to new filltype for SkPath"
This reverts commit 3a50981a83.

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

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

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

Change-Id: Iacb3566da61c2512b9bd6b7e42b592febc85e031
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256530
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-26 03:34:30 +00:00
Mike Reed
3a50981a83 switch to new filltype for SkPath
Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-25 22:31:46 +00:00
Julia Lavrova
c028b42717 Ellipsis again
Change-Id: I895fd394dedc50acd648eeed4f398c375a9812ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256224
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-11-25 19:57:15 +00:00
Herb Derby
06a620868e Structured binding for SkZip and SkEnumerate
Change-Id: I619d45fc270b6405f687096df2d333fe5e5ecb53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254276
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-25 17:07:46 +00:00
Brian Salomon
fc118442f6 Reland "Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType"""
This is a reland of 997b37fdb9

Layout tests have been suppressed.

Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
>
> This reverts commit 078e8faa26.
>
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Change-Id: I6db4cff8b71ef1f29ac47f7729b9514d009f730a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256225
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-25 15:46:35 +00:00
Robert Phillips
50299de399 Reland "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
This reverts commit 997b37fdb9.

Reason for revert: May be blocking Chrome roll

Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
> 
> This reverts commit 078e8faa26.
> 
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I0d2754ac7f4672f0758e4d00cd9e06998637846a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256196
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-23 15:21:08 +00:00