Commit Graph

7419 Commits

Author SHA1 Message Date
Chris Dalton
b0fd4b12a1 Reland "Revert "Revert "Rename gl_SampleMask to sk_SampleMask"""
This is a reland of 4ac37632a8

Original change's description:
> Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
> 
> This reverts commit 40b815db97.
> 
> Bug: skia:
> Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:
Change-Id: Ia343e9e1008ca2354e1d300030e763f3c578d71c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251441
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-10-29 21:01:52 +00:00
Nigel Tao
a1cc9f6b84 Test Codec::getFrameCount updates with more data
This mimics Chromium's
TestResumePartialDecodeAfterClearFrameBufferCache, which expects the
frame count to increase as more data comes in, even if the decoder is in
the middle of an incremental decode:

https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc?l=365&rcl=23787ba147959ebf4ad168c595d5ec87919fdbd2

Bug: skia:8235
Change-Id: Icc19ebea6d77f6b6fb62e3b2ff0c2ffb1ef0950d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250476
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2019-10-29 20:15:36 +00:00
Brian Osman
5f95519d54 Use GPU special images in two GPU image filter tests
We were always testing the CPU backend.

Bug: skia:9582
Change-Id: I25ff1dc151c1be8a31ab09008393430a1fa85221
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251457
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-29 19:59:49 +00:00
Greg Daniel
16f5c65a0a Use GrSurfaceProxyView in RenderTasks.
Bug: skia:9556
Change-Id: Ibe0ae6981e87909848e5af73fc716aac7c8a591f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249232
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-10-29 15:53:59 +00:00
Robert Phillips
d4b95d213d Revert "Implement refPinnedTextureProxy for SkImage_Lazy."
This reverts commit 1e0f2f389f.

Reason for revert: I suspect this is blocking the Chrome roll

Original change's description:
> Implement refPinnedTextureProxy for SkImage_Lazy.
> 
> Creating a cross-context texture exposed a hole in our lazyproxy
> texture generation. Despite having a wrapped texture we were falling
> back to drawing in tiled mode, which is incorrect. Filling in these
> methods allows us to draw with the wrapped texture.
> 
> Bug: skia:9562
> Change-Id: Ia26c5d75b202aefdf720e6d1f7a201af23e40676
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251214
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: I2dd6f2cbe13dd3ac1f65890da366171572fb84e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251356
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-29 12:40:06 +00:00
Jim Van Verth
1e0f2f389f Implement refPinnedTextureProxy for SkImage_Lazy.
Creating a cross-context texture exposed a hole in our lazyproxy
texture generation. Despite having a wrapped texture we were falling
back to drawing in tiled mode, which is incorrect. Filling in these
methods allows us to draw with the wrapped texture.

Bug: skia:9562
Change-Id: Ia26c5d75b202aefdf720e6d1f7a201af23e40676
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251214
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-28 20:28:33 +00:00
Brian Osman
9ead6c7400 Guard against integer overflow when classifying transfer functions
Bug: chromium:1016183
Change-Id: I2fa470db3690f79d83fd17b01e421e7457f7c725
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251246
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-28 20:18:23 +00:00
Greg Daniel
1e058a5380 Reland "Revert "Rename gl_SampleMask to sk_SampleMask""
This reverts commit 4ac37632a8.

Reason for revert: Failing assert, "assert(fProgram.fSettings.fCaps->sampleVariablesSupport())" on some bots

Original change's description:
> Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
> 
> This reverts commit 40b815db97.
> 
> Bug: skia:
> Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I1fe9e2bb0d9f921f7d66e4a4707c21dd5c923586
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251248
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-28 19:28:25 +00:00
Ethan Nicholas
4ac37632a8 Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
This reverts commit 40b815db97.

Bug: skia:
Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-10-28 18:47:52 +00:00
Brian Salomon
3683a4f5ae Remove legacy async read pixels APIs.
Chrome is now using the newer version.

Bug: skia:8962
Change-Id: I8c38bde63e1e032281d19b0cc7cb8cf301061a9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251198
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-10-28 17:28:53 +00:00
Emircan Uysaler
7697476ad2 Disable async readback from protected memory
Reading back pixel values from protected memory into cpu memory is
not allowed. This CL adds early returns so they are not attempted.

Bug: skia:9016, fuchsia:38648
Change-Id: Icc0b51a62e87b7aebd0e7cb2a061fea084e7f754
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-25 20:02:01 +00:00
Herb Derby
f5e9b42ef0 Change from single prepareForDrawing to prepare[Mask|SDFT|Path]ForDrawing
This produces much simpler logic, and sets up for a massive simplification
of the diff canvas. You can see the ultimate changes in:

https://skia-review.googlesource.com/c/skia/+/238196

Change-Id: I92100bdccb80d0b6f7864435213c29a159e0caaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250039
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-25 19:35:09 +00:00
Brian Salomon
28a8f28b3e Rename functions in TestUtils.h
Change-Id: Iaa8a4ac57e967c6429473fb3a738d377a47fc2c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250799
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-25 00:36:28 +00:00
Herb Derby
95ea4c4c9e Change code() to glyphID() on SkGlyph.
Change-Id: Id13cd5039df7ff3042858c8c89a2dc629b589d3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244998
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-24 20:00:29 +00:00
Brian Salomon
557e812779 Make GrSurfaceProxy ref counts thread safe.
Bug: chromium:1008312

Change-Id: I90525db25ee61aeb8f03abc7569d8e4224df1497
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250576
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-24 19:55:23 +00:00
Jim Van Verth
5a8f3e4aac Reland "Enable Programs (formerly GLPrograms) test for other APIs"
This is a reland of 598741667a

