Commit Graph

24753 Commits

Author SHA1 Message Date
Robert Phillips
e837e61b5a Respect the max indexBuffer limits in the bulk texture draw API (take 2)
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Ibd029a59f6589e1ae6c66d072e5039f0e9de06dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254581
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-15 16:57:33 +00:00
Herb Derby
660c2fff46 Remove indexes from Geometry in the text op
Using indexes to name subruns seems overly complex. Just use pointers.

Change-Id: Ia02aed6a07e6bf91b70e42c45a0c5f6f903fa815
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254796
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-15 14:56:30 +00:00
Robert Phillips
b3d3551577 Revert "Reland "Reland "Reland "Implement sample mask and sample locations support in Vulkan""""
This reverts commit 091c02f89b.

Reason for revert: This time it is due to:

Chrome's android-binary-size try bot which doesn't allow any mutable constants. Here is what it is complaining about:

+ 0)          8 (3.2%)  d@0x311a908  +8 (0->8)          third_party/skia/src/gpu/vk/GrVkGpu.cpp
               GrVkGpu::querySampleLocations::kStandardSampleLocations_1
+ 1)        136 (54.8%) d@0x311a980  128 (0->128)       third_party/skia/src/gpu/vk/GrVkGpu.cpp
               GrVkGpu::querySampleLocations::kStandardSampleLocations_16
+ 2)        152 (61.3%) d@0x311a910  16 (0->16)         third_party/skia/src/gpu/vk/GrVkGpu.cpp
               GrVkGpu::querySampleLocations::kStandardSampleLocations_2
+ 3)        184 (74.2%) d@0x311a920  32 (0->32)         third_party/skia/src/gpu/vk/GrVkGpu.cpp
               GrVkGpu::querySampleLocations::kStandardSampleLocations_4
+ 4)        248 (100.0%) d@0x311a940  64 (0->64)         third_party/skia/src/gpu/vk/GrVkGpu.cpp
               GrVkGpu::querySampleLocations::kStandardSampleLocations_8

Original change's description:
> Reland "Reland "Reland "Implement sample mask and sample locations support in Vulkan"""
> 
> This is a reland of 8a0f50944b
> 
> Original change's description:
> > Reland "Reland "Implement sample mask and sample locations support in Vulkan""
> >
> > This is a reland of 97e917a25f, this
> > time with MSAA CCPR disabled.
> >
> > Original change's description:
> > > Reland "Implement sample mask and sample locations support in Vulkan"
> > >
> > > This is a reland of 8b915a0c27
> > >
> > > Original change's description:
> > > > Implement sample mask and sample locations support in Vulkan
> > > >
> > > > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > > > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > > > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > >
> > > TBR=ethannicholas@google.com
> > >
> > > Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
> > > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> >
> > TBR=ethannicholas@google.com
> >
> > Change-Id: Ie0861dc20df1fa622cb26ed78369d29976e3be10
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254608
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> 
> TBR=robertphillips@google.com
> 
> Change-Id: Ia831db32abf0037face708d742bda0600db0ec37
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254625
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: If0f865adf0c32c875fbb033ce1a8600090c9f65d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254864
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-15 13:32:43 +00:00
Chris Dalton
091c02f89b Reland "Reland "Reland "Implement sample mask and sample locations support in Vulkan"""
This is a reland of 8a0f50944b

Original change's description:
> Reland "Reland "Implement sample mask and sample locations support in Vulkan""
>
> This is a reland of 97e917a25f, this
> time with MSAA CCPR disabled.
>
> Original change's description:
> > Reland "Implement sample mask and sample locations support in Vulkan"
> >
> > This is a reland of 8b915a0c27
> >
> > Original change's description:
> > > Implement sample mask and sample locations support in Vulkan
> > >
> > > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> >
> > TBR=ethannicholas@google.com
> >
> > Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
>
> TBR=ethannicholas@google.com
>
> Change-Id: Ie0861dc20df1fa622cb26ed78369d29976e3be10
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254608
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=robertphillips@google.com

Change-Id: Ia831db32abf0037face708d742bda0600db0ec37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254625
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-15 04:01:27 +00:00
Mike Reed
c1c4634dcb add some api helpers (extracted from different CL)
See https://skia-review.googlesource.com/c/skia/+/253996/

Change-Id: I06cb3cb6dc8c088f139e6f2a78e43069c2609ff0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254736
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-11-14 22:40:22 +00:00
Herb Derby
3a4f22787a Hoist regenGlyphs out of per glyph loop
This positions to loop to be converted to
a bulk loop over the glyphs.

* rename fGlyphCache->fGrStrikeCache

Change-Id: Ie77d761905721cbdb52171117bac951cbca47af6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254425
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-14 21:38:38 +00:00
Bharat Ahuja
a7e4fe460c Issue- >Skia tiled bitmap rendering is too slow when tildmodeX is not same as tileModeY.
Reason-> Skia uses general-purpose pipeline in this case instead of more optimized faster pipeline.
Faster pipeline code was available in older versions of Skia and used to work fine but we removed faster pipeline code to consolidate the code. As discussed offline for us in the office we have significant scenarios running on software, so maintaining software performance is very important for us thus I am bringing this fast path back. To make this work I didn't have to do much, everything was already available, I just had to modify MatirxProcs to accept tilemodex and tilemodeY as parameters and define and configure SkBitmapProcState::MatrixProc GeneralProcs. I have also limited this change to ARM devices

Change-Id: Ie7ea59701d180c2832edb959e8d44047f4085cbf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252677
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Bharat Ahuja <ahujabharat93@gmail.com>
Auto-Submit: Bharat Ahuja <ahujabharat93@gmail.com>
2019-11-14 20:52:18 +00:00
Jim Van Verth
34b72aef7b Reduce scaling of large SDF glyphs on Mac.
It appears that the Mac glyph rasterizer doesn't work well with our
AA-based SDF generator -- the SDFs produced have more aliasing than
expected. This CL changes the Mac to use 256 as its highest SDF size,
and only scale down from there.

More work may need to be done -- the best solution may be to generate
the SDFs directly from the path rather than the rasterized glyph.

Bug: 1003270
Change-Id: I7f11620a5628b6c1095b02d588d5026bf5a924e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254636
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-11-14 20:49:08 +00:00
Chris Dalton
3120d03373 Revert "Reland "Reland "Implement sample mask and sample locations support in Vulkan"""
This reverts commit 8a0f50944b.

Reason for revert: Concerns about layout tests and bugs on Adreno

Original change's description:
> Reland "Reland "Implement sample mask and sample locations support in Vulkan""
> 
> This is a reland of 97e917a25f, this
> time with MSAA CCPR disabled.
> 
> Original change's description:
> > Reland "Implement sample mask and sample locations support in Vulkan"
> >
> > This is a reland of 8b915a0c27
> >
> > Original change's description:
> > > Implement sample mask and sample locations support in Vulkan
> > >
> > > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> >
> > TBR=ethannicholas@google.com
> >
> > Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> 
> TBR=ethannicholas@google.com
> 
> Change-Id: Ie0861dc20df1fa622cb26ed78369d29976e3be10
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254608
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I8c9d8850c2b5bfe4d1516b9eaa2f724f478e6c8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254624
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-14 19:16:20 +00:00
Robert Phillips
438d986b47 Respect max index buffer sizes in GrFillRectOp::MakeSet
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Iea5884ffff9bd62f62527fcb597dac97d33ecd76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254438
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-14 18:26:18 +00:00
Chris Dalton
8a0f50944b Reland "Reland "Implement sample mask and sample locations support in Vulkan""
This is a reland of 97e917a25f, this
time with MSAA CCPR disabled.

Original change's description:
> Reland "Implement sample mask and sample locations support in Vulkan"
>
> This is a reland of 8b915a0c27
>
> Original change's description:
> > Implement sample mask and sample locations support in Vulkan
> >
> > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
>
> TBR=ethannicholas@google.com
>
> Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=ethannicholas@google.com

Change-Id: Ie0861dc20df1fa622cb26ed78369d29976e3be10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254608
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-14 18:09:07 +00:00
Nigel Tao
3876a9f267 Reset SkWuffsCodec frame-count decoder less often
Previously, every call to SkWuffsCodec::onGetFrameCountInternal would
reset the decoder, as it might have been suspended in a co-routine.
Resetting also meant re-winding the input stream back to the first byte
of source data, to re-parse the image configuration (not just a
per-frame configuration), since e.g. the overall image bounds can affect
(clip) a frame's bounds.

Now that there are two separate decoders (one for pixel data and one
just for the frame-count), the only co-routine that the frame-count
decoder could be suspended in is the call to decode the next frame
configuration. There is no longer a need to (conditionally) reset the
frame-count decoder; we can just resume that co-routine (provided that
the fIOBuffer is positioned where it left off).

