Commit Graph

7317 Commits

Author SHA1 Message Date
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
Robert Phillips
a5d96bcc51 Remove "experimental" comments regarding RG_F16 and RGBA_16161616
These two formats are now exercised in the wacky_yuv_formats GM

Change-Id: I07a5649401b7928e8c4666e39793915ac1d45646
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242560
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 18:05:38 +00:00
Robert Phillips
c766d7fe3d Revert "Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur"
This reverts commit f580721e11.

Reason for revert: maybe angle bots

Original change's description:
> Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur
> 
> Bug: skia:6718
> Change-Id: Ia8a96cf6907ffaafd989f1e5bb1443d1ef51b9e6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242142
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ifcd22699ed64c7020c5d33781062c267595e246e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242820
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 16:16:23 +00:00