Original change's description:
> Enable Programs (formerly GLPrograms) test for other APIs
> 
> Bug: skia:9365
> Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Bug: skia:9365
Change-Id: I94db6cb2b1465edbb2e6d32708b835a76e12cbc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250016
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-24 19:53:25 +00:00
Hal Canary
e107faa062 SkRemoteGlyphCache Add tracing to diff canvas
Use `extra_cflags=["-DSK_CAPTURE_DRAW_TEXT_BLOB"]` to enable.

Change-Id: I1d6db478ee91696cdce090647b889c17a83a2718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250259
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-24 17:09:31 +00:00
Herb Derby
4a1af26f1a Fix fuzzer bug in SkDescriptor::isValid
This is following up chrome bug:
https://bugs.chromium.org/p/chromium/issues/detail?id=996211

BUG=skia:18491

Change-Id: I4c85bc916903aaa2fdf7eb226bdf3e57f8b1c66c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250578
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-24 16:33:52 +00:00
Brian Salomon
5918e8313b Rewrite ReadPixels_Gpu test to be more exhaustive and share code.
Implementation is shared with with AsyncReadPixels.

Change-Id: If40705e96cc7fb073ab6024ab59819784c8be0ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244717
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-23 18:06:03 +00:00
Robert Phillips
e9462dd2da Rename *worstCase* to backingStore* in GrSurfaceProxy
These names are more appropriate after:

https://skia-review.googlesource.com/c/skia/+/241356 (Always create an approx-size texture for approx-fit proxies))

Note that this CL does have one substantive change in GrCoordTransform::hasSameEffectAs where we use our knowledge of the size at which the backing stores will be allocated to remove a sly usage of GrSurfaceProxy::underlyingUniqueID.

Change-Id: Ibbb8cb23c4503f267abbdf4794610f3262a6f515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250257
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-10-23 17:15:01 +00:00
Robert Phillips
40b815db97 Revert "Rename gl_SampleMask to sk_SampleMask"
This reverts commit 23716d42f7.

Reason for revert: red bots and GMs

Original change's description:
> Rename gl_SampleMask to sk_SampleMask
> 
> Change-Id: I3924c6f76edf310a984e4fd89478b00eeec69722
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249931
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I74848e95972cf2c41cc28887e26214136ce79e08
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250180
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-23 12:28:48 +00:00
Mike Klein
d48488b5ea reorder to minimize register pressure
Rewrite program instructions so that each value becomes available as
late as possible, just before it's used by another instruction.  This
reorders blocks of instructions to reduce them number of temporary
registers in flight.

Take this example of the sort of program that we naturally write,
noting the registers needed as we progress down the right:

    src = load32 ...          (1)
    sr = extract src ...      (2)
    sg = extract src ...      (3)
    sb = extract src ...      (4)
    sa = extract src ...      (4, src dies)

    dst = load32 ...          (5)
    dr = extract dst ...      (6)
    dg = extract dst ...      (7)
    db = extract dst ...      (8)
    da = extract dst ...      (8, dst dies)

    r = add sr dr             (7, sr and dr die)
    g = add sg dg             (6, sg and dg die)
    b = add sb db             (5, sb and db die)
    a = add sa da             (4, sa and da die)

    rg   = pack r g ...       (3, r and g die)
    ba   = pack b a ...       (2, b and a die)
    rgba = pack rg ba ...     (1, rg and ba die)
    store32 rgba ...          (0, rgba dies)