After this commit, the Wuffs decoder should use a little less CPU and
I/O when having getFrameCount called multiple times, interleaved with
incrementally decoding an animation.

Bug: skia:8235
Change-Id: I871ead40ed0acd6d101cf12784ee5da45e7de5aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254356
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2019-11-14 17:56:58 +00:00
Brian Salomon
bf5c0c0c99 Fixed sampling non-SkSL FPs with coordinates
This fixes an issue where fragment processors which were not written
in pure SkSL did not interact properly with coordinate overrides.

Change-Id: I960173986fd8d6be7322f55ab0d81a533b6b89e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252916
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-14 17:46:18 +00:00
Greg Daniel
95f0b1673f Miscellaneous updates to handle more vulkan creation failures.
Bug: skia:9603
Change-Id: Idc282775d75e1d136fdf83e98a2e7e3e871f9b08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253958
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-14 15:07:58 +00:00
Robert Phillips
d04f123cc7 Revert "Reland "Implement sample mask and sample locations support in Vulkan""
This reverts commit 97e917a25f.

Reason for revert: A lot of broken GMs - particularly path draws with loops

Original change's description:
> Reland "Implement sample mask and sample locations support in Vulkan"
> 
> This is a reland of 8b915a0c27
> 
> Original change's description:
> > Implement sample mask and sample locations support in Vulkan
> >
> > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> 
> TBR=ethannicholas@google.com
> 
> Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: Icff6c6e1d96f410449582ce0889b684b7e1ce2b4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254577
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-14 13:20:20 +00:00
Chris Dalton
97e917a25f Reland "Implement sample mask and sample locations support in Vulkan"
This is a reland of 8b915a0c27

Original change's description:
> Implement sample mask and sample locations support in Vulkan
>
> Change-Id: I372695ec5360def42a8a997675993264740b0da4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>

TBR=ethannicholas@google.com

Change-Id: I20de36719db52ad4dfc5290101d48a8fd9601c11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252936
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-14 02:09:03 +00:00
Mike Klein
37be7715fd implement assert_true on ARM
This all comes together as

    uminv tmp, condition
    fmov  gp, tmp
    cbnz  gp, all_true
    brk   0
  all_true:
    ...

The key idea is uminv(vec) will return 0 if any of the inputs are 0,
and non-zero if all of the inputs are non-zero, namely 0xffffffff.

fmov moves that minimum from a vector register to a general purpose
register where we can test it with cbnz, compare and branch if non-zero.
This jumps over the `brk 0` debug trap when all inputs are true.

Change-Id: If5deb77a77f52221d0649e537179743c45eb9cc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254479
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-13 22:09:59 +00:00
Brian Osman
fce27adfc5 Move the persistent GrMemoryPool to the heap
This fixes a fuzzer crash where the process was shutting down (and
destroying the pool), while some threads were still trying to use the
pool to finish their outstanding work.

It also cuts down on work done at shutdown time.

Fixed: chromium:1019616
Change-Id: I35f2046e9c70fc8964f0c6f2b416d80906d91bd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254424
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-13 21:49:49 +00:00
Chris Dalton
6006105f67 Implement mixed samples support in vulkan
Change-Id: I27d9e63aa7f2ad4468bb8f090a762511ead9d78c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253764
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-13 21:04:29 +00:00
Chris Dalton
8367e111d4 Enforce extra constraints for mixed samples at GrCaps level
Change-Id: Icbeafeb25614d66e548027e5777ea1699d1e6f7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254116
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-13 20:19:27 +00:00
Nigel Tao
4f32a29a69 Move SkWuffsCodec's reset_and_decode_image_config
This is just a re-organization, avoiding the need to have both a
declaration and a definition of that function. There is no behavior
change.

Also move to_alpha_type next to the other static functions (as opposed
to methods).

Bug: skia:8235
Change-Id: Ia0c06ec22a3dcc1d8ad66df886096a9657e43d35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254357
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-11-13 16:41:02 +00:00
Robert Phillips
ae01f62009 Revert "Respect the max indexBuffer limits in the bulk texture draw API"
This reverts commit dd947ceb55.

Reason for revert: CL isn't getting any respect from Android

Original change's description:
> Respect the max indexBuffer limits in the bulk texture draw API
> 
> This is required before we can lower the max AA quad count (again).
> 
> Bug: b/143572065 skia:9601
> Change-Id: Id34123476ad49a57dc9ce7fe13f941c06f721b74
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252603
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: Ibe396fe5a0351190c214ed54611ce72b7928cadd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/143572065 skia:9601
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254437
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-13 15:56:43 +00:00
Jim Van Verth
98b9fd0bf6 Put check for MTLTextureUsageShaderRead in available block.
MTLTextureUsage is not available on all Metal versions, so we need to
check for that. Also made the asserts consistent in this file.

Bug: skia:9573
Change-Id: I1cbb69be9c7b59d10454dc158b0f28ab5f74bbcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254418
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-11-13 15:49:02 +00:00
Robert Phillips
dd947ceb55 Respect the max indexBuffer limits in the bulk texture draw API
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Id34123476ad49a57dc9ce7fe13f941c06f721b74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252603
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-13 15:32:02 +00:00
Robert Phillips
99e73fa8c1 Remove GL 4-bit stencil option
I would be very surprised if this is still a thing.

Change-Id: I1f93a7c9ff1f655acfd81b1fd260207c6b942289
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254186
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-13 14:34:00 +00:00
Herb Derby
cb443a5928 Force single glyph calls through bulk interface
Enance SkBulkGlyphMetrics, SkBulkGlyphMetricsAndPaths, and SkBulkGlyphMetricsAndImages
with single glyph calls. In addtion, add calls needed to have the rest of the system
work with these interfaces.

As a resulte move the glyph, prepareImage, and preparePath calls to private.

Change-Id: I8d383b649390e45f621dcb9d62fb8367a55cee02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254056
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-12 22:38:14 +00:00
John Rosasco
a9b348f66c Reland fully delineate GL usage w/ skia_use_gl.
Change-Id: I90f40467be145537cc08461fd3805606432f0cfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254240
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Rosasco <rosasco@google.com>
Auto-Submit: John Rosasco <rosasco@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-12 21:43:44 +00:00
Chris Dalton
9acf68267a Fix detection of when we will have mixed sampled coverage
Change-Id: I32de8bdea7b7aafd202f44a2036872f25d531ae3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253763
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-12 21:19:05 +00:00
Mike Klein
8c1e0effbb sketch out structure for ops with immediates
Lots of x86 instructions can take their right hand side argument from
memory directly rather than a register.  We can use this to avoid the
need to allocate a register for many constants.

The strategy in this CL is one of several I've been stewing over, the
simplest of those strategies I think.  There are some trade offs
particularly on ARM; this naive ARM implementation means we'll load&op
every time, even though the load part of the operation can logically be
hoisted.  From here on I'm going to just briefly enumerate a few other
approaches that allow the optimization on x86 and still allow the
immediate splats to hoist on ARM.

1) don't do it on ARM
A very simple approach is to simply not perform this optimization on
ARM.  ARM has more vector registers than x86, and so register pressure
is lower there.  We're going to end up with splatted constants in
registers anyway, so maybe just let that happen the normal way instead
of some roundabout complicated hack like I'll talk about in 2).  The
only downside in my mind is that this approach would make high-level
program descriptions platform dependent, which isn't so bad, but it's
been nice to be able to compare and diff debug dumps.

2) split Op::splat up
The next less-simple approach to this problem could fix this by
splitting splats into two Ops internally, one inner Op::immediate that
guantees at least the constant is in memory and is compatible with
immediate-aware Ops like mul_f32_imm, and an outer Op::constant that
depends on that Op::immediate and further guarantees that constant has
been broadcast into a register to be compatible with non-immediate-aware
ops like div_f32.  When building a program, immediate-aware ops would
peek for Op::constants as they do today for Op::splats, but instead of
embedding the immediate themselves, they'd replace their dependency with
the inner Op::immediate.

On x86 these new Ops would work just as advertised, with Op::immediate a
runtime no-op, Op::constant the usual vbroadcastss.  On ARM
Op::immediate needs to go all the way and splat out a register to make
the constant compatible with immediate-aware ops, and the Op::constant
becomes a noop now instead.  All this comes together to let the
Op::immediate splat hoist up out of the loop while still feeding
Op::mul_f32_imm and co.  It's a rather complicated approach to solving
this issue, but I might want to explore it just to see how bad it is.

3) do it inside the x86 JIT
The conceptually best approach is to find a way to do this peepholing
only inside the JIT only on x86, avoiding the need for new
Op::mul_f32_imm and co.  ARM and the interpreter don't benefit from this
peephole, so the x86 JIT is the logical owner of this optimization.
Finding a clean way to do this without too much disruption is the least
baked idea I've got here, though I think the most desirable long-term.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_USE_SKVM_BLITTER
Change-Id: Ie9c6336ed08b6fbeb89acf920a48a319f74f3643
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254217
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-11-12 20:17:55 +00:00
Mike Klein
749eef6b1a implement assert_true on x86
The logic implemented here is roughly

  assert_true(v):
     if any ~v {
         int3()
     }

  in assembly as

  ```
    vptest v, constant 0xffffffff mask
    jc ok
    int3
  ok:
  ```

jc branches if (~v & mask) are all zero, with mask set fully, that's
branch if ~v are all zero, which is to say, v are all ~0, true.  So we
jump over the int3 breakpoint if v are all true.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Ie0fc1da15b1a0dba00c66af610ccde18f5985f8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253897
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-11-12 20:07:35 +00:00
Robert Phillips
373bda6c39 Remove final usage of GrProgramDesc's header
This demotes GrProgramDesc to just being the program key while promoting GrProgramInfo as the exclusive source for live information about the program.

The GrProgramDesc is still a bit more than a simple program key though bc Vulkan shears off the non-Vulkan-specific portion to cache the SPIRV code.

Bug: skia:9455
Change-Id: Ica11e3df91b8c97794deebff3f5208d16aaf75c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254184
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-12 19:18:35 +00:00
Chris Dalton
5e8cdfdd8b Add 'numRasterSamples' and 'isMixedSampled' to GrProgramInfo
Replaces numSamples with numRasterSamples, and adds isMixedSampled.
The sample count that vulkan and metal actually want to know is how
many samples the rasterizer will compute, which may not match the
number of samples in the render target when we have mixed samples.
They will also need to know whether a program is mixed sampled in
order to set up coverage modulation.

Change-Id: I133c11f74b7dc6a7580818ef73d6deec1d201b64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253550
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-12 17:14:19 +00:00
Robert Phillips
a87c52991b Use a priori knowledge about the number of stencil bits in Dawn, Metal and Vulkan backends
The goal here is to centralize more of the program key creation w/in GrProgramInfo. For Dawn,
Metal and Vulkan, afaict, the number of stencil bits is always 8. We can use this information
 to stop passing the GrStencilSettings object around. For GL, the number of stencil bits is
 variable but it is never part of the key.

Bug: skia:9455
Change-Id: I8fd2bea2422c5b9df69fc184d3a82013eef5407e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254177
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-12 16:48:19 +00:00
Stephen White
7cb52cb5e6 Dawn: implement dynamic primitive processor texture handling.
Move texture setting into its own function.
Put textures in their own bind group.
Bind the dynamic ones per-mesh.
Bind the fixed ones once up front.

Change-Id: Ia93b5a3f0de6a2a3cc26b549fb56ce58215c0b19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253878
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-12 16:16:50 +00:00
Jim Van Verth
9187e49ed1 Detect whether trying to blit a Metal swapchain texture, and fail if so.
Metal swapchain textures (equivalent to GL's FBO 0) can't be used with
MTLBlitCommandEncoder. For copySurface we need to detect this and fail.
Future changes will handle GrSurfaceProxy.

Change-Id: I9235d91cf31e96260c8d1da5938f5441d2e49d27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252045
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-12 14:56:28 +00:00
Stephen White
3a62ed4ff1 Dawn: fix bug in stencil handling.
Change-Id: Iacfe175d0c6e3d90dae1990b57de2c94dada3e77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253959
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-11-12 14:56:18 +00:00
Nigel Tao
5b2714631f Free SkWuffsCodec frame-count decoder earlier
This might help peak memory use.

Bug: skia:8235
Change-Id: Ib8316211ff6bbe7d2cc32e759d3e0d20e2b56348
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254156
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-11-12 14:51:23 +00:00
Ben Wagner
2e4a8eb436 Track and force opsz axis on Mac.
If the opsz axis is set, ensure that it stays that way. Currently this
does not pin the opsz axis for all fonts, but allows for that in the
future.

Bug: skia:9533

Change-Id: Iac786f9f91bf6d53d92847a91443b876713f9c2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253738
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-12 14:51:13 +00:00
Herb Derby
4bb189fcee Make metrics const on SkStrike
Change-Id: I13373d7d4f12fec977ad9f77e1b3a9ead91c321d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254076
Auto-Submit: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-12 14:46:18 +00:00
Herb Derby
8a1a3e6489 WS: SkStrike
Change-Id: I2419ebbd53e50d39a1469d97f1b7736b0db73da6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254096
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-12 14:41:04 +00:00
Brian Salomon
c75bc031ef Clamp RGB outputs of GrYUVtoRGBEffect.
The matrices we're using can produce very slightly out of range color
channels. This gives surprising results when in shader blending is used
for color burn and color dodge. After this change we clamp the RGB
values to 0..1 before applying premul.

Adds a GM modeled on a blink layout test that shows the problem using
SkImageMakeFromYUVAPixmaps.


Bug: skia:9619


Change-Id: I446d39763a7f5a2f7c5f61d94d163927d851baa3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253879
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-11 20:04:15 +00:00
Herb Derby
aa3f2623ea Remove belongsToCache from SkStrike
Change-Id: I0fd6cf940f2df97f4f6b952681109f58dc9ad553
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253777
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-11 19:46:05 +00:00
Sean Gilhuly
6c536a5b44 Roll Dawn, fix build issues in Skia Dawn
There were some recent renamings in Skia and in the WGPU API. Roll
Dawn to the latest patch, and update Skia Dawn to match these new
names.

Change-Id: I0b73a514553664ddea7181b9c6174ab6231ea4f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253731
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
2019-11-11 17:58:21 +00:00
Robert Phillips
323471ec79 Remove GrProgramDesc's need for the GrGpu
Although not strictly necessary, being able to compute the program key w/o needing access to the Gpu will give us more flexibility.

Bug: skia:9455
Change-Id: I0cd76d79a3008b69be18636be370e7aaa531bc65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247686
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-11 17:17:01 +00:00
Mike Klein
ee5864a170 add int3, vptest, jc
Will use these to implement assert_true on x86.

Change-Id: I9d2595a35518b6971dd8e418b583febd3960c7f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253896
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-11 16:33:01 +00:00
Mike Klein
1360117174 add assert_true()
This is an assert that is active in debug mode.  For the moment it only
works in the interpreter, but I plan to follow up with JIT code too.

assert_true() is a data sink like a store() as far as lifetime goes,
though we take care to allow it to be hoisted if its inputs are.  An
assert_true's existence will keep all its inputs alive, and in release
builds where we skip the instruction, those inputs will all drop away
automatically.

Tested locally by forcing the interpreter.  It shouldn't be long before
I have at least x86 JIT asserts working too.

Change-Id: I7aba40d040436a57a6b930790f7b8962bafb1a8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253756
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-11 15:12:18 +00:00
Brian Salomon
8283fa4066 C++17
With this change C++17 language features can be used in code that does
not need to be be included in client code (not in public headers or
the files they transitively include).

We haven't investigated the c++17ness of the standard libraries in use
by clients so proceed with caution on library features.

One thing discovered along the way: throw() in C++17 is now equivalent
to noexcept(true). Moreover, the noexcept-ness of a function is part of
its type in C++17. This means that if a header declares a function with
throw() and it is included in a cpp compiled with C++17 file it will have
a different type than if it is compiled in a file compiled with C++14 (or
earlier) and you can get linker errors. Here is a change we had to make
as a result of this:

https://skia.googlesource.com/skia.git/+/4d0fe38f29388ef0aa6893d1d4fc237e758dd11f%5E%21/#F0

Change-Id: I996f2237fdd6b49e2e4cc8d3ff6db9dd536eafd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235022
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-11 14:49:55 +00:00
Mike Klein
78441455a3 don't allocate an interpreter register for stores
Instructions only need a register if they've got an output.
This more closely mirrors what the JIT does.

Change-Id: I9cddba124a90c3afa698d82b1bb89808a7abd3c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253762
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-11 14:39:45 +00:00
Mike Klein
4135cf0b57 use round() instead of trunc() to f32->unorm
This does open us up to a little bit of possible inconsistency of
rounding when right on a x.5 (sometimes we'll +0.5 and trunc, sometimes
round to nearest, sometimes round according to the default mode which is
usually round to nearest) but I think that inconsistency may be worth
the free register not needing a splat(0.5f) buys us.

A few invisible diffs.

Change-Id: I9af092c937ccf7c5891c2ab3cb298d217e4a9e9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253725
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-08 21:28:07 +00:00
Mike Klein
6e4aad91c3 rename to_i32 -> trunc, and add round
This plumbs through round but doesn't use it.  I want that change to be
its own CL.  It's nice to have assembler support and the name changes
even if I revert using round.

Change-Id: I6d67ec5c63546069eb7cc1c91599b599bafcda66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253724
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 21:00:51 +00:00
Mike Klein
049b58f97a avoid redundant clamps
If we clamp the shader color to gamut, we won't need to clamp again when
storing to the destination... blending and coverage will keep the color
in gamut.

Change-Id: I9a4eb609de58fc0cb6295df0ad1c4cef8cd7e307
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253722
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 20:51:37 +00:00
Mike Klein
b97a919418 don't clamp alpha, it's already [0,1]
No diffs.

Change-Id: I13a848955605a16aa229b98a14dc0e1930ba28c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253721
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 20:40:47 +00:00
Mike Klein
a53e47fe94 native f32 min/max
No diffs.

Change-Id: Ia0b35c2787e27d74763f21b81072affa6caf1e5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253720
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-08 20:21:38 +00:00
Mike Klein
b9f208817c convert SkVMBlitter over to floats
As we've learned there's not much advantage to working directly in i32
ops over f32... it's the same size, kind of a wash speed-wise, and f32
supports all operations we want where i32 supports only a subset.  If we
really want to go fast, we need to focus on i16 operations, which are
both significantly faster and operate on twice as much data at a time.

(This is the same split as SkRasterPipeline, highp f32 and lowp i16.)

For now port everything to f32, with i16 to follow, perhaps much later.

There's a little here we could spin off to land first (uniformF, better
unpremul) but I think it might be easiest to land all at once.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I6fa0fd2031a0de18456abf529cc5b0d8137ecbe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253704
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-08 19:29:06 +00:00
Chris Dalton
f00b95b7f3 Always attach stencil buffers with exact sample count matches
After this CL we will always attach a stencil buffer for rendering
that matches the stencil sample count of the proxy. We will even
downgrade a stencil attachment to one with less samples if necessary.
(In the past we would only guarantee that the attached stencil buffer
had a sample count >= to that of the proxy.)

Change-Id: I358e13ffdf286695257b1b5b672a84d16c417b80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253547
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-08 19:20:36 +00:00
Chris Dalton
0b68ddacad Defer stencil attachment until opsTask execution
Change-Id: I34cc35d16966d35e26561c40a0300112b2da2fa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253546
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-08 18:36:35 +00:00
Mike Klein
b2ab7d15d3 add SkColorTypeIsNormalized()
This centralizes the logic for whether a color type is normalized.

The change in SkRasterPipelineBlitter is minor, only now properly
treating kR16G16_float_SkColorType as unnormalized.

The change in SkColorSpaceXformSteps is more extreme given the way
it had been written, with all the newer color types now correct.

I think I'm making the right call on kA16_float_SkColorType?

Are there equivalent sites to update in Ganesh?

Change-Id: I32a40b31b86c5fde0dea2528122a4deda91c5545
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253668
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 17:51:45 +00:00
Greg Daniel
ed98476cf2 Handle failure to create VkRenderPasses in vulkan backend.
Bug: skia:9603
Change-Id: I8c56f399d58b109d163ff69b654d07edbc44dde0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253497
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-08 14:38:13 +00:00
Mike Klein
4d0fe38f29 Pre-flight SkTLS_pthread changes for C++17
Looks like this is what the CFI bots tripped on,
so maybe there's something more real going on here.

I think we can try again in Chromium after this?

Change-Id: I6f59aeae01df130a21c64b5218b4d21238e343d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253636
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-08 14:24:14 +00:00
Mike Klein
8c1e265f6f remove redundant comparison ops
Depending on data type and platform, there's usually only one of < or >
(and <= or >=) since you can trivially translate to the other by
swapping the arguments.  This CL bubbles that insight up one level to
our mid-level skvm::Op enum, arbitrarily keeping > and >=.  Nothing
changes from the perspective of an skvm user.

Change-Id: Ia271436cc2b9916b761320769a715a3952e4ce41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253199
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 14:16:03 +00:00
Chris Dalton
b204e4c3d3 Implement multisample "disable" in Vulkan
Emulates multisample disable by colocating all samples at pixel
center. Multisample disable will be required in order for us to
integrate mixed samples.

Change-Id: I52b67e22c979584b5d001e737a08eef07bd7ffe2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253282
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-08 00:21:09 +00:00
Mike Klein
81a8d282d3 Reland "hook up float comparisons to x86 JIT"
This is a reland of 12cea8d6c4

Now implementing float comparisons on ARM also.
Only vaguely tricky thing is that x!=y is ~(x==y).

Original change's description:
> hook up float comparisons to x86 JIT
>
> This gets the draws in gm/skvm.cpp all JITing again,
> and in one of the unit tests.
>
> (Everything draws the same of course.)
>
> Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Cq-Include-Trybots: skia.primary:Test-Android-Clang-NVIDIA_Shield-CPU-TegraX1-arm64-Debug-All-Android
Change-Id: I771b8a327a958db8a0d509d55863ade935a00035
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 18:55:14 +00:00
herb
05f6a01bf9 Remove unused methods from SkStrike
Change-Id: Icfca4b099e594c61cbaf0b5f160c6293b39c4083
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253382
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-07 18:25:14 +00:00
Mike Klein
3f7c865936 avoid the JIT on MSAN builds
JIT code isn't MSAN-instrumented, so we won't see when it uses
uninitialized memory, and we'll not see the writes it makes as properly
initializing memory.  Instead force the interpreter, which should let
MSAN see everything our programs do properly.

This refactors so that SkVM.cpp is the only code to look at whether
SKVM_JIT is defined, and undefines it when built with MSAN.  Added
a simple regression test too.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN
Change-Id: Ic7cca2621f84dfba7174127738744d6c68f85f2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253410
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 18:24:34 +00:00
herb
252cdb7824 One glyph() to rule them all!!!
Change-Id: Icb8d9653b5037921648a6c20ff21d26375301b65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253381
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-07 18:03:34 +00:00
Mike Reed
4edb719f1b flesh out blendmodes through Screen
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I7a573d8991a41020bfaf72fe1fe231ee1da92535
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253196
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-07 17:59:24 +00:00
Robert Phillips
fcaae486d7 Use GrProgramInfo's primitiveType field
This improves the encapsulation of all the data required to make a program/pipeline w/in the GrProgramInfo class.

Bug: skia:9455
Change-Id: Ib41519c8ded9f27a7bbe787097a431b38ab101bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253376
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-07 16:15:04 +00:00
Mike Klein
297d5a03e6 Revert "hook up float comparisons to x86 JIT"
This reverts commit 12cea8d6c4.

Reason for revert: unit tests failing on ARM... will try again once I have float comparisons implemented for ARM too.

Original change's description:
> hook up float comparisons to x86 JIT
> 
> This gets the draws in gm/skvm.cpp all JITing again,
> and in one of the unit tests.
> 
> (Everything draws the same of course.)
> 
> Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: Ie07e580b4998199338217a27d4fad34c679ffc23
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253399
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 15:35:12 +00:00
Greg Daniel
fa3adf79c8 Add handling of failed framebuffer creation in vulkan.
Bug: skia:9603
Change-Id: I264d1387f319cbe3bb27982ccc6e01fb530abbd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253238
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2019-11-07 15:25:20 +00:00
Mike Klein
12cea8d6c4 hook up float comparisons to x86 JIT
This gets the draws in gm/skvm.cpp all JITing again,
and in one of the unit tests.

(Everything draws the same of course.)

Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 14:36:32 +00:00
Robert Phillips
cea290f9d5 Add GrPrimitiveType to GrProgramInfo
This further consolidates the information required to compute the program key (esp. for Vulkan). This CL mainly comprises the plumbing portion - a follow up CL will actually use it.

Bug: skia:9455
Change-Id: Iaac716c289916981a1757a333bfa57b3051fd35b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252161
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-07 13:30:42 +00:00
Chris Dalton
67d43fe581 Rename stencil face terminology to clockwise/counter-clockwise
"Front" and "back" actually refer to opposite triangles in GL vs
Vulkan. Both APIs define counter-clockwise as the default winding
direction for the front face, but since GL uses a bottom-up coordinate
system, they are reversed from one another.

The idea of this CL is to define Ganesh's stencil settings in terms of
clockwise and counter-clockwise in skia device space, just like how we
use "sk_Clockwise" insead of "gl_FrontFacing" in SkSL. We
intentionally avoid the "front"/"back" terminology so there is no
ambiguity. The individual backends are now responsible to translate
cw/ccw into whatever that means for front and back in their own
particular APIs.

This change also swaps the front and back stencil faces in vulkan and
metal, since they were previously backwards from GL. This should have
no actual effect yet, because the only code so far where this matters
is ccpr.