That original ordering of the code needs 8 registers (perhaps with a
temporary 9th, but we'll ignore that here).  This CL will rewrite the
program to something more like this by recursively issuing inputs only
once needed:

    src = load32 ...       (1)
    sr  = extract src ...  (2)
    dst = load32 ...       (3)
    dr  = extract dst ...  (4)
     r  = add sr dr        (3, sr and dr die)

    sg  = extract src ...  (4)
    dg  = extract dst ...  (5)
     g  = add sg dg        (4, sg and dg die)

    rg  = pack r g         (3, r and g die)

    sb  = extract src ...  (4)
    db  = extract dst ...  (5)
     b  = add sb db        (4, sb and db die)

    sa  = extract src ...  (4, src dies)
    da  = extract dst ...  (4, dst dies)
     a  = add sa da        (3, sa and da die)

    ba  = pack b a         (2, b and a die)

    rgba = pack rg ba ...  (1, rg and ba die)
    store32 rgba  ...      (0)

That trims 3 registers off the example, just by reordering!
I've added the real version of this example to SkVMTest.cpp.
(Its 6th register comes from holding the 0xff byte mask used
by extract, in case you're curious).

I'll admit it's not exactly easy to work out how this reordering works
without a pen and paper or trial and error.  I've tried to make the
implementation preserve the original program's order as much as makes
sense (i.e. when order is an otherwise arbitrary choice) to keep it
somewhat sane to follow.

This reordering naturally skips dead code, so pour one out for ☠️ .
We lose our cute dead code emoji marker, but on the other hand all code
downstream of Builder::done() can assume every instruction is live.

Change-Id: Iceffcd10fd7465eae51a39ef8eec7a7189766ba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-22 21:49:05 +00:00
Chris Dalton
23716d42f7 Rename gl_SampleMask to sk_SampleMask
Change-Id: I3924c6f76edf310a984e4fd89478b00eeec69722
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249931
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-10-22 20:36:00 +00:00
Brian Salomon
2638f3d44b rename atlassize->atlasdimensions
Change-Id: I0262ed26f0b3523302bbb4e94dfca94d120fc70c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249980
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-22 16:57:01 +00:00
Robert Phillips
61fc799759 Add creation-time POD memory pool for GrOps
This CL begins pulling some of the work forward into onPrePrepare.

Change-Id: If049e0662db51b465b8b82aafebeef2323bddfd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249802
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-22 16:35:41 +00:00
Michael Ludwig
6387dc19f6 Revert "Enable Programs (formerly GLPrograms) test for other APIs"
This reverts commit 598741667a.

Reason for revert: segfaults on Pixel bots

Original change's description:
> Enable Programs (formerly GLPrograms) test for other APIs
> 
> Bug: skia:9365
> Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: I286c637490bb8a21c0020a8935ce4c850b98f6b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9365
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249978
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-10-22 15:39:49 +00:00
Brian Salomon
9f2b86c54d More SkISizification in GPU code.
Uses SkISize instead of separate width/height variables in many places.

No functional change.

Change-Id: If87b2c57e43d810f0820c4e3c9ef8e6b8ebd10ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249886
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-22 15:04:07 +00:00
Jim Van Verth
598741667a Enable Programs (formerly GLPrograms) test for other APIs
Bug: skia:9365
Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-22 14:36:09 +00:00
Brian Salomon
4eda7108a2 Simplify sk_gpu_test::MakeTextureProxyFromData.
Make it take GrImageInfo.

Change-Id: I9ec16e9b935fbe3e829b4669f715c17873a1793a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249813
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-21 20:04:37 +00:00
Hal Canary
c056e169ea SkPDF: simplify Producer metadata logic
Bug: skia:9552
Change-Id: Ifa199048e6d38ccb28f055b77128971411203188
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249800
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-10-21 20:01:47 +00:00
Michael Ludwig
c89d1b56e5 Rename SkDevice::ctm() to localToDevice()
This helps differentiate the SkCanvas' total CTM
(canvas transform matrix), from the device-specific transform matrix
that maps draws from local to device space.

Bug: 9545
Change-Id: I67f40d9b1bc92377bf0520fbc9245f1058e179e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249424
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-18 18:04:31 +00:00
Robert Phillips
6c2aa7af0b Revert "Reduce inputs to GrProgramDesc::Build method(s)"
This reverts commit 63a3873957.

Reason for revert: fail

Original change's description:
> Reduce inputs to GrProgramDesc::Build method(s)
> 
> This moves the computation of the GrStencilSettings into GrProgramDesc::Build for the Vulkan backend
> 
> This makes it clear that the stencilSettings are determined by the GrProgramInfo.
> 
> Note that this does change some behavior in that the number of stencil bits is now determined (and set up for) the number requested not the number actually available on the attached stencil buffer at flush time.
> 
> Bug: skia:9455
> Change-Id: Ia5fa4e30e34952c1a492b8d571094abf2291b2a4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248696
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ib0b337c19acea8000b5592f3dfeda181fd6ef157
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-17 19:06:52 +00:00
Robert Phillips
63a3873957 Reduce inputs to GrProgramDesc::Build method(s)
This moves the computation of the GrStencilSettings into GrProgramDesc::Build for the Vulkan backend

This makes it clear that the stencilSettings are determined by the GrProgramInfo.

Note that this does change some behavior in that the number of stencil bits is now determined (and set up for) the number requested not the number actually available on the attached stencil buffer at flush time.

Bug: skia:9455
Change-Id: Ia5fa4e30e34952c1a492b8d571094abf2291b2a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248696
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-17 18:32:40 +00:00
Herbert Derby
d7689d434c Reland "Introduce SkGlyphSourceBuffer"
This is a reland of 77c53087c1

Original change's description:
> Introduce SkGlyphSourceBuffer
>
> SkGlyphSourceBuffer provides a system for taking rejected glyphs from
> one glyph drawing stage, and turns them into the source for the next stage.
> It is rarely used, so it tries to conserve memory.
>
> Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

Change-Id: Ib90508a21993b12c71ee86cbdeb51c4d4c2ec913
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249128
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-17 17:26:37 +00:00
Mike Klein
97afd2e21c add bsl.16b, cmeq.4s, cmgt.4s
These implement select, eq_i32, lt_i32, and gt_i32 on ARMv8.

Change-Id: Ic36dda1cc425ca91700f9b120594e420ea0f560a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248970
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-17 01:54:33 +00:00
Herb Derby
f29cb70281 Revert "Introduce SkGlyphSourceBuffer"
This reverts commit 77c53087c1.

Reason for revert: Breaks some windows builds

Original change's description:
> Introduce SkGlyphSourceBuffer
> 
> SkGlyphSourceBuffer provides a system for taking rejected glyphs from
> one glyph drawing stage, and turns them into the source for the next stage.
> It is rarely used, so it tries to conserve memory.
> 
> Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: I4270d092f8daba3dddcadd6abbed10f14bf57490
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249077
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-16 21:28:35 +00:00
Robert Phillips
1dfc77cc08 Add unit test to exercise GrTextureFreed message handling after a context abandon
Bug: 1011368, 1014993
Change-Id: Ie9f7be15b321daa05fcac8109a24e42810f10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249008
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-16 21:11:12 +00:00
Herbert Derby
77c53087c1 Introduce SkGlyphSourceBuffer
SkGlyphSourceBuffer provides a system for taking rejected glyphs from
one glyph drawing stage, and turns them into the source for the next stage.
It is rarely used, so it tries to conserve memory.

Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-16 20:55:32 +00:00
Robert Phillips
ddc21485cb Work around un-safe downcast in PromiseLazyInstantiateCallback destructor after a context abandon
90% of this CL is just renaming. The only two substantive changes are:
   holding a GrTexture* (rather than a GrGpuResource*) in the GrTextureFreedMessage (this avoids the downcast)
   adding the abandoned() checks to the two GrContext::purgeUnlockedResources methods (this prevents accesses of the message queue)

Bug: 1011368, 1014993
Change-Id: Ifff3842f7802add6b7cd34595578369543698ba1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249001
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-16 19:24:03 +00:00
Brian Osman
11e6aa823d Starting to hack up HDR transfer function support
Brings over skcms' encoding scheme, etc.

Change-Id: Ib8abec911acd1c50df3b201b4a9bde01b1cb123b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249000
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-16 18:40:16 +00:00
Mike Klein
0f61c12737 add used_in_loop bit to skvm::Builder::Instruction
Most hoisted values are used in the loop body (and that's really the
whole point of hoisting) but some are just temporaries to help produce
other hoisted values.  This used_in_loop bit helps us distinguish the
two, and lets us recycle registers holding temporary hoisted values not
used in the loop.

The can-we-recycle logic now becomes:
   - is this a real value?
   - is it time for it to die?
   - is it either not hoisted or a hoisted temporary?

The set-death-to-infinity approach for hoisted values is now gone.  That
worked great for hoisted values used inside the loop, but was too
conservative for hoisted temporaries.  This lifetime extension was
preventing us from recycling those registers, pinning enough registers
that we run out and fail to JIT.

Small amounts of refactoring to make this clearer:
   - move the Instruction hash function definition near its operator==
   - rename the two "hoist" variables to "can_hoist" for Instructions
     and "try_hoisting" for the JIT approach
   - add ↟ to mark hoisted temporaries, _really_ hoisted values.

There's some redundancy here between tracking the can_hoist bit, the
used_in_loop bit, and lifetime tracking.  I think it should be true, for
instance, that !can_hoist && !used_in_loop implies an instruction is
dead code.  I plan to continue refactoring lifetime analysis (in
particular reordering instructions to decrease register pressure) so
hopefully by the time I'm done that metadata will shake out a little
crisper.

Change-Id: I6460ca96d1cbec0315bed3c9a0774cd88ab5be26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248986
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-16 18:29:06 +00:00
Mike Klein
b5a30767e0 Reland "mark which SkVM tests should JIT or not"
This is a reland of 52435503e9

with better checks for when we should expect JIT and not.

Original change's description:
> mark which SkVM tests should JIT or not
>
> Most of these tests converted over to test_interpreter_only()
> are failing to JIT because of unimplemented instructions.  No
> bug there, just TODOs.
>
> But SkVM_hoist _should_ be JITting.  A while back I landed a CL
> that messed with value lifetimes that prevents it from JITting.
> Will be using this as a regression test to fix that bug.
>
> Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

Cq-Include-Trybots: skia.primary:Test-Android-Clang-NVIDIA_Shield-CPU-TegraX1-arm64-Release-All-Android,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_CPU_LIMIT_SSE2,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_CPU_LIMIT_SSE41,Test-Mac10.13-Clang-VMware7.1-CPU-AVX-x86_64-Debug-All-NativeFonts,Test-Mac10.14-Clang-VMware7.1-CPU-AVX-x86_64-Debug-All-NativeFonts
Change-Id: Id7bde7e879649e435fa424a9c9d6c51a31afd5e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248990
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-16 17:35:06 +00:00
Mike Klein
4e11526e3d Revert "mark which SkVM tests should JIT or not"
This reverts commit 52435503e9.

Reason for revert: lots of bots can't JIT, duh...

Original change's description:
> mark which SkVM tests should JIT or not
> 
> Most of these tests converted over to test_interpreter_only()
> are failing to JIT because of unimplemented instructions.  No
> bug there, just TODOs.
> 
> But SkVM_hoist _should_ be JITting.  A while back I landed a CL
> that messed with value lifetimes that prevents it from JITting.
> Will be using this as a regression test to fix that bug.
> 
> Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

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

Change-Id: Ieea4b06f0d32249e3da56c6810d3c45c2abf2689
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248989
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-16 16:48:58 +00:00
Mike Klein
52435503e9 mark which SkVM tests should JIT or not
Most of these tests converted over to test_interpreter_only()
are failing to JIT because of unimplemented instructions.  No
bug there, just TODOs.

But SkVM_hoist _should_ be JITting.  A while back I landed a CL
that messed with value lifetimes that prevents it from JITting.
Will be using this as a regression test to fix that bug.

Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-16 15:45:16 +00:00
Lee Salzman
634d15032d fix SkTextBlob::getIntercepts regression no longer considering glyph vertical offset
As of revision 7924d9a4ae (https://skia-review.googlesource.com/c/skia/+/222277), SkTextBlob::getIntercepts no longer considers each glyph's vertical offset. So getIntercepts will only work properly if each glyph has a vertical offset of 0. This patch restores the original behavior of offsetting the bounds from each glyph's position.

Without this fix, Firefox has no way to implement proper intercepts for underlining decorations when glyphs are offset...

Change-Id: I06fc4b63bd57c9d70e3b07a95ead69f3caa8b33a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248724
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Lee Salzman <lsalzman@mozilla.com>
2019-10-16 00:02:08 +00:00
Greg Daniel
c594e62698 Plumb GrColorType through all ops/processors that sample textures.
This change also allows for the remove of GrPixelConfigIsOpaque function.

Bug: skia:6718
Change-Id: I7e7b70f02d911eda67640d648fb6348091e0f55d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248698
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-15 18:34:37 +00:00
Robert Phillips
7d7aaf46ae Slim down GrFragmentProcessor::TextureSampler and GrPrimitiveProcessor::TextureSampler
I'm gearing up to add a GrBackendFormat to GrPrimitiveProcessor::TextureSampler so this CL just reduces the API surface area I'll need to alter.

The GrFragmentProcess::TextureSampler changes just keep it aligned with its "twin".

Change-Id: Ia9ece03ca76b4f6c8ebdaf0e0ba0061ecde6c5f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248558
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-14 19:48:19 +00:00
Greg Daniel
a4828a13c2 Remove GrPixelConfigIsAlphaOnly call and transition calls to it.
Bug: skia:6718
Change-Id: I4d9c31bc0ca42a80e652de29462531587efef031
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248257
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-14 13:49:14 +00:00
Hal Canary
3d49d08660 SkPDF/tests: add regression test for crbug/494913
Bug: chromium:494913
Bug: skia:9508
Change-Id: I8793fa32b8c4d38b58ec1814b35187ddfc246916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248256
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-11 18:17:54 +00:00
Herbert Derby
0be4c2cb86 Introduce SkGlyphDrawableBuffer
Used for efficient glyph id to glyph lookup.

This is part of a larger change:
https://skia-review.googlesource.com/c/skia/+/238196

Change-Id: Ifce43879685bf0d760a7e12dceb32f7a650be687
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247340
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-11 15:40:24 +00:00
Greg Daniel
7fd7a8aef0 Remove uses of GrPixelConfig version of GrBytesPerPixel.
Bug: skia:6718
Change-Id: I8421f38644567973f0b8de29b745ca9a471583bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247598
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-10 20:39:05 +00:00
Robert Phillips
2d8a95ee71 Add "meshCount" to GrProgramInfo
This improves the encapsulation of the GrProgramInfo class.

Bug: skia:9455
Change-Id: Ic241ba4a2c2edea3e774522065371e5ed8cc2da3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247438
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-10-10 17:18:15 +00:00
Jim Van Verth
ce3cf804f1 Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths unless specifically requested to
support perspective SDF.

Bug: skia:9515
Change-Id: I75ac1d60f2eaa0e63de201b5db36fe0485fff463
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247398
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-10 15:35:51 +00:00
Herb Derby
d543fbbd6f Revert "Draw perspective text as paths."
This reverts commit 76826fc91c.

Reason for revert: Missing some characters

Original change's description:
> Draw perspective text as paths.
> 
> Perspective glyphs can vary in screen size so it's unclear which SDF
> level is best, and even if we choose one for an entire subrun it's
> possible that a given glyph will have artifacts if it's too big.
> Instead we fall back to paths.
> 
> Bug: skia:9515
> Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

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

Change-Id: I5e39566c35b49323913eb72ff89ecbc91faac8ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247462
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-09 23:46:28 +00:00
Jim Van Verth
76826fc91c Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths.

Bug: skia:9515
Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-10-09 20:53:20 +00:00
Robert Phillips
901aff018b Add GrProgramInfo to centralize management of program information
This is the first step in moving the marshaling of program information earlier in renderTask processing (i.e., to onPrePrepare).

Change-Id: I91e3baed9a128e845bd32f9dbbacd9b21d852a3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244118
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-08 20:35:51 +00:00
Herbert Derby
5899485b9a Add tests for SkZip first, data, and consting copy ctor
Change-Id: Ibc8a6a856c448f03c9e3860a3fb7391c407289dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247038
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-08 15:45:30 +00:00
Fredrik Söderquist
d1ed56e4be Fix mapping the morphology filter's radius when the CTM is a mirror op
When the CTM contained a "mirroring" operation - for example
scale(-1, 1) or scale(1, -1) - the radius of the morphology filter would
end up negative, essentially disabling the filter.
When mapping the radii, use the magnitude of a vector built from each
component of the radii instead of considering the radii as a plain
vector.

Bug: chromium:595244
Change-Id: Ia249f8962648f0a4e69b6d0becf87ee1ba6be9a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246996
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-08 14:34:57 +00:00
Julia Lavrova
f3ed273b32 Adding line/style metrics
Fixed some bugs for flutter tests

Change-Id: I43f4b4b185152a8d642127370da5f80fb96f1e9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239444
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-07 15:07:48 +00:00
Robert Phillips
405413fcec Clarify that the OpArgs' outputSwizzle comes from its GrRenderTargetProxy
Since we want to collect shader information early, this attempts to make clear that numSamples, origin and outputSwizzle can all be obtained from the target renderTargetProxy.


Change-Id: I42e0fd79e2163f17673ccdd344a31fbaadac5f53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246298
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-04 18:03:32 +00:00
Michael Ludwig
05a777d442 Define coord space tagged geometry for image filters v2.
This is an alternative approach to https://skia-review.googlesource.com/c/skia/+/234896

It inverts the templates and coordinate spaces, so that each coordinate space is
defined by a struct that accepts the SkIRect/etc. type as an argument. For parameter
space and device space, the only exposed functionality is holding on to the coordinates
and moving into and out of the layer space (using the Mapping type, which now encapsulates
the definition of parameter, layer, and device space for a given CTM).

The LayerSpace struct has specialized definitions for each of the 6 key geometric types,
exposes accessors/mutators and operations like join/intersect that work on appropriate
layer-space geometry.

FilterResult and Context have been updated to use these new types, although they no
longer take a Usage enum. If this strategy works, FilterResult will be updated to have
more utilities to operate and read from its image in layer-space so there won't be a need
to have the image space (and the usage enum to differentiate between different image
spaces).

To further reinforce the differences between getInputBounds() and getOutputBounds() (which
previously used Usage to do this), they now accept/return values in device and parameter
space. This is no different than what SkCanvas would have done before calling the old
functions, but now that work is owned by SkImageFilter (seems like a good thing), and
achieves the same reinforcement.

Change-Id: I8bebb9fadf6c8f2bd51fa863b2d6f2e4a33dd08b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244515
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-04 16:40:00 +00:00
Mike Reed
a32654c13a Simple iterator for textblobs
bug: skia:9503

Change-Id: I5b4e2434c6085d048d6d0fc42b2b928439b1066b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246296
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-04 14:44:19 +00:00
Brian Salomon
9241a6d394 Reland "Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime""
This is a reland of 6fc04f88a8

Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
> 
> This is a reland of ce240cc6fd
> 
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> > 
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> > 
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> > 
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> > 
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> > 
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> > 
> > Bug: chromium:973403
> > Bug: skia:8962
> > 
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> 
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:973403, skia:8962
Change-Id: Ie584c1c3ef8021c976f71b708e53871c693cc450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246057
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-03 19:14:22 +00:00
Brian Osman
c95c4a69e1 Remove old SkSL JIT and cleanup include files a bit
- The raster pipeline JIT was an experiment that never really panned
  out (except for also introducing the interpreter, which survives).
  The removal should be pretty thorough, including undoing some changes
  to SkRasterPipeline itself. For reference, I basically undid most of
  https://skia-review.googlesource.com/c/skia/+/112204/

- With runtime shaders, always convert to Program using kPipelineStage
  This makes the first-pass compile consistent with runtime color filter,
  and with GrSkSLFP.

- Remove sksl_mixer.inc, which hasn't been used in a while.

- In sksl_pipeline.inc, all of the math symbols are already declared
  in sksl_gpu.inc, which forms the base symbol table when this include
  is parsed.

  sk_x and sk_y appear to never be used? Those builtin IDs are the IDs
  of the x and y params to main, but that logic still works without
  these declarations.

  sk_OutColor only makes sense in FP files (it's still declared in
  sksl_fp.inc).

Change-Id: Ie8dd68d2c4687745d46f96804a76695bce8c1ba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246017
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-03 18:00:40 +00:00
Robert Phillips
a975ef3b2f Add SkSurfaceCharacterization::createColorSpace
Change-Id: Ie4653fce34e4d6f38613f63bc68ecc1b7bae361b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246019
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-03 17:06:13 +00:00
Ravi Mistry
cb55010652 Revert "Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime""
This reverts commit 6fc04f88a8.

Reason for revert: Chrome roll failure suspect because of:
* https://chromium-review.googlesource.com/c/chromium/src/+/1837131 (22 commits)
* https://chromium-review.googlesource.com/c/chromium/src/+/1837214 (24 commits)

Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
>
> This is a reland of ce240cc6fd
>
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> >
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> >
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> >
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> >
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> >
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> >
> > Bug: chromium:973403
> > Bug: skia:8962
> >
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I9e01d1b82fb399b94292441d91da51176bb161d9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245956
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
2019-10-03 09:19:24 +00:00
Brian Salomon
6fc04f88a8 Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
This is a reland of ce240cc6fd

Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
> 
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
> 
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
> 
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> 
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
> 
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
> 
> Bug: chromium:973403
> Bug: skia:8962
> 
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:973403, skia:8962
Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-03 01:41:35 +00:00
Brian Salomon
9c219785a8 Revert "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
This reverts commit ce240cc6fd.

Reason for revert: crashing in chrome unit test, abandoned context related?

Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
> 
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
> 
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
> 
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> 
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
> 
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
> 
> Bug: chromium:973403
> Bug: skia:8962
> 
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ic14cf07a7629b167c9f34a651aa87a0326e74207
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245721
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-02 22:51:15 +00:00
Brian Salomon
ce240cc6fd SkSurface asynchronous read APIs allow client to extend pixel lifetime
Previously the pixel data passed to the client was only valid during
the client's callback. This meant if the client wanted to defer
processing of the data a copy was necessary.

Now we pass an object to the callback and the pixel lifetime is tied
to the lifetime of that object.

The object may be holding a GPU transfer buffer mapped. We don't assume
that the object will be released on the direct GrContext thread. So
when the object is destroyed it posts a message to a new type,
GrClientMappedBufferManager, hanging off the direct context. The direct
context will periodically check for messages and unmap and then unref
buffers so that they can be reused. Currently this is done in
GrContext::performDeferredCleanup() and GrDrawingManager::flush().

The old API is kept around for backwards compatibility but it is
reimplemented as a bridge on top of the new mechanism.

Also a utility function to SkImageInfo is added to directly make a new
info with a specified dimensions rather than passing the width and
height separately to makeWH().

Bug: chromium:973403
Bug: skia:8962

Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-02 19:20:08 +00:00
Mike Klein
edf2d727f9 picture nesting bounds bug
- add a unit test reproducing the bug
  - fix SkRecorder::reset() to call resetCanvas(bounds) instead of
    calling resetCanvas(w,h).  (It was actually calling
    resetCanvas(right,top), even worse...)

In short, because we were calling this old resetCanvas(), SkRecorder,
the SkCanvas* we record into, was presenting bad device bounds,
affecting code like where we query the clip to search an R-tree for ops
to draw.  It was trimmed to only the positive/positive portion of the
actual bounds, so content like in the unit test that's all in negative
space was erroneously clipped out.

I'd like to get rid of these w/h methods altogether but they're still
used by some of our test tools and by Android.

Change-Id: Ie46f611250de4d655c4357823895ff885b4f3d59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245599
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-02 18:59:17 +00:00
Greg Daniel
5faf474fab More bounds fixes for StrokeRect and DefaultPath when using MSAA for non-aa.
Change-Id: Ia9c2a47675eac8f3ac1220c0e1089766aa141fc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245364
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-01 19:49:15 +00:00
Jim Van Verth
f2f0e1b8cc Add TransferBuffer and AsyncRead support to Metal.
* Implements onTransferPixelsFrom, onTransferPixelsTo, onFinishFlush and
checkFinishProcs.
* Adds a bind() method for allocating dynamic buffer memory that can
be used by the GPU prior to mapping on the CPU

Bug: skia:8243
Change-Id: I366ec47bf1155797d9a9b0c9f33870e50c95e914
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244301
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-10-01 14:37:51 +00:00
Brian Salomon
4bc0c1fc4b Rename GrColorSpaceInfo -> GrColorInfo
Add version SkImageInfo::Make() that takes SkISize instead of separate
width and height.

Change-Id: I42aa79d23b19e22f5405631728c245b04bce0559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245172
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-30 21:53:24 +00:00
Robert Phillips
66944404ce Make SkPixmap-variant of createBackendTexture public
Change-Id: I51d916d2410428113e29d2fc374e5f1f7f4010b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244676
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-30 18:06:14 +00:00
Brian Osman
9b8b4558d2 Change ByteCode and ByteCodeFunction to classes
The lack of encapsulation was finally starting to bother me. Had to
change the Interpreter namespace to a struct so that it could be
friended, but otherwise this was a nice and simple cleanup.

Also updated the comments on the two run functions, and renamed
fInputSlots to fUniformSlots, to reflect recent clarification
around in vs. uniform.

Change-Id: I24bbc59778b3ab6448bffcf98133d5c149a060a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244883
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-30 18:02:24 +00:00
Brian Salomon
f2ebdd91bf Rename GrPixelInfo to GrImageInfo.
Give it its own header file.

Make it store SkISize rather than separate int w/h.

Change-Id: I732f2774c561decac743a950959a70cbc162b67b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245163
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-30 17:10:18 +00:00
Kevin Lubick
7aeabcfa6a [SkParagraph] Require len if using addText(const char*)
Bug: skia:9469
Change-Id: Ie3ae11db9be4b1cf1645e8db0bf29dc8e59bc4cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244877
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-29 11:39:34 +00:00
Brian Salomon
dcbc359a00 Remove vestiges of 32 float texture format support
Change-Id: I186b2ea83a0c41f0ff1ecfe4163704c71ed121fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244881
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-27 19:40:54 +00:00
Herb Derby
cbd235c746 Introduce SkIota a wrapper that adds an index
SkIota adds an index to some collection you already use:

std::vector<int> v;
for (auto t : SkMakeIota(v)) {
   size_t i; int v;
   std::tie(i, v) = t;
   ...
}

Change-Id: I18390fc084eb8509cfaeb50d9720541759a2986d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225546
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-27 15:17:06 +00:00
Brian Salomon
5dd7746e35 Use SW backend as ref for AsyncReadPixels unit test.
As regular GPU and async read pixels share more it doesn't make sense
to test the async path using the regular path as the reference.

Bug: skia:9269

Change-Id: I8c32289947a7ae8b0f6e4e25ce8a588dfa5413f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244512
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-09-27 15:10:06 +00:00
Brian Osman
b23d66e10a Interpreter: Lots of minor cleanup/refactoring
- Update the parameter lists to both run and runStriped so
  that they're in the same (sane) order, named consistently,
  and always take counts with pointer arguments.
- Add the same count-based safety checks to run that were
  already in runStriped.
- Remove the N parameter to run, it was only used to run
  things one-at-a-time (other than one spot in unit tests),
  and it simplifies the code quite a bit. If you want to run
  multiple times, use the striped version. I also moved that
  functions 'N' earlier in the parameter list, to make the
  pattern of the remaining parameters clearer.
- Remove an interpreter benchmark class that was never used.

Change-Id: Ibff0a47bdb2d29d095a0addd27e65ab13cb80fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244716
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-27 15:02:16 +00:00
Robert Phillips
7f367983b5 Add mipmap support to SkPixmap flavor of createBackendTexture
Change-Id: I7a2dea9b0b8e6b985f2d56e587939266022c19e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234664
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-26 19:42:27 +00:00
Ethan Nicholas
31cff27607 Revert "Revert "remove 'in uniform' support from GrSkSLFP, make rules more clear""
This reverts commit 85705c1b3b.

Change-Id: If189dafce53491728296a4292c76af55b05835ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244509
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-26 18:11:45 +00:00
Brian Salomon
614cdab25d Check support for each GL format independently.
Previous code tried to aggregate some checks, but therefore had several
subtle bugs. Make each format check independent. It's easier to check
whether it's correct by looking up the specs/extensions referenced and
tweak it if not.

Also removes some "workarounds" that were just working around our own
bugs in extension/version detection.

Also adds some more WebGL format functionality.

Also uses glTexStorage2D for formats that previously did not check for
support.

Use glTexStorage2D on Android/NVIDIA to work around N9 and Shield TV
issues with glTexImage2D.

Bug: chromium:1003481

Change-Id: Ie3295b1ca76a6068f1426e77783d9dc07698c56a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243816
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-26 16:30:46 +00:00
Ethan Nicholas
85705c1b3b Revert "remove 'in uniform' support from GrSkSLFP, make rules more clear"
This reverts commit ac18a5ca60.

Reason for revert: breaking Chrome roll

Original change's description:
> remove 'in uniform' support from GrSkSLFP, make rules more clear
> 
> Bug: skia:
> Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I6e53f5197c751d961abfa21861b940d4168de213
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244508
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-26 16:04:26 +00:00
Ethan Nicholas
ac18a5ca60 remove 'in uniform' support from GrSkSLFP, make rules more clear
Bug: skia:
Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-26 14:05:10 +00:00
Nathaniel Nifong
7ee3f93196 Add a test that draws subpictures within an MSKP and make it pass.
It would have been passing, note that he changes to SkRecorder are needed only to obtain the
SkRecord used in asseting the correct commands were recorded.

Bug: skia: 9462
Change-Id: Ic43ab400b5954cc4f6eb465168179c0204a66040
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243818
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-09-25 20:12:35 +00:00
Brian Osman
2caecd2a43 In AAConvexPathRenderer, don't assume that path direction can be computed
With a perspective view matrix, we transform the path, which can
collapse it down and cause CheapComputeFirstDirection to fail. In that
case, just skip drawing the path, rather than asserting.

Change-Id: I59ee3c74d02d41913136626a653c64f825a9d56a
Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=37330
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244298
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-25 18:36:45 +00:00
Herb Derby
986ab2cf3d Add helper SkMakeZip
SkMakeZip uses function parameter deduction to build SkZips
the same way std::make_tuple does. It figures out the size
from one of the inputs that has a size. In debug, it makes
sure that all the size()s match if the input has a size.

Change-Id: I8f80d1137866ff595fff10cafa861e867441bedd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242817
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-09-25 17:52:09 +00:00
Robert Phillips
0ee10347f9 Split out check_base_readbacks sub-test in BackendAllocation tests
We want to reuse this sub-portion of the tests for SkPixmap initialized backend textures

Note: this also changes the format read-back into to be RGBA8

Change-Id: I3708541cb4e60cf2ba7b587da6e21169ef890b04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-25 16:22:49 +00:00
Robert Phillips
c1dbb4b510 Add check_mipmaps subtest to BackendAllocation test
This is setting up the test for SkPixmap-initialized backend texture testing

Change-Id: I667a0e6d622c9408d7fb42fc4b5792b0efa2ffb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243736
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-24 21:12:12 +00:00
Brian Osman
73fb39c9b0 SkSL: Support bitwise negation on unsigned integers
Change-Id: I5558891882923b4e554a8b97a87da6bc4386b645
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243817
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-09-24 20:50:43 +00:00
Robert Phillips
d34691b513 Remove compressed format support from the GrGpu::createBackendTexture code path
The intent is to add a createCompressedBackendTexture code path. This will decouple the GPU's ability to create compressed textures from raster's support for compressed SkColorTypes.

Change-Id: I5fa5dded6d5013b524fe7f99f2ebe0bdee76b3c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243657
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-24 18:10:57 +00:00
Ethan Nicholas
6f62412c92 Fixed integer divide / remainder in sksl interpreter
Our integer tests were broken: constant folding was optimizing away
the actual operations, so nothing was actually being tested. This
allowed us to not realize that integer divide / remainder didn't
work: vector division signals if any of divisor's lanes are zero,
and zeroes are common in masked-off lanes.

This replaces naive vector operations with loops and mask checks
for integer divide and remainder, and corrects the various broken
integer tests so they are actually doing stuff.

Change-Id: I6ffcad9e7b38a0bfd1604097f86d0faa24e1dbc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243698
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-24 17:35:42 +00:00
Nigel Tao
d48f13b26a Enable Codec_GifInterlacedTruncated test for Wuffs
A recent update to the Wuffs version that Skia uses means that the test
now passes.

While the old third_party/gif implementation and the Wuffs
implementation now both replicate interlaced rows (what the old
implementation calls a "Haeberli hack"), and the
Codec_GifInterlacedTruncated test passes either way, the exact
replication algorithm is different. In general, pixel-by-pixel output
may be different for the same (truncated) input.

For example, the old implementation only processed input on block
boundaries. If the truncation happened within a block, the old
implementation produces no output for that partial block but the Wuffs
implementation does.

Also, the old implementation used the interlaced row as the *center* of
the extrapolation (the 'broad brush'); Wuffs uses it as the *top* of the
extrapolation. There are subjective arguments (e.g. 'Venetian blinds',
'fat bottom rows') for either behavior. In any case, it isn't covered by
the GIF spec.

Bug: skia:8235
Bug: skia:8766
Change-Id: Ia8d8b1007006697498e47ec6bba7be7d81be10c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243596
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-09-24 16:48:33 +00:00
Brian Osman
4c2146f2ca Interpreter: Add bitwise shift operators
These only support fixed shift amounts (for now) ... because that's what
skvx supports ... because that's what various SIMD instructions support.

(We could loop over lanes, but the only need for this at the moment
is fine with constant shift).

Change-Id: I0e2c17084d019ff9b9a21476633adb59b3ce4bd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243656
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-24 14:56:36 +00:00
Brian Osman
e5bbce209c Interpreter: Add bitwise operators
Also, negation is unary, not binary.

Change-Id: Ic7c5a6f2ee0b2bbda89eef62999e4ebbc97dca12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243161
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-23 17:10:01 +00:00
Ethan Nicholas
d166d2e62f SkSL interpreter now properly short-circuits boolean operators
Bug: skia:
Change-Id: If7acf4107498cabc049ad130814a3814383bd14b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243418
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-23 16:21:04 +00:00
Robert Phillips
40b05c390c Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur (take 2)
Bug: skia:6718
Change-Id: I6a0be1cab5543c3d76a041fcdc9ae9be4a3b179b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242822
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-20 17:11:27 +00:00
Robert Phillips
ea1b30b57b New proposed syntax for SkColorTypes
Everything except for SkImageInfo.h is mechanical

Change-Id: I2d775c79467fb15f6022e80d21b4a9151272fe2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242896
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 20:42:55 +00:00