Change-Id: Ife6afbe0a83899edc7eacc3f00a4507d065cccab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252977
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-06 22:42:19 +00:00
Herb Derby
2959749f85 Allow more sub-pixel position bits
I tracked down all the places where things were assuming 2-bits
of sub-pixel positions. I generalized them all to take a variable
number of bits.

Change-Id: I304061635c838fedc3881aaa256bab943ff6a817
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253236
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-06 21:37:07 +00:00
Mike Klein
714f8cc3ff add vcmpps
Change-Id: I7a13b759d2cd2c27c107ff4cec0daa15c2cd9edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253131
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-06 21:22:22 +00:00
Herb Derby
f7ce19e773 Improve the dynamic range of SkPackedGlyphID ctor
The previous version only translated the sub-position reliably
if the position < 2^10. This code extends the range to 2^21.

Change-Id: I7fcdfe2c3f7336ac0788e282c2bd0fc73067d8fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253101
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-06 20:27:42 +00:00
Mike Klein
d0792e6de6 unnest matrix multiply
As written the order that skvm::Builder sees the values passed as
arguments to mad() is dependent on C++ function argument evaluation
order.  This can be counterintuitive, and since skvm::Builder uses the
original order it saw arguments to break ties when reordering programs,
it can affect program order and register pressure.

This change keeps the math happening in the same order, but takes
precise control over when we mention (and thus when we load) each matrix
coefficient.  The program goes from looking like this, loading uniforms
in reverse order that they're needed,

    ...
    r4 = uniform32 arg(0) 4C
    r3 = uniform32 arg(0) 50
    r12 = uniform32 arg(0) 54
    r13 = uniform32 arg(0) 58
    r14 = uniform32 arg(0) 5C
    r14 = mad_f32 r13 r8 r14
    r14 = mad_f32 r12 r9 r14
    r14 = mad_f32 r3 r11 r14
    r14 = mad_f32 r4 r6 r14
    ...

to something nicer like this that reuses the same temporaries to load
and accumulate the uniforms in the order they're needed,

    ...
    r7 = uniform32 arg(0) 5C
    r11 = uniform32 arg(0) 58
    r7 = mad_f32 r11 r8 r7
    r11 = uniform32 arg(0) 54
    r7 = mad_f32 r11 r9 r7
    r11 = uniform32 arg(0) 50
    r7 = mad_f32 r11 r10 r7
    r11 = uniform32 arg(0) 4C
    r7 = mad_f32 r11 r6 r7
    ...

In all this cuts three unnecessary temporary registers from programs
using SkColorFilter_Matrix, and would be enough to get gm/skvm.cpp all
JITing again if all the instructions it used were implemented... (next).

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Ie03a5da476a49eeb950e74290001a0625cf61177
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253126
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-06 19:09:19 +00:00
Jim Van Verth
4afe94c940 Fix issue with RenderPipelineDescriptor creation
For some reason using the 'new' method is causing crashes in some
circumstances. Switching to alloc then init (which is what new does
implicitly) fixes this.

Bug: skia:8243
Change-Id: I84983baf417b974e1888dba91af6f5d6a76bbbad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252922
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-11-06 18:41:47 +00:00
Mike Klein
23599279ee JIT splat(0) as xor
This makes some programs a little shorter, both in code size (xor is
fewer bytes on x86) and in data size (no big 0 splat data after return.)
But it's mostly just for fun.  Every once in a while it's good to make
sure we can still do stuff like this to keep fresh.

Change-Id: I4a47a638bb05a2d1687d007141643ca0ed45130e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253095
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-06 17:39:23 +00:00
Robert Phillips
0efc01d540 Revert "Fully delineate GL usage w/ skia_use_gl"
This reverts commit 078cf3e3b2.

Reason for revert: Appears to be blocking the Chrome roll due to Fuchsia build failures

Original change's description:
> Fully delineate GL usage w/ skia_use_gl
> 
> Change-Id: I17424d2235c7a54c4cda036f01a0b99dadc4b632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252085
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=mtklein@google.com,bsalomon@google.com,halcanary@google.com,rosasco@google.com

Change-Id: I17ba79bfe6e7f81c126eddbd50ca5384cfa4179c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253098
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-06 17:19:48 +00:00
Mike Klein
da7ef8622e guard all SkVMBlitter debug features together
Change-Id: Idcc4d85683f376da92e9c6f88e35bb7df7ecea6b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253090
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-06 16:53:34 +00:00
Nigel Tao
cdc923886b Inline SkWuffsCodec::readFrames
This simplifies the code. It was only called in one place, from the
short SkWuffsCodec::onGetFrameCountInternal function.

Bug: skia:8235
Change-Id: I8af0816fab9f639bbb52ef7fa07b07006825e358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251856
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-11-06 16:33:33 +00:00
John Rosasco
078cf3e3b2 Fully delineate GL usage w/ skia_use_gl
Change-Id: I17424d2235c7a54c4cda036f01a0b99dadc4b632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252085
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-06 15:15:03 +00:00
Greg Daniel
9b63dc852e Have vulkan command and descriptor sets handle failed creation.
This requires the switch to using more factory functions that can fail,
creating the vulkan objects in the factories (instead of ctor), and
making sure calling code handles the failed creations.

Bug: skia:9603
Change-Id: I22f1852e4cbefe584857f3adccf486cb1326cb68
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252928
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2019-11-06 14:50:33 +00:00
Michael Ludwig
d84dd4babb Combine mask and edge distance in TessellationHelper
This also moves the corner scale factors (1 for rectangles, or 1/sin(theta)
into the EdgeVector state, since that is constant for a quad and can be
reused between different edge distance requests.

The OutsetRequest cached data now only needs to decide which codepath to
use for calculating the inset or outset (fast or degenerate). It is now
capable of distinguishing degeneracies for just the inset and not outset
(or vice versa). Previously, if the inset would cause a degeneracy, both
inset and outset operations would go through the slow path.

Change-Id: Idda859152b6f515f2b3d54875b9f40d9feb5da22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252816
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-06 13:57:43 +00:00
Robert Phillips
6e54a299cc Assert we are now in the world of single-primitive-type render passes
We want this to be true so that we can know ahead of time what the primitiveType of a given render pass will be and add it to the GrProgramInfo.

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

Bug: skia:9455
Change-Id: I3e6365da6db5349dfe7329ef1e20b8c1d6267ff1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252925
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-06 13:38:33 +00:00
Mike Reed
0cbb90dc81 split out blendmodes for skvm
Idea is to make shared functions around blendmodes, so we can use them from the
blitter-builder, and from effects like ModeColorFilter.

This CL just tries the refactor. After this, will be easy/fun to flesh out (some)
more of the other modes.

Change-Id: Ia55c60099065c16efdc322a5cab425e222540d6a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252658
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-05 22:38:34 +00:00
Mike Reed
971e9eb05d split out serial functions for SkFont into separate impl
... in prep for future CL that makes serialiation more complicated
https://skia-review.googlesource.com/c/skia/+/252927

Change-Id: Ica3cb803c6cd47295b4f12574c9965e47dc57ac3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252659
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-05 22:35:24 +00:00
Michael Ludwig
ce200acafa Cache tessellation metadata between inset/outset calls
Change-Id: I1fb4807ab80dad9a02e9e236d43b3f2be7511412
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251769
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-11-05 21:45:14 +00:00
Stephen White
b1576fd065 Dawn: fix mipmap width and height computation during upload.
Don't go below 1 in width or height when downsizing for uploads.
This can happen with rectangular textures, where one dimension hits
the lower bound.

Change-Id: Ica28e6274cf1df658145233ab6694f2c64c55201
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252316
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-11-05 21:07:44 +00:00
Mike Klein
1cc6067757 friendly wrapper to allocate uniforms
This basically wraps up the old `uniforms` and `buf` params
into a new type that has push() and pushF() methods that return
a value you can pass directly to Builder::uniform32() and co.

I think this has uniforms about as streamlined as they can get.

Change-Id: I8f611f91b4a2d7cdb8f05ce0333669d2e3930be8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252937
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-05 21:02:34 +00:00
Robert Phillips
73fcde07f8 Revert "Reland "Implement sample mask and sample locations support in Vulkan""
This reverts commit 2245bf8313.

Reason for revert: I believe this is altering a lot of GMs (for the worse)

Original change's description:
> Reland "Implement sample mask and sample locations support in Vulkan"
> 
> This is a reland of 8b915a0c27
> 
> Original change's description:
> > Implement sample mask and sample locations support in Vulkan
> > 
> > Change-Id: I372695ec5360def42a8a997675993264740b0da4
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> > Commit-Queue: Chris Dalton <csmartdalton@google.com>
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> 
> Change-Id: Idd0d8f63c7bb1cdd4d905c483f2fe7ed2b34b05f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252306
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I8e2ad26441f79545858233a4a59cad6898a8aed9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252919
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-05 19:56:16 +00:00
Robert Phillips
368570db19 Revert "Add a "conservative raster" flag to GrPipeline and implement in Vulkan"
This reverts commit ee6b49b3af.

Reason for revert: I believe this is blocking the revert of Ethan's CL

Original change's description:
> Add a "conservative raster" flag to GrPipeline and implement in Vulkan
> 
> This flag is not yet used or tested. Both will come next when we
> enable mixed sampled ccpr.
> 
> Change-Id: Ic242010b1f0b8d81b83731960283e4231f301fd1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252258
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

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

Change-Id: I01792817e7298470a3dc17e3687f1e8e0bc5d726
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252918
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-05 19:51:32 +00:00
Mike Klein
96b6150868 implement SkColorFilterShader::isOpaque()
Change-Id: I53872aa96b9cfcb3352cf8d48329e32f19cb97f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252789
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 19:23:42 +00:00
Chris Dalton
ee6b49b3af Add a "conservative raster" flag to GrPipeline and implement in Vulkan
This flag is not yet used or tested. Both will come next when we
enable mixed sampled ccpr.

Change-Id: Ic242010b1f0b8d81b83731960283e4231f301fd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252258
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-05 19:05:34 +00:00
Greg Daniel
e643da6ab8 Add new macro for checking device lost when making Vulkan calls.
This CL itself doesn't really change how anything is running today. However,
it is the first step into gracefully supporting a vulkan device lost return
error and being able to correctly clean everything up.

Bug: skia:9603
Change-Id: I9693c514a32ca437df61a7aee63651e2e40ee1c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252819
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-05 18:56:35 +00:00
Ethan Nicholas
2245bf8313 Reland "Implement sample mask and sample locations support in Vulkan"
This is a reland of 8b915a0c27

Original change's description:
> Implement sample mask and sample locations support in Vulkan
> 
> Change-Id: I372695ec5360def42a8a997675993264740b0da4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>

Change-Id: Idd0d8f63c7bb1cdd4d905c483f2fe7ed2b34b05f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252306
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-11-05 18:41:31 +00:00
Mike Klein
5625412f02 unify program() and uniforms()
It's clearer and more efficient to emit uniforms
as we use them.  The pattern to look for is something like

    skvm::I32 val = p->uniform32(uniforms, buf->bytes());
    buf->push_back(fVal);

where fVal holds the actual uniform value, and val is its program
counterpart.

Switching to SkTDArray lets us use friendlier methods like bytes() and
append(N) in the effect code.

It's a lot easier to follow this way once you get used to it and much
less error-prone.  No need to split the can-we-do-it logic up from the
uniform emission, and so no chance to write logic twice that
acccidentally disagrees.

Effects now always emit uniforms when you call program(), which means we
occasionally do that twice, once when building the Key to look up cached
programs, and once again when building the program if the cache misses.
That's not that big of a deal... it reuses the same memory exactly, and
I've added some notes around the code and assertions that everything
matches up exactly.  It only happens on cache miss, so it's dwarfed by
the cost of building and JITing the program anwyay.

Change-Id: I55a9252b11b2c0cd5f7ab8ace6df5fef29342c10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252837
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 18:41:30 +00:00
Brian Osman
09ee112bdb Reland "Fully embrace skcms types in SkColorSpace API"
This reverts commit 6af9b1c673.

Change-Id: I7954951497e57475ab6f1c7f946b47aa17f1ac8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252817
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-05 18:36:26 +00:00
Brian Salomon
b3bd86405b Cleanup kGray_8 readback.
Rm unused function SkColorTypeIsGray.

Expect kGray_8 readback to work in tests.

Bug: skia:8962

Change-Id: Iad9d2be3e0a2e594e62dc681b79c59e0a833116a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245162
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-05 18:36:25 +00:00
Herb Derby
57643aa1c2 Speed up diff canvas using small bit vector
GlyphIDs < 128 are the vast majority of ids in roman text websites.
This change exploits this to do a fast check to see if a glyph has
already been sent from the Renderer to the GPU. This does not change
the performance of CJK glyphs.

Remember each glyphID entry takes 4 bits to encode sub-pixel position
information.

SkDiffBench-wikicat: 143ms -> 118ms

Change-Id: If5905e0dc6b39ae69e0235e81a9b6050afd25a97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251760
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Khushal Sagar <khushalsagar@google.com>
2019-11-05 18:21:18 +00:00
Mike Klein
746acf1ebc add color filter support
- move some helpers to central spot
  - add a color filter interface, the same as shader without (x,y)
  - implement matrix color filter (pretty naively)
    and color filter shader (pretty reasonably)
  - extend GM to demonstrate

The new blitters with color filters are failing to JIT because they're
running out of registers.  (They still work fine on the interpreter of
course.)  I'm going to take a look to see whether there's something I
can do either in the effect program() code or in the optimizer to
rearrange to get it to fit and JIT.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Ibdc1a5e7b9e7a14778efba583b7821bcd4f3062a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252788
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-05 18:15:43 +00:00
Mike Klein
7a13b461e6 x86-64 JIT support for Op::index
This lets shaders that use 'x' JIT on x86.

I started with paddd and {0,-1,-2,-3,...}, which worked fine but on
second thought seemed a bit odd.  I've switched to psubd and
{0,1,2,3,...} but I've left in support for paddd with a memory arg.

gm/skvm.cpp now JITs fully again and continues to draw the same as
the interpreter did.

Simplify embedded data alignment a little... memory operands don't
need full register alignment in AVX like they used to in SSE.  So
just align everything to the vector element size like we do on ARM,
and reorder [splats,bytes_masks,iota] to match the order we declare
and handle them in the code above.

Add unit tests for vpaddd + vpsubd.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I6b8d060450cca7f437a1d2a597a8a0e0e8d51b33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252797
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 17:11:37 +00:00
Chris Dalton
36574af816 ccpr: Fail gracefully when atlas instantiation fails
This fixes a crash, but still does not answer the question why
8192x8192 msaa atlas instantiations are failing sporadically on
vulkan. Luckily we will be switching to mixed samples soon, so this
problem is very temporary.

Change-Id: I7dedb3c943f432543c12f02587ece8d71443a1cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252646
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-11-05 16:37:39 +00:00
Robert Phillips
6af9b1c673 Revert "Fully embrace skcms types in SkColorSpace API"
This reverts commit 701522798a.

Reason for revert: Maybe blocking the Android roll

Original change's description:
> Fully embrace skcms types in SkColorSpace API
> 
> Remove the SkMatrix44 getter entirely.
> 
> Change-Id: I25bfe68a7a9b21d8a8696415b517cb79fc2d7a94
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252596
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

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

Change-Id: Ic277d54d4ac8c84f00405946c927a3aee4e33068
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252801
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-05 15:03:49 +00:00
Mike Klein
cfa4f60270 simpler uniforms() api
By making uniforms() just append to the uniform vector, there's no more
need for two passes, no need for the blitter to ever even know how many
uniforms the effects use, and the effects now never need to deal with a
nullptr uniform buffer.  Much simpler all around.

While we're refactoring, convert the uniform buffer de jure to
std::vector<uint32_t>, which is what we'd been treating the old
std::vector<uint8_t> as by convention, and switch the program() offset
parameter type to size_t as a reminder that it's measured in bytes.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I81d2c92aae37a650104f384f815df78c8a186270
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252776
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-05 13:26:22 +00:00
Mike Klein
fb9146ffc7 merge key() and CanBuild() into CacheKey()
We can unify these similar functions to reduce the amount of work we do
and guarantee SkShaderBase::program() is never called with a null
skvm::Builder*.  We now only call program() to do real work: one call to
get a shader key, and if no program is found in the cache, one more call
to build the blitter program.  No null checks are needed any longer.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I6e73d9d264690f04ddcc92e6f7b3c42654f8a41c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252759
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-05 12:35:01 +00:00
Mike Klein
e8356ad35d indent loop so it stands out
Change-Id: Iea0f804b1b2fed9e663e45c33fb54a91b10fd07b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252652
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-05 11:33:54 +00:00
Mike Klein
f3d4109a79 add (x,y) params to shader program()
This should work, though I need to do a little more work to get programs
that use x to JIT.  It shouldn't be bad, probably done tomorrow.

I've added a demo y-gradient to the SkVMBlitter GM.

We may not need an explicit CTM parameter, just effects that chain into
each other changing (x,y) as they go?  I guess that depends on whether
we want to specialize blitters on the matrix type any more than how we
get the shader coordinates.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Iae28d169f611605ca6fbb8bcbcca6b67b103171c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252620
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-05 01:59:13 +00:00
Brian Osman
701522798a Fully embrace skcms types in SkColorSpace API
Remove the SkMatrix44 getter entirely.

Change-Id: I25bfe68a7a9b21d8a8696415b517cb79fc2d7a94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252596
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-04 21:22:38 +00:00
Michael Ludwig
cc836871cb Make SkBlendMode_AsCoeff() public
Change-Id: Ie704f0f83b1034ff8ee1a5d3cd194e555cae20a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252600
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-04 20:41:56 +00:00
Brian Salomon
85c3d68f25 Some improvements to backend texture creation.
This initializes more formats correctly with solid colors and relies
less on GrPixelConfig.

It also includes the changes to get gray8 read pixels working
and almost everything to initialize GL_RGB8 textures with data. Minor
stuff to follow to get RGB8 fully working and update test expectations.

Bug: skia:8962
Bug: skia:6718
Bug: skia:9358

Change-Id: Ic044b4c4badc37f14fb46c898cd3b3c21a6fc7fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251199
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-04 20:37:41 +00:00
Robert Phillips
e94cdd2dbc Use QuadHelper and PatternHelper in more places
Propagating usage of these helpers will, hopefully, improve code reuse and centralize future changes.

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

Bug: skia:9455
Change-Id: I9b46e42db8561d98fb724a41a1f7a3bec4bf97b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252484
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-04 20:32:36 +00:00
Herb Derby
790eff85a0 Fix fuzz bug in isValid for SkDescriptor
isValid read memory beyond the buffer that was uninitialized.

BUG=oss-fuzz:18555

Change-Id: I5576add2cd7bfbe146d495239b96210fe15fe562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252538
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-04 20:30:16 +00:00
Michael Ludwig
45a22819db Return coverage from inset() call instead of using a separate function.
This means we don't need to cache the coverage value calculated while
insetting.

Change-Id: Icf8b81f6fac04106ee4cd7d727e363ba0703474e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251766
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-04 19:50:27 +00:00
Mike Klein
2f3a020771 updateUniforms() just once
We're calling updateUniforms() much more often than necessary.
I think we need to only call it once, as we construct our Blitter.

The shader doesn't know about coverage formats, so the uniforms
will not change from blit??() to blit??() call.

Change-Id: Icd59b4a14101245fec9ad91b7dee2b3156675716
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252514
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-04 19:46:27 +00:00
Michael Ludwig
ba97189a3c Skip unnecessary moveTo in degenerate quad calculations
Change-Id: If73951f8e183101b80f729d9533cc3c8395b1879
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252481
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-11-04 17:38:44 +00:00
Peng Huang
3cfde4ef4d Make GrVkResource::Trace thread safe.
Bug: skia: None
Change-Id: I5fbbc9c885d8eb947682a043f66fd1ecf53a9ed6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250865
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-04 16:34:59 +00:00
Brian Osman
e36d030016 SkColorMatrix cleanup
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.

Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-04 15:20:15 +00:00
Robert Phillips
8e083eee8e Tighten up min and max vertex indices passed to GrTextureOp's meshes
Change-Id: Ie06c763f8677c395fdc4995bf78b9aff95040764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252192
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-01 21:46:51 +00:00
Michael Ludwig
3699a177bb Progress towards consolidating aa mask and edge distances
Change-Id: I47bd68532a68b7464ef6ed43733fef3d65792cfb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251762
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-01 21:05:11 +00:00
Ethan Nicholas
8633e4f304 Revert "Implement sample mask and sample locations support in Vulkan"
This reverts commit 8b915a0c27.

Reason for revert: Vulkan bot failures

Original change's description:
> Implement sample mask and sample locations support in Vulkan
> 
> Change-Id: I372695ec5360def42a8a997675993264740b0da4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I53023102009985e1e883c2a6a6ec4bfb18baf897
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252259
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-11-01 20:52:15 +00:00
Ethan Nicholas
8b915a0c27 Implement sample mask and sample locations support in Vulkan
Change-Id: I372695ec5360def42a8a997675993264740b0da4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252038
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2019-11-01 20:22:25 +00:00
Robert Phillips
e2e3a2fc57 Revert "Reduce max # of AA Quads that can be merged or chained into a single GrTextureOp"
This reverts commit 0a4681d044.

Reason for revert: Maybe the cause of red bots

Original change's description:
> Reduce max # of AA Quads that can be merged or chained into a single GrTextureOp
> 
> It is, arguably, not a good metric but the max number of AA Quads that are merged or chained together across all Skia's GMs and SKPs is 276.
> 
> This should also reduce the memory consumed from 245,760 bytes to 30,720 bytes.
> 
> Bug: b/143572065
> Change-Id: Ia70d3671fa33e0d84b38b4788e8c74ef98a9661e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252176
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Id38a1242327b853b494631d9fbc6f6d3f15d5aec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/143572065
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252193
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-01 19:08:26 +00:00
Stephen White
183fc99ad8 Dawn: update to recent texture proxy changes.
Change-Id: I8f2b862d5631f4c9a2e2653ebd498f401ed1f949
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252185
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-11-01 18:48:52 +00:00
Mike Klein
0393505a2d opaque shaders and srcover -> src
Program caching makes whether or not this is safe a little subtle.  It
is safe and I've tried to explain the subtlety in comments in the new
non-virtual Shader program() hook that forces all opaque shaders to
opaque, and in comments in SkVMBlitter where we make use of isOpaque().

I think this is the tidiest way to get the optimization and safety,
though it is a little awkward to have to write epic cross-referenced
comments explaining first why it might not generally be safe to use
shader->isOpaque() to make decisions in the blitter, and then how we
actually have made it really quite safe.

Many tiny partial-coverage diffs from how coverage interacts differently
with SrcOver and Src, SrcOver folding coverage into the src color before
blending with dst, Src just lerping with dst.

This all comes together really quite magically, changing a program to
draw a solid opaque color from this,

    11 registers, 41 instructions:
    r0 = uniform32 arg(0) 0
    r1 = splat FF (3.5733111e-43)
    r2 = extract r0 8 r1
    r3 = splat 80 (1.793662e-43)
    r4 = extract r0 24 r1
    r5 = sub_i32 r1 r4
    r6 = extract r0 16 r1
    r0 = extract r0 0 r1
    loop:
    r7 = load32 arg(1)
    r8 = extract r7 8 r1
    r8 = mul_i32 r8 r5
    r8 = add_i32 r8 r3
    r9 = shr_i32 r8 8
    r9 = add_i32 r8 r9
    r9 = shr_i32 r9 8
    r9 = add_i32 r2 r9
    r8 = extract r7 0 r1
    r8 = mul_i32 r8 r5
    r8 = add_i32 r8 r3
    r10 = shr_i32 r8 8
    r10 = add_i32 r8 r10
    r10 = shr_i32 r10 8
    r10 = add_i32 r6 r10
    r9 = pack r10 r9 8
    r10 = extract r7 16 r1
    r10 = mul_i32 r10 r5
    r10 = add_i32 r10 r3
    r8 = shr_i32 r10 8
    r8 = add_i32 r10 r8
    r8 = shr_i32 r8 8
    r8 = add_i32 r0 r8
    r7 = extract r7 24 r1
    r7 = mul_i32 r7 r5
    r7 = add_i32 r7 r3
    r10 = shr_i32 r7 8
    r10 = add_i32 r7 r10
    r10 = shr_i32 r10 8
    r10 = add_i32 r4 r10
    r10 = pack r8 r10 8
    r10 = pack r9 r10 16
    store32 arg(1) r10

to this,

    4 registers, 9 instructions:
    r0 = uniform32 arg(0) 0
    r1 = splat FF (3.5733111e-43)
    r2 = extract r0 8 r1
    r3 = extract r0 16 r1
    r2 = pack r3 r2 8
    r0 = extract r0 0 r1
    r1 = pack r0 r1 8
    r1 = pack r2 r1 16
    loop:
    store32 arg(1) r1

Change-Id: Ic1e2ac1496252970743ef44b17908965bc73e384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252198
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-01 18:31:35 +00:00
Mike Klein
4483c22ead get rid of Uniforms
Now that we've turned paint colors into shaders where appropriate,
SkVMBlitter's Uniforms struct is only really holding one byte of
coverage for when we're in RLE coverage mode.

We can just pass that coverage as its own uniform pointer, much like we
pass a pointer for masks.  This means there's no need to think about the
(notional) Uniforms struct any more, and leaves the first, main uniform
parameter holding shader uniforms exclusively.

Change-Id: I1c45d8c3280816836b011e22e07a666952a9df63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252080
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-01 18:19:05 +00:00
Michael Ludwig
e64c8bf477 Refactor tessellation metadata to move towards independent inset/outset calculations
Change-Id: Iaf1daad359cd7478ed42966bd65231ff108e602c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251661
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-01 18:16:35 +00:00
Mike Klein
9d0c67ab1b paint color -> shader
This means we can share programs with color shaders
whether they come through as a paint color or shader.

The GM now only ever JITs one program.

Change-Id: If61f9e7b79aa6b8fd1de7c16ff52f78bfd7dc4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252079
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-01 17:57:15 +00:00
Mike Klein
476061e4ce paint alpha scaling as its own effect
I'd like to express each of the special automatic features of the color
pipeline as their own effects in SkVMBlitter where possible.  This turns
the modulate-shader-by-paint-alpha feature into an explicit shader
wrapper.

This also sort of shows off how program() and uniforms() can chain
together.  This is the same basic form that SkColorFilterShader will
take, since scaling by alpha is basically a color filter.  (And indeed,
I may follow up by reformulating this as AlphaColorFilter once I get
color filters and SkColorFilterShader working with SkVMBlitter.)

Other next steps may involve factoring the pipeline's implicit
use-the-paint-color shader into an explicit shader.

Just FYI on the bug, thinking along its lines.

Bug: skia:9572
Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Ia9a5a10d685d2ca0a5e15792c7cf39d8b32a20a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252022
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-01 17:48:50 +00:00
Stephen White
40c47e113d Dawn: fix RTHeight adjustment.
When rendering to a BottomUp render target, the SRIR-V codegen
needs a uniform to pass the render target height. (This is kind
of hacky, since it depends on being the last uniform, but it's
the same hack that the Vulkan backend uses.)

Change-Id: I520478d5e26504c7884daa72024fafe943a07294
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252182
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2019-11-01 17:41:49 +00:00
Robert Phillips
0a4681d044 Reduce max # of AA Quads that can be merged or chained into a single GrTextureOp
It is, arguably, not a good metric but the max number of AA Quads that are merged or chained together across all Skia's GMs and SKPs is 276.

This should also reduce the memory consumed from 245,760 bytes to 30,720 bytes.

Bug: b/143572065
Change-Id: Ia70d3671fa33e0d84b38b4788e8c74ef98a9661e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252176
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-01 17:29:48 +00:00
Greg Daniel
524e28b88f Use GrSurfaceProxyView for dst proxies.
Bug: skia:9556
Change-Id: I41ae112a3d22f6c6481cba1afc3937b5e5115cf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252043
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-01 17:18:19 +00:00
Michael Ludwig
61eba6c74a Remove extraneous semicolons
This lets skia_renderer include SkBlendModePriv.h without breaking the
chrome build.

Change-Id: Icb96dbc50199c3a98bc7d5d2b643afda0297cf97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252178
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-01 16:12:04 +00:00
Mike Klein
2368bda0e1 try hashing shaders via their program
1) add a hash() method to skvm::Builder
     This is cheap... we're hashing instructions as we go anyway.
     Small refactoring to keep all its hashing close and clear.

  2) split Key into Key (a small bytey hashy identifier)
     and Params (a pointery typey payload struct)

  3) dummy call ->program() on shaders as we build our Key,
     and then include that dummy Builder's hash() in the key.

This lets us reuse cached programs when effects vary only in their
uniforms.  The approach in 3) is meant to be a first draft, a kind of
can-we-get-away-with-this hack.  We may need to change this with,
    - stronger equality than just a hash of the instructions;
    - a new cheaper hook that avoids the cost of skvm::Builder.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I5f3839d3f7de40043fcb6177b617672c56f0eb70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252019
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-01 15:32:44 +00:00
Brian Osman
2b73e66ca5 Add BT2020 (non-constant-luminance) YUV color space
Change-Id: I8ef13b78a5f2f49ff9c59db285b3e0e7ee708c9b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-01 14:34:13 +00:00
Brian Osman
25feadb636 Remove SK_LEGACY_YUV_MATRICES
Chrome has been rebaselined:
https://chromium-review.googlesource.com/c/chromium/src/+/1893372

Change-Id: Iff21ca606bf2e5fa0b8946940cab0b06fbd11e47
Bug: skia:9543
Change-Id: Iff21ca606bf2e5fa0b8946940cab0b06fbd11e47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252158
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-01 14:21:01 +00:00
Robert Phillips
fd0c3b513e Update GrTextureOp to use index buffer offsets for draws
This should, hopefully, be faster on GL as we will only need to update the index-range for a draw rather than the offset into an vertex buffer.

Change-Id: I09e54c37262168661443fa8bf8d3b43cd8faa9db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251757
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-01 14:09:43 +00:00
Emircan Uysaler
283ec65f63 Handle all failures for vkWaitForFences
Bug: chromium:1019469
Change-Id: Ic32be65775cf6b7d3261d1d8b4076363d0e65874
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251821
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-31 20:23:50 +00:00
Herb Derby
f5ad3f421e Fast SkPackedGlyphID CTOR
Performance measurments showed that SkPackedGlyphID was too much
time.

SkDiffBench-lorem_ipsum 955µs -> 873µs

BUG=chromium:881505

Change-Id: I8d42f02d87817777cc7c95404c73c723f0bc100c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251818
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-31 20:11:20 +00:00
Michael Ludwig
b4577fb2cf Use point to line distance instead of area for colinear check
Bug: chromium:1018218
Change-Id: I9a33332a06a63075dd016f038d5cd4ede59f9a5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252042
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-10-31 19:56:50 +00:00
Herb Derby
ce8adae49e ...finally!
Change-Id: I31e9f0a06cf5541fe7b65924bfde85ee119b499e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252037
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-31 18:43:22 +00:00
Michael Ludwig
fb7ba52344 Move tessellation math into GrQuadUtils
Change-Id: I133fb0d5e154c2f01aba7ef2a7e1b87b6089a608
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251460
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-10-31 17:30:33 +00:00
Hal Canary
7823aeb8d6 refactor/layering: SkMalloc.cpp
Change-Id: Ie27c9f0ba2b9f160010d33548dc8359851610d79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251819
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-31 15:49:03 +00:00
Mike Klein
2eae8e53ba only scale shader by paint alpha < 1
This adds `shader && paint alpha < 1.0f` to the blitter Key, so we'll
generate and cache two different programs based on that bit.

I put a little bit of effort into a different approach, wrapping the
shader with a new shader that modulates by paint alpha when paint alpha
is less than one.  This should work, but I realized that it would break
caching, since we're caching based on shader identity.  (Not really
break, but make it ineffective.)

I've added some notes about cache keys in general, and that this wrapper
approach would make caching less effective is I think enough to make me
want to work out a "identify yourself except for uniforms" protocol for
shaders (really effects, eventually color filters will need it too).

Change-Id: I1a2a490657bf7442e79f87d80968302720265f7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251775
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-31 15:27:53 +00:00
Mike Klein
e2333d7714 fix uniform buffer size, scale by paint alpha
Brace initilaization of a std::vector was starting our uniform buffer
out as a single byte, holding sizeof(Uniforms).  I meant it to be
sizeof(Uniform) bytes, all zero...

That's fixed here, and was why scaling by paint alpha wasn't working.

Change-Id: Iad30d701aa175c74c9c5aaed8baf8279479188b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251753
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-10-31 15:22:33 +00:00
Brian Osman
904cac8567 Use SkYUVMath in GrYUVtoRGBEffect
Removes another redundant set of YUV matrices, and probably fixes errors
in the Rec.601 and Rec.709 matrices (they appear to have had incorrect
bias values based on 128 / 255 being zero).

Matrix changes affect layout tests, so guarding this in chromium:
https://chromium-review.googlesource.com/c/chromium/src/+/1890956

Change-Id: I3699a00c93eb10a9da14c881bfd338ce98249c7d
Bug: skia:9543
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251771
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-31 13:20:33 +00:00
Greg Daniel
549325c87e Have GrTextureOp use GrSurfaceProxyViews instead of just proxys.
Additionally updated some calls upstack to pass in the views.

Bug: skia:9556
Change-Id: I2b6274cb1811b102713433d51a9b18d47778174a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251759
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-30 21:16:58 +00:00
Herb Derby
e785c44c08 Remove unused API
Change-Id: Iddfe56c2c97ac27ccf446a3cbdbfa8ffde62d1e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251772
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-30 21:02:29 +00:00
Brian Osman
28ba52845b Use SkYUVMath in asyncRescaleAndReadPixelsYUV420
Cuts down on the number of places that have redundant YUV matrices.
Also, there appears to have been a typo in the Rec709 matrix, so this
fixes that.

Change-Id: I91f2c772656095c52f53e09b1de04908f268fbb7
Bug: skia:9543
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251767
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-30 20:20:59 +00:00
Brian Osman
6e1d51a2c7 Print out a warning if trying to use a cross context image on two contexts
Change-Id: Ie4611b4aae65aed5aa45be8841fbb7326bcfbf0b
Bug: skia:9581
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251773
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-30 20:07:48 +00:00