Commit Graph

10855 Commits

Author SHA1 Message Date
Mike Klein
6b8b2ea6be move cfi stifle post-refactor
Cq-Include-Trybots: luci.chromium.try:linux_chromium_cfi_rel_ng
Bug: chromium:1137652, chromium:1137958
Change-Id: I8575b588f9a1ba89740b95382b2462338e34bec5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326478
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-14 00:27:07 +00:00
Adlai Holler
6d0745b338 Migrate last public API to GrDirectContext
Cut & paste with some reorganization of includes & forward-decls.

Next up is GrContextPriv.

Change-Id: I72d2d95c62692e3b37608517b796c0041ffedea3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326157
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-10-13 20:10:01 +00:00
Adlai Holler
64e138367e Migrate compressed texture methods to GrDirectContext
Cut and paste job.

Change-Id: I36ba9ae0854a3a8578555ba3d6fe48db2fc755b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326156
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-13 17:24:40 +00:00
Mike Klein
311b648013 Reland "pack SkTArray"
This is a reland of b3c42efd25
with a few more signed/unsigned mismatches fixed up.

Original change's description:
> pack SkTArray
>
> Same idea as http://review.skia.org/325857; I just wanted to feel out
> the options myself. A couple key ideas:
>
>     Prefer SkTo32() to separate range assertions and casts.
>
>     Keep using int indices, counting to this->count() where
>     fCount would have warned about signed/unsigned mismatch.
>
> I've kept new comments and assertions to minimum.  In the end we won't
> change the max size of SkTArray, and I don't see much need to call out
> how much it hasn't changed.  Reading back over the accumulated changes,
> I don't really see much that's newly error-prone.
>
> Change-Id: I86a8a161b9ae44f24fc25093741945b75fbfa770
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326106
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

Change-Id: I04d928ecc185fb5c7b9d32f60e94df9f8d137898
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Debug-Vulkan,Build-Win-MSVC-x86-Debug
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326297
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-13 17:16:03 +00:00
Adlai Holler
2e0c70dc9c Migrate texture update methods to GrDirectContext
Cut & paste job, but I did replace some cases of just calling
inherited implementations with using-statements. There are
other methods on this class that are using-statements and
that pattern is cleaner.

Change-Id: Ie369c643e44bdb8f82dfffcf45c1f65d48606899
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325660
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-13 16:01:42 +00:00
Mike Klein
43a2d428eb Revert "pack SkTArray"
This reverts commit b3c42efd25.

Reason for revert: Build-Win-MSVC-x86_64-Debug-Vulkan


Original change's description:
> pack SkTArray
>
> Same idea as http://review.skia.org/325857; I just wanted to feel out
> the options myself. A couple key ideas:
>
>     Prefer SkTo32() to separate range assertions and casts.
>
>     Keep using int indices, counting to this->count() where
>     fCount would have warned about signed/unsigned mismatch.
>
> I've kept new comments and assertions to minimum.  In the end we won't
> change the max size of SkTArray, and I don't see much need to call out
> how much it hasn't changed.  Reading back over the accumulated changes,
> I don't really see much that's newly error-prone.
>
> Change-Id: I86a8a161b9ae44f24fc25093741945b75fbfa770
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326106
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

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

Change-Id: I8267a05e1ce075bfa7893c60f7c77dbf4f8cf061
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326296
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-13 16:01:10 +00:00
Mike Klein
a221f1c36d remove skvx::{rsqrt,rcp}
These don't return reliable portable results, so I don't want to promote
them as good ideas to use.  You can get at least 5 different results
from these across the four main architectures we support, and they've
been the root cause of bugs uncovered only in production on undertested
platforms.

Luckily, unused outside of tests.

Change-Id: I532731fe4cddf127253341e5ace8d9c5c9ebb0f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326108
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-13 15:52:56 +00:00
Mike Klein
b3c42efd25 pack SkTArray
Same idea as http://review.skia.org/325857; I just wanted to feel out
the options myself. A couple key ideas:

    Prefer SkTo32() to separate range assertions and casts.

    Keep using int indices, counting to this->count() where
    fCount would have warned about signed/unsigned mismatch.

I've kept new comments and assertions to minimum.  In the end we won't
change the max size of SkTArray, and I don't see much need to call out
how much it hasn't changed.  Reading back over the accumulated changes,
I don't really see much that's newly error-prone.

Change-Id: I86a8a161b9ae44f24fc25093741945b75fbfa770
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326106
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-13 15:51:06 +00:00
Adlai Holler
98dd004e7e Migrate texture creation methods to GrDirectContext
Cut and paste job. Getting close!

Change-Id: Ifd1673a92a44dac1e8aab578a3e41b2a2b5e3325

Cq-Include-Trybots: luci.skia.skia.primary:Perf-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit,Perf-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-Puppeteer_RenderSKP
Change-Id: Ifd1673a92a44dac1e8aab578a3e41b2a2b5e3325
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325659
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-13 15:38:37 +00:00
Michael Ludwig
01b93eabe2 Add SkImageFilters::Blend rename for Xfermode filter
This better matches SkShaders::Blend and SkColorFilters::Blend factories.

Bug: skia:9310
Change-Id: I02a3fe488a446b803df96518caacff1fdf536e9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324623
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-10-13 14:28:26 +00:00
Adlai Holler
3acc69a908 Migrate flush & misc methods to GrDirectContext
More cut and paste work.

Change-Id: I0dfc822ae168e15c6734a6c079bb930fc0fa9e60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325618
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-13 13:45:35 +00:00
Michael Ludwig
c98d5b6250 Expand image filter factories to accept more types for crop rects
The original SkIRect* crop rect argument was a little too onerous.
First, as a pointer, it required you to declare your crop rect separately
just to take a pointer to it. Now, you can pass an SkIRect or SkRect in
directly when you are explicitly constructing a cropped filter.

Second, the crop rect is transformed by the same matrix as the other
filter parameters, so it can be scaled and translated. Allowing SkRect
instead of just SkIRect gives more precision and flexibility for local
coordinate systems. Now a crop rect could be defined to be from [-.5, .5]
and still map to real pixels after transformation (this was a request
from the skia-discuss mailing list, and also better matches the SVG spec).

The crop rect argument was always meant to be a convenience, since I
plan to refactor cropping into an indenendent image filter that will
give more explicit control over when the crop is applied in the DAG.
To maintain the convenience for the factories, the constructors of
the new CropRect type are not explicit so that callers don't ever need
to concern themselves with it.

Bug: skia:9296
Change-Id: I29a684cb925f1fca4dabc803114ab2b125660aaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-12 20:25:43 +00:00
Greg Daniel
5d0330e381 Add scratch msaa attachment creation to GrResourceProvider.
This basically adds the functionality to GrResourceProvider to handle
scrate MSAA attachments. There are not current users of this, but
users will be added in follow on changes.

Bug: skia:10727
Change-Id: Ieb8d247e034fb22ac9ff4fc549935310329a1c1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320267
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-12 20:22:13 +00:00
Mike Klein
3637a44a36 update comments and rearrange SkVx.h
Just a little refactor no-op.

Change-Id: I1842a0190cd96c60da2fe3c7f88fa56c9f73af81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325681
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-12 20:06:13 +00:00
Mike Klein
840e8ea740 power up skvx::map
Rewrite map() to allow any number of arguments,
now also used for 2-argument (pow) and 3-argument (fma) operations.

I left a note about fma()... I can't understand why, but calling as
map(fmaf, x,y,z) ends up with scalar calls to fmaf(), but with the
lambda indirection we see perfect vector codegen.

I had to break map() back into two parts. I don't see any way to pass
both a variadic number of arguments and play our trick with the default
std::index_sequence parameter.  The lane lambda similarly exists only to
split up the expansion of the Rest... type pack from the I... index
pack; you can't use two pack expansions in the same expression.

Change-Id: Ia156a7fd846237f687d6018a7f95550c9fd4a56d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325736
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-10-12 19:43:33 +00:00
Adlai Holler
4aa4c6014d Migrate gpu resource methods to GrDirectContext
Cut & paste job

Change-Id: I92e7d1ca5fdf7a7f9961b77a6088f06ed401cc2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325616
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-12 18:36:57 +00:00
John Stiles
01bdceb869 Rename SkTArray::allocCntForTest to capacity.
A change made in the spirit of not being weird. C++ containers typically
expose their capacities to non-test code, with a function "capacity."

Change-Id: Icc7e175a20aff53ef9e144ac9620ced29ef5e95a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325657
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-10-12 18:31:27 +00:00
Adlai Holler
3a508e94ef Migrate resource cache methods to GrDirectContext
Cut and paste job.

Change-Id: If9b7e0f74b16b2559dc4149f81720df96b09761e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325461
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-12 18:11:07 +00:00
Brian Salomon
30c9b4cfb0 Remove SkSurface::MakeFromBackendTextureAsRenderTarget
Bug: skia:9832
Change-Id: I4cb6f8abdb58ac37e9304a4c484e6cac4a25f0d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324890
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-12 17:57:37 +00:00
Adlai Holler
61a591ca18 Migrate releaseResourcesAndAbandonContext to GrDirectContext
The call order here is a little weird – it could use some refactoring
but for now it's just a cut-and-paste job.

Change-Id: I931493a421f7fd1df69f0c47055b90a2996c7dc3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325459
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-12 17:20:57 +00:00
Adlai Holler
a7a404473c Migrate abandonment & reset methods to GrDirectContext
This is pretty much just cutting & pasting the code naïvely,
but it's the safe way to go so that we don't impact the
order of events during this housekeeping.

Change-Id: I8d9f2ffb560b34fd1a8d9603174ff1f17803e447
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324619
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-09 16:16:43 +00:00
Adlai Holler
9555f2934d Reland "Merge GrContext::init into GrDirectContext ..."
This reverts commit e9b9c3bd7f.

Reason for revert: Fixed MSVC

Original change's description:
> Revert "Merge GrContext::init into GrDirectContext ..."
>
> This reverts commit 48d8724097.
>
> Reason for revert: Breaking MSVC bots
>
> Original change's description:
> > Merge GrContext::init into GrDirectContext ...
> >
> > And minor cleanups associated with the initialization of these classes.
> >
> > Change-Id: Ida0372d0b1a0b8bf5b309814de5418e47ea34fdb
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324122
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Auto-Submit: Adlai Holler <adlai@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I00b2ddaeaef53e3fe05a338c88158cf235f325c4
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324132
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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


Change-Id: I88bac7cd3aab070460671e82cbd924fbb42a2740
Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Release-Shared,Build-Win-Clang-x86_64-Release-Shared
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324616
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-10-09 14:42:43 +00:00
Michael Ludwig
7d0f853158 Add SkImageFilters::Shader in place of Paint factory
SkImageFilters::Paint did not use every slot of the SkPaint, with only
its color, alpha, color filter, and shader having a meaningful effect on
the image filter result. It was always blended into a transparent dst,
so blend mode wasn't very relevant, and it was always filled to whatever
required geometry, so stroke style, path effect, and mask filters were
ignored or not well specified.

Color, alpha, and color filter can all be combined into an SkShader, so
a more constrained SkImageFilters::Shader provides the same useful
capabilities without as many surprises.

SkImageFilters::Paint still exists, but is deprecated to be removed
once I've confirmed clients aren't depending on it.

Bug: skia:9310
Change-Id: I11a82bda1a5d440726cf4e2b5bfaae4929568679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-08 22:51:13 +00:00
Jim Van Verth
e9b9c3bd7f Revert "Merge GrContext::init into GrDirectContext ..."
This reverts commit 48d8724097.

Reason for revert: Breaking MSVC bots

Original change's description:
> Merge GrContext::init into GrDirectContext ...
>
> And minor cleanups associated with the initialization of these classes.
>
> Change-Id: Ida0372d0b1a0b8bf5b309814de5418e47ea34fdb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324122
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>

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

Change-Id: I00b2ddaeaef53e3fe05a338c88158cf235f325c4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324132
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-08 21:00:36 +00:00
Adlai Holler
48d8724097 Merge GrContext::init into GrDirectContext ...
And minor cleanups associated with the initialization of these classes.

Change-Id: Ida0372d0b1a0b8bf5b309814de5418e47ea34fdb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324122
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-08 20:39:22 +00:00
Adlai Holler
1fc76ce6ff Migrate more Android & SkSurface API off GrContext
Migration should be free because (1) the non-Android API is
only loosening up to GrRecordingContext and (2) the Android API
can only see GrContext through including GrDirectContext.h

Change-Id: I97aa75baba0b0969361db6eaef9f83ea94183700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323557
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-08 18:32:32 +00:00
Robert Phillips
d464feb1fc Rename GrThreadSafeUniquelyKeyedProxyViewCache
Once triangulated paths are added this will no longer just be storing proxy views.

Bug: 1108408
Change-Id: I82fa47b0b85f738d9a25330c29bc2892c9bfeda4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323999
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-08 17:39:12 +00:00
Mike Klein
ba835bba45 tidy up SkTHash special methods
Like the destructors, most of these can just go unspoken.

SkTArray only knows its size in Debug builds, so it can't easily grow a
copy constructor.  Instead just keep the explicit copies and moves on
SkTHashTable, and mark the others as explicitly default.  I inverted the
pattern from assign-by-copy to copy-by-assign, but it's all basically
the same.

Change-Id: I0df552ef547ce9c7e232267c072a5f3b09197847
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324056
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-08 17:20:22 +00:00
John Stiles
9c0b79a354 Implement assignment and copy-construction for SkTHashSet/Map.
This will enable us to use SkTHashMap to store our definition maps.

Change-Id: I6017dfa71e1c5e68a20c97e955bb3d3abf347f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323891
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-08 16:05:52 +00:00
Greg Daniel
a7f69c2906 Add stencil formats to all the backends.
Currently there is nothing using these formats, but this change just adds
them along with a quaries about their properties. They will be used in a
follow up change.

Bug: skia:10727
Change-Id: Iaaf13baf372799d47c65bd974fd204a32be57617
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322622
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-07 17:58:31 +00:00
Robert Phillips
6e17ffe829 Add customData capability to the thread-safe proxy cache ...
and begin using it for cached SW-generated blur masks.

This is needed to begin mixing and matching HW & SW-generated blur
masks since they have different draw-rects.

It will also be useful if/when we add support for triangulated paths
to the thread-safe cache.

Bug: 1108408
Change-Id: I085ad1127dc2deb98b35d704b06e50b27c72fd1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322657
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-07 14:18:00 +00:00
John Stiles
8354e9b8f6 Fix data() method and add unit test.
I wrote code that called SkAutoTArray::data() and discovered that it
was broken, but not generating compile errors because it's part of a
template and never instantiated anywhere else. I fixed the
implementation and added it to our container unit test to prevent later
regression. This revealed another issue, that "containers in
SkTemplates.h [should] all have a consistent api", according to
test_container_apis. However, data() was never added to the non-array
container APIs. So I added data() to the other containers as well.

Change-Id: I52532c91fdab3fc8c4539053ba8420815b7b0ee5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-07 13:46:50 +00:00
Adlai Holler
0ce2c54094 Reland "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
This reverts commit cf43fc6768.

Reason for revert: Fixed g3

Original change's description:
> Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
>
> This reverts commit ff13ffbeac.
>
> Reason for revert: Blink in g3
>
> Original change's description:
> > Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit 89bdc90ac8.
> >
> > Reason for revert: Fix metal
> >
> > Original change's description:
> > > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> > >
> > > This reverts commit d2daa94ede.
> > >
> > > Reason for revert: Metaru
> > >
> > > Original change's description:
> > > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > > >
> > > > Woo!
> > > >
> > > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > > Docs-Preview: https://skia.org/?cl=317436
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > > Commit-Queue: Adlai Holler <adlai@google.com>
> > >
> > > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> > >
> > > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > > Reviewed-by: Adlai Holler <adlai@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> >
> > Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> > Docs-Preview: https://skia.org/?cl=318759
> > Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

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


Change-Id: I4f01291f4b3bfbb8fd7dd8cf2bf8415430c3392e
Docs-Preview: https://skia.org/?cl=322437
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322437
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-06 18:59:11 +00:00
Brian Salomon
72c7b98ae3 Start removal of tool usage of SkSurface::MakeFromBackendTextureAsRenderTarget.
Adds a new helper that creates a GrBackendRenderTarget using
GrGpu and then wraps it in a SkSurface. Uses the SkSurface
release proc to delete the BERT using GrGpu.

Upgrades GrGpu::createTestingOnlyBackendRenderTarget to create MSAA
buffers.

Updates many tests/tool to call sites to use the helper instead of
SkSurface::MakeFromBackendTextureAsRenderTarget.

Adds syncToCpu bool to SkSurface:: and GrContext::flushAndSubmit.

Bug: skia:9832

Change-Id: I73a8f0ce09dc6523729af0814464c6b6657fda06
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293683
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-10-06 16:32:11 +00:00
Ben Wagner
59637dd6f9 Add SkTypeface::getPostScriptName.
Bug: skia:10234
Change-Id: Idfa1261e36174a4b4223b8eb62c872448fc58b14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322680
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-06 15:35:06 +00:00
Brian Salomon
8e5cf44114 SkImage_GpuYUVA doesn't take origin
When flattening we always flatten to kTopLeft.

Rename some origin params to SkImage factories to make it clearer
that they refer to input texture origins.

Only preserve the origin in the variants that immediately flatten
to RGBA as part of contract (make SkImage_Gpu not SkImage_GpuYUVA).

Bug: skia:10632
Change-Id: I0ed9d693758086c4050f983b579d0d77daefc3d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322486
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-06 15:08:35 +00:00
Ben Wagner
ae4bb98f13 Reland "Remove use of legacy display globals."
This is a reland of c1916c34fe

As it turns out, benches are not always given a canvas.

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Change-Id: I61a2ac058fafc99653e3304876cf4b97350dac8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322490
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 19:13:58 +00:00
Brian Salomon
f165f799ae Remove unused variant of SkImage::MakeFromYUVAPixmaps
Bug: skia:10632
Change-Id: I337d79d856945071b2b68651a80013184d443267
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322480
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-10-05 18:08:28 +00:00
Jim Van Verth
bd0881cb58 Revert "Remove use of legacy display globals."
This reverts commit c1916c34fe.

Reason for revert: Bots unhappy

Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

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

Change-Id: I365d2b1d19241a90130bc1b59663651817966f63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322400
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-10-05 16:34:15 +00:00
Ben Wagner
c1916c34fe Remove use of legacy display globals.
In the ongoing effort to remove the display globals from Skia, allow
their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
in a normal Skia build and remove all use from Skia code.

Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-10-05 15:53:10 +00:00
Kevin Lubick
3d00e3a3fc [canvaskit] Flesh out remaining docs for core CanvasKit.
This adds docs or stubs for everything that is on the main CanvasKit
object.

Paragraph, Particles, and Skottie will be their own CLs.

Bug: skia:10717
Change-Id: I0f5027d73b2ac7d127f3a03a8f1aaa15f694ae38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321789
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-10-05 11:47:40 +00:00
Kevin Lubick
2fd08e651c [canvaskit] Add docs/types for Paint and Filters/Effects
This also includes matrices (which I'm reminded I want to test with
TypedArrays and make optional).

Bug: skia:10717
Change-Id: I0f6565a46b766c1f81c28dfc1229d403bff32e69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321118
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-10-05 11:46:38 +00:00
Brian Salomon
86d07fd01c Remove unused SkImage YUVA factories.
Bug: skia:10632
Change-Id: Icb27e44d234063ab049fef95587f474323d7ada9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321537
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-10-02 19:35:34 +00:00
Greg Daniel
36366209d4 Require stencil bits on wrapped GrBackendRenderTargets to 0, 8, or 16.
This will allow us in a follow on change to put in a "fake" gl stencil
format for the wrapped FBO.

Bug: skia:10727
Change-Id: Iba1eca5114b34d25e6a220591d28a20f7b36b12b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321545
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-02 16:15:44 +00:00
Herb Derby
a80ce1a36d remove SkMakeSpan use ctor parameter deduction
Change-Id: I3a1b12f7eb906fe105eb7e9f6bc10e3745f61528
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320264
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-10-02 01:41:03 +00:00
Heather Miller
219d412d13 Update Skia milestone to 88
Change-Id: I8d01f643e1cb7327713959ea744de3ae8c82bb6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321520
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2020-10-01 21:26:03 +00:00
Michael Ludwig
6d32686824 Remove unused field from DeviceCM
The SkRasterClip on DeviceCM appears to be unused and just increased the
size of that struct. Now the clip is tracked on the MCRec or within
SkBitmapDevice itself.

This adjusts the reserved size for DeviceCM to match (as reported on my
machine), and moves it into an anonymous namespace.

Change-Id: Ifa8635f839fc3d75339a64c9378ee054fe0cc071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321250
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-10-01 20:15:18 +00:00
Brian Salomon
8e0aa441a5 Get GrBackendRenderTarget's sample count from MtlTexture.
Instead of being passed separately.

Check sample count in various onWrap methods in GrMtlGpu.

Bug: skia:9832


Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone8-GPU-AppleA11-arm64-Release-All-Metal,Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All-Metal,Test-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All-Metal,Test-iOS-Clang-iPhone11-GPU-AppleA13-arm64-Release-All-Metal,Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal,Test-Mac10.15-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Release-All-Metal
Change-Id: If5813db95b07f5d272e80920486f461cc5a587fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320956
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-30 20:40:33 +00:00
Brian Salomon
2889e69680 Return GrBackendTexture from SkPromiseImageTexture by value.
Makes it simpler to call methods that update the internal ref counted
state.

Change-Id: Iecefab2c14ff13eae2fa34eafdcc7e031b3c85b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320957
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-30 19:50:03 +00:00
Brian Salomon
718ae76d5b Add sample count field to GrD3DTextureResourceInfo.
Remove separate constructor arg from GrBackendRenderTarget.

Add appropriate checks in onWrap functions in GrD3DGpu to limit to
previous functionality.

Bug: skia:9832

Cq-Include-Trybots: luci.skia.skia.primary:Test-Win10-MSVC-Golo-GPU-QuadroP400-x86_64-Debug-All-Direct3D,Test-Win10-Clang-ShuttleA-GPU-RadeonHD7770-x86_64-Debug-All-Direct3D
Change-Id: Ieba398d4bc00d18fdb0adffcda81f1a166db24b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320757
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-30 14:03:39 +00:00
Brian Salomon
57fd923c20 Add sample count to GrVkImageInfo.
Pre-req for allowing rendering to an externally created MSSA VkImage.


Bug: skia:9832

Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Release-All-Vulkan,Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All-Vulkan,Test-Win10-Clang-ShuttleA-GPU-RadeonHD7770-x86_64-Release-All-Vulkan,Test-Android-Clang-GalaxyS9-GPU-MaliG72-arm64-Release-All-Android_Vulkan,Test-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Release-All-Android_Vulkan,Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_Vulkan,Test-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Vulkan,Test-Android-Clang-P30-GPU-MaliG76-arm64-Release-All-Android_Vulkan
Change-Id: Ibf41944c6946dda7e27bdcd509ecd04976fc9ade
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320262
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-29 18:36:58 +00:00
Brian Salomon
8ff24492e2 Log more info for Chrome bug 1132617
Bug: chromium:1132617
Change-Id: I88950bc782a7f0ab4431b1f9646750731c8069f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320063
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-28 16:22:16 +00:00
Michael Ludwig
e5d5eedd2d Update SkClipOp::kMax_EnumValue to match non-deprecated values
Even when expanding clip ops were disabled, the max value allowed the
fuzzer to produce those disabled values. This should fix the fuzzer to
only produce valid intersect or difference clip ops.

Bug: chromium:1132687
Change-Id: I7368ff36a00e6b0e87ecbae5ba647d249299b9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320064
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-09-28 15:30:33 +00:00
Brian Salomon
4e48490717 Remove deprecated Vulkan GrBackendRenderTarget constructor
Change-Id: I3bda64f7c03245e751bb19520ec7ed07e5c1d59e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319780
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-09-25 21:28:40 +00:00
Greg Daniel
a28ea67c2a Fix checks of GR_TEST_UTILS.
We had lots of checks just checking defined but we always define
GR_TEST_UTILS

Change-Id: I588c50ddd91f71618a96ab6c9eda2050b423f611
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319682
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-25 15:58:53 +00:00
Brian Salomon
96c8aeb494 Reland "Allow rect and circle blur fast cases to be used with rotation matrices."
This is a reland of 2bded27a96

Original change's description:
> Allow rect and circle blur fast cases to be used with rotation matrices.
>
> For circles this is trivial. The existing shader works as is.
>
> For rects this requires back projecting from device space.
>
> Adds a GM for rotated rect blurs and modifies a circle blur GM to add
> rotation.
>
> Bug: chromium:1087705
>
> Change-Id: I6b969552fbcc9f9997cfa061b3a312a5a71e8841
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318757
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:1087705
Change-Id: Ie3ef96c40461665f6207225a15e19b4cf5bcba94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319338
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-24 21:33:44 +00:00
Robert Phillips
1fc7422092 Revert "Allow rect and circle blur fast cases to be used with rotation matrices."
This reverts commit 2bded27a96.

Reason for revert: Seems to be blocking the Chrome roll

Original change's description:
> Allow rect and circle blur fast cases to be used with rotation matrices.
>
> For circles this is trivial. The existing shader works as is.
>
> For rects this requires back projecting from device space.
>
> Adds a GM for rotated rect blurs and modifies a circle blur GM to add
> rotation.
>
> Bug: chromium:1087705
>
> Change-Id: I6b969552fbcc9f9997cfa061b3a312a5a71e8841
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318757
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Iafb479f3b3561e226678a3020254c6e76d4ce284
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1087705
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319186
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-24 13:43:20 +00:00
Adlai Holler
cf43fc6768 Revert "Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext""
This reverts commit ff13ffbeac.

Reason for revert: Blink in g3

Original change's description:
> Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit 89bdc90ac8.
>
> Reason for revert: Fix metal
>
> Original change's description:
> > Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
> >
> > This reverts commit d2daa94ede.
> >
> > Reason for revert: Metaru
> >
> > Original change's description:
> > > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> > >
> > > Woo!
> > >
> > > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > > Docs-Preview: https://skia.org/?cl=317436
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Adlai Holler <adlai@google.com>
> >
> > TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> >
> > Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> > Reviewed-by: Adlai Holler <adlai@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
>
> Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
> Docs-Preview: https://skia.org/?cl=318759
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

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

Change-Id: Ib20fe933120d56b72efaec73a0bedec60bc28def
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319184
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-09-24 11:44:49 +00:00
Jim Van Verth
1b89eb742a Add AMD allocator to D3D12 backend.
Adds base class GrD3DAlloc and GrD3DMemoryAllocator, and a reference
to a GrD3DMemoryAllocator in GrBackendContext and a reference to a
GrD3DAlloc in GrD3DTextureResourceInfo. Internally, we override this
base class to define the AMD memory allocator.

Change-Id: I033924b0247ea330969b1398f25985e7a84aec11
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317243
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-09-23 21:22:52 +00:00
Adlai Holler
ff13ffbeac Reland "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
This reverts commit 89bdc90ac8.

Reason for revert: Fix metal

Original change's description:
> Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
>
> This reverts commit d2daa94ede.
>
> Reason for revert: Metaru
>
> Original change's description:
> > Take GrContext private, GrDDLContext inherit from GrRecordingContext
> >
> > Woo!
> >
> > Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> > Docs-Preview: https://skia.org/?cl=317436
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Change-Id: Id4b10795193a904cd4ed8c36e60e74abe3b6702a
Docs-Preview: https://skia.org/?cl=318759
Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac10.15.5-Clang-arm64-Debug-iOS_Metal,Build-Mac-Clang-x86_64-Debug-Metal
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318759
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-09-23 21:17:47 +00:00
Brian Salomon
2bded27a96 Allow rect and circle blur fast cases to be used with rotation matrices.
For circles this is trivial. The existing shader works as is.

For rects this requires back projecting from device space.

Adds a GM for rotated rect blurs and modifies a circle blur GM to add
rotation.

Bug: chromium:1087705

Change-Id: I6b969552fbcc9f9997cfa061b3a312a5a71e8841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318757
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-23 20:01:07 +00:00
Greg Daniel
1d3c8c1a8b Add optional param to setBackendTextureState to return previous state.
Bug: skia:10742
Change-Id: I334e7896d0a1509eb666c46d5731d2573a5c1aba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318698
Reviewed-by: Austin Eng <enga@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-09-23 19:54:59 +00:00
Adlai Holler
7b97b3cb2b Reland "Migrate metal tools away from GrContext"
This reverts commit 18f4b1c7e3.

Reason for revert: Fixed iOS

Original change's description:
> Revert "Migrate metal tools away from GrContext"
>
> This reverts commit 3eb813e0cc.
>
> Reason for revert: Broke iOS
>
> Original change's description:
> > Migrate metal tools away from GrContext
> >
> > Change-Id: I73a73ca5d088c35acd23be3336d8d1e3e859a82e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318760
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Auto-Submit: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Idf74c936cfe8481e18455dcc0faa21155884b198
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319017
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Change-Id: I6e14a333be4a960af0434bbcb6ce9a1a2271dca6
Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac-Clang-arm64-Debug-iOS_Metal,Test-iOS-Clang-iPhone11-GPU-AppleA13-arm64-Debug-All-Metal,Test-Mac10.13-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Debug-All-Metal,Test-Mac10.13-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Debug-All-DDL3_Metal
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319018
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-09-23 19:11:07 +00:00
Chris Dalton
d1e6716f6a Add an "allPathsVolatile" option for testing
Bug: skia:10419
Change-Id: I4bb2dc515448d8c87329ade90d24bf78ca1d7938
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319097
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-09-23 19:02:27 +00:00
Adlai Holler
18f4b1c7e3 Revert "Migrate metal tools away from GrContext"
This reverts commit 3eb813e0cc.

Reason for revert: Broke iOS

Original change's description:
> Migrate metal tools away from GrContext
> 
> Change-Id: I73a73ca5d088c35acd23be3336d8d1e3e859a82e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318760
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

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

Change-Id: Idf74c936cfe8481e18455dcc0faa21155884b198
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319017
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-09-23 12:59:32 +00:00
Adlai Holler
3eb813e0cc Migrate metal tools away from GrContext
Change-Id: I73a73ca5d088c35acd23be3336d8d1e3e859a82e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318760
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-09-22 22:33:09 +00:00
John Stiles
d4867c94be Add rc accessor method to SkMatrix.
FP gencode reads back matrix values in its dumpInfo method using rc().
This worked for SkM44; now it will work for SkMatrix as well.

Change-Id: I4efc7018529bd3c84aacc073fad2bfca7e12c517
Bug: skia:10748
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318756
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-22 21:32:20 +00:00
Adlai Holler
89bdc90ac8 Revert "Take GrContext private, GrDDLContext inherit from GrRecordingContext"
This reverts commit d2daa94ede.

Reason for revert: Metaru

Original change's description:
> Take GrContext private, GrDDLContext inherit from GrRecordingContext
> 
> Woo!
> 
> Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
> Docs-Preview: https://skia.org/?cl=317436
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

Change-Id: I9b58dee285fbdc49ebc8e76df5da0fe224cf9787
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318758
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-09-22 20:50:01 +00:00
Adlai Holler
d2daa94ede Take GrContext private, GrDDLContext inherit from GrRecordingContext
Woo!

Change-Id: I8d201b709343dc18cad31ea740575285dd035f35
Docs-Preview: https://skia.org/?cl=317436
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317436
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-09-22 20:03:19 +00:00
Jim Van Verth
5fba9ae0cb Revert "Reland "Use Microsoft's ComPtr to wrap D3D12 objects.""
This reverts commit b8ae7fa12a.

Reason for revert: Introduced a memory leak

Original change's description:
> Reland "Use Microsoft's ComPtr to wrap D3D12 objects."
> 
> This is a reland of 0ef049177f
> 
> Original change's description:
> > Use Microsoft's ComPtr to wrap D3D12 objects.
> > 
> > Change-Id: I4bd173428a2b65f0bc1994fb794ef9d4d68d5ba0
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314957
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Jim Van Verth <jvanverth@google.com>
> 
> Change-Id: Id0199db4061c67ed53da35e74dc31a004744be95
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315655
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

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

Change-Id: I3f8744668558f6b8f4f367eeeeff2f6aa2c36992
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318209
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-09-21 22:02:12 +00:00
Greg Daniel
9a48697bd7 Allow client to pass in VK_IMAGE_LAYOUT_UNDEFINED into mutable state change requests.
Passing in VK_IMAGE_LAYOUT_UNDEFINED will tell Skia to not update the
layout when doing the state change.

Bug: skia:10742
Change-Id: Ic59b7c95d3a73e29dcd6eec16a2fd138e1a1d95f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318204
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-09-21 20:38:42 +00:00
Adlai Holler
d8ca58a332 Remove SkCanvas::getGrContext & GrRecordingContext::backdoor
These are no longer needed now that we've migrated away.

Change-Id: Id308af7d40ffe0d539a3c6fd201220d145080928
Docs-Preview: https://skia.org/?cl=317281
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android,Canary-G3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317281
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-09-21 16:46:21 +00:00
Brian Salomon
94f65d784c Expand SkYUVAInfo::PlanarConfig/SkYUVAPixmapInfo::DataType values.
Now supports all plane configurations tested by WackyYUVFormatsGM.

Added WackyYUVFormatsGM that tests YUVA interface on SkImageGenerator.


Change-Id: I8326f098f1453b9702f04ff366431a516ca160c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317097
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-18 20:43:12 +00:00
Chris Dalton
597c33a8c0 Fix CanvasKit warnings compiling on Mac with emsdk 2.0.0
Change-Id: Idcb37644c6c657ce66390ae12d9a55d68abab6cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317642
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-09-18 20:35:12 +00:00
Chris Dalton
31634288fd Add gms that test limited hw tessellation segments
Adds variations of trickycubicstrokes and widebuttcaps that limit the
max number of hardware tessellation segments to 5. This exercises our
stroking logic for splitting curves and joins when they require more
segments than are supported by the hardware.

Bug: skia:10419
Change-Id: Ie52374b89e30bfa021b2de74e3cd32e02ab734d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317268
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-17 23:48:44 +00:00
Mike Reed
b4aa639f23 Refactor API for mipmap-builder,
now the builder returns the new image.

Change-Id: Ie56256390b96d3fdbe39f89784276947047df656
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316442
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-09-17 21:46:44 +00:00
Mike Klein
7e129b8b89 Reland "refactor any()/all(), ptest for all()"
This is a reland of e24f7f3de7
... with fix for ~0 constants for the pedantic MSVC.

Original change's description:
> refactor any()/all(), ptest for all()
>
> Part of this is a simple refactor, adapting any() and all() to the new
> style of specialization.
>
> And with that refactor in place, add AVX2/SSE4.1 for all() using ptest.
> This isn't terribly important, but it does help make Op::asserts run
> faster in the SkVM interpreter.  I like to run with asserts enabled, and
> this makes passing asserts much cheaper---failing asserts are expensive
> still of course, printing to SkDebugf(), etc.
>
> Change-Id: Iebdeee701fab7c50cce8e457674b565f7dd2ec21
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317422
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Cq-Include-Trybots: luci.skia.skia.primary:Build-Win-MSVC-x86_64-Debug
Change-Id: I93f08177ef3439e65e4383cc517dba60c0c4ef3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317638
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-09-17 21:19:04 +00:00
Mike Klein
952f8f17e4 Reland "update skvx scalar-fallback strategy"
This is a reland of 4985db413d

...with a better implementation of map().  I don't understand
why we had to revert, but it had something with calling the
function pointer in map_(), so maybe this will help.

I've flattened the map_() / map() merge CL into this one,
and marked the resulting map() as no_sanitize("cfi").  I
don't see anything wrong, so I think it's a false positive.

Original change's description:
> update skvx scalar-fallback strategy
>
> Turns out Clang's a lot better at auto-vectorizing "obvious" scalar code
> into obvious vector code when it's written out the long way, e.g.
>
>      F32x4 x = ...;
>      x = { sqrtf(x[0]), sqrtf(x[1]), sqrtf(x[2]), sqrtf(x[3]) };
>
> vectorizes into sqrtps a lot more reliably than our recurse-onto-scalars
> strategy, and also better than the other naive approach,
>
>      F32x4 x = ...;
>      for (int i = 0; i < 4; i++) { x[i] = sqrtf(x[i]); }
>
> So here I've added a map(V, fn) -> V' using C++14 tricks to let the
> compiler handle the expansion of x = { fn(x[0]), fn(x[1]), ...
> fn(x[N-1]) } for any N, and implemented most skvx scalar fallback code
> using that.
>
> With these now vectorizing well at any N, we can remove any
> specializations we'd written for particular N, really tidying up.
>
> Over in the SkVM interpreter, this is a big improvement for ceil and
> floor, which were being done 2 floats at a time instead of 8.  They're
> now slimmed way down to
>
>    shlq       $6, %r13
>    vroundps   $K, (%r12,%r13), %ymm0
>    vroundps   $K, 32(%r12,%r13), %ymm1
>    jmp        ...
>
> where K is 9 or 10 depending on the op.
>
> I haven't found a scalar function that Clang will vectorize to vcvtps2pd
> (the rounding one, not truncating vcvttps2pd), so I've kept lrint()
> written the long way, updated to the style I've been using lately with
> specializations inline.
>
> Change-Id: Ia97abe3c876008228bf62b1daacd6f6140408fc4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317375
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Cq-Include-Trybots: luci.chromium.try:linux_chromium_cfi_rel_ng
Bug: chromium:1129408
Change-Id: Ia9c14074b9a14a67dd221f4925894d35a551f9d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317551
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-09-17 19:58:34 +00:00
Robert Phillips
12d06a3842 Add plumbing for the GrThreadSafeUniquelyKeyedProxyViewCache
This CL is also imperfect and incomplete but, although currently unused, it sketches in how the threadSafeProxyCache will be plumbed through the GrContexts and GrResourceCache.

Bug: 1108408
Change-Id: Idb012b6efd49291de69bd88e4b4c531458a3e553
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317360
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-09-17 14:15:58 +00:00
Mike Klein
ed423aa542 Revert "update skvx scalar-fallback strategy"
This reverts commit 4985db413d.

Reason for revert:

../../third_party/skia/include/private/SkVx.h:491:14: runtime error: control flow integrity check for type 'float (float)' failed during indirect function call
(/lib/x86_64-linux-gnu/libm.so.6+0x36460): note: (unknown) defined here
../../third_party/skia/include/private/SkVx.h:491:14: note: check failed in /b/s/w/ir/out/Release/viz_unittests, destination function located in /lib/x86_64-linux-gnu/libm.so.6
    #0 0x55e964d3c1f9 in skvx::Vec<4, float> skvx::map_<4, float, float, 0ul, 1ul, 2ul, 3ul>(skvx::Vec<4, float> const&, float (*)(float), std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>) ./../../third_party/skia/include/private/SkVx.h:491

I don't understand what's wrong here, but I have a better map() coming up anyway.

Original change's description:
> update skvx scalar-fallback strategy
> 
> Turns out Clang's a lot better at auto-vectorizing "obvious" scalar code
> into obvious vector code when it's written out the long way, e.g.
> 
>      F32x4 x = ...;
>      x = { sqrtf(x[0]), sqrtf(x[1]), sqrtf(x[2]), sqrtf(x[3]) };
> 
> vectorizes into sqrtps a lot more reliably than our recurse-onto-scalars
> strategy, and also better than the other naive approach,
> 
>      F32x4 x = ...;
>      for (int i = 0; i < 4; i++) { x[i] = sqrtf(x[i]); }
> 
> So here I've added a map(V, fn) -> V' using C++14 tricks to let the
> compiler handle the expansion of x = { fn(x[0]), fn(x[1]), ...
> fn(x[N-1]) } for any N, and implemented most skvx scalar fallback code
> using that.
> 
> With these now vectorizing well at any N, we can remove any
> specializations we'd written for particular N, really tidying up.
> 
> Over in the SkVM interpreter, this is a big improvement for ceil and
> floor, which were being done 2 floats at a time instead of 8.  They're
> now slimmed way down to
> 
>    shlq       $6, %r13
>    vroundps   $K, (%r12,%r13), %ymm0
>    vroundps   $K, 32(%r12,%r13), %ymm1
>    jmp        ...
> 
> where K is 9 or 10 depending on the op.
> 
> I haven't found a scalar function that Clang will vectorize to vcvtps2pd
> (the rounding one, not truncating vcvttps2pd), so I've kept lrint()
> written the long way, updated to the style I've been using lately with
> specializations inline.
> 
> Change-Id: Ia97abe3c876008228bf62b1daacd6f6140408fc4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317375
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: I27b5eff3328bf2ddf7063ee0dee14a378ff23b89
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317546
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-17 14:10:10 +00:00
Mike Klein
7e8f13e751 Revert "refactor any()/all(), ptest for all()"
This reverts commit e24f7f3de7.

Reason for revert: Build-Win-MSVC-x86_64-Debug


Original change's description:
> refactor any()/all(), ptest for all()
> 
> Part of this is a simple refactor, adapting any() and all() to the new
> style of specialization.
> 
> And with that refactor in place, add AVX2/SSE4.1 for all() using ptest.
> This isn't terribly important, but it does help make Op::asserts run
> faster in the SkVM interpreter.  I like to run with asserts enabled, and
> this makes passing asserts much cheaper---failing asserts are expensive
> still of course, printing to SkDebugf(), etc.
> 
> Change-Id: Iebdeee701fab7c50cce8e457674b565f7dd2ec21
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317422
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: Ib3ecbe93aa9d14b10dd87e8aa247f275c2c3eb67
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317545
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-17 14:08:50 +00:00
Mike Klein
e24f7f3de7 refactor any()/all(), ptest for all()
Part of this is a simple refactor, adapting any() and all() to the new
style of specialization.

And with that refactor in place, add AVX2/SSE4.1 for all() using ptest.
This isn't terribly important, but it does help make Op::asserts run
faster in the SkVM interpreter.  I like to run with asserts enabled, and
this makes passing asserts much cheaper---failing asserts are expensive
still of course, printing to SkDebugf(), etc.

Change-Id: Iebdeee701fab7c50cce8e457674b565f7dd2ec21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317422
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-17 13:37:58 +00:00
Mike Klein
4985db413d update skvx scalar-fallback strategy
Turns out Clang's a lot better at auto-vectorizing "obvious" scalar code
into obvious vector code when it's written out the long way, e.g.

     F32x4 x = ...;
     x = { sqrtf(x[0]), sqrtf(x[1]), sqrtf(x[2]), sqrtf(x[3]) };

vectorizes into sqrtps a lot more reliably than our recurse-onto-scalars
strategy, and also better than the other naive approach,

     F32x4 x = ...;
     for (int i = 0; i < 4; i++) { x[i] = sqrtf(x[i]); }

So here I've added a map(V, fn) -> V' using C++14 tricks to let the
compiler handle the expansion of x = { fn(x[0]), fn(x[1]), ...
fn(x[N-1]) } for any N, and implemented most skvx scalar fallback code
using that.

With these now vectorizing well at any N, we can remove any
specializations we'd written for particular N, really tidying up.

Over in the SkVM interpreter, this is a big improvement for ceil and
floor, which were being done 2 floats at a time instead of 8.  They're
now slimmed way down to

   shlq       $6, %r13
   vroundps   $K, (%r12,%r13), %ymm0
   vroundps   $K, 32(%r12,%r13), %ymm1
   jmp        ...

where K is 9 or 10 depending on the op.

I haven't found a scalar function that Clang will vectorize to vcvtps2pd
(the rounding one, not truncating vcvttps2pd), so I've kept lrint()
written the long way, updated to the style I've been using lately with
specializations inline.

Change-Id: Ia97abe3c876008228bf62b1daacd6f6140408fc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317375
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-16 20:37:18 +00:00
Adlai Holler
2780656ef4 Remove SkSurface::getContext
Change-Id: Ia683f717a5d8c43da5ff0a05219db86ca5bde2e8
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android,Canary-Chromium,Canary-Flutter,Canary-G3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317109
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-16 18:47:18 +00:00
Mike Klein
7b1620f366 refactor skvx min/max
Implement min and max using if_then_else(y<x,...) on vectors
rather than recursing to std::min/std::max applied to scalars.

But actually, factor out and use naive_if_then_else(), which Clang can
reason through better than it can our specialized if_then_else().  This
lets every min() or max() I've looked at compile down to ideal codegen,
vmaxps, vpminsw, etc, where if you use if_then_else() you'd see the
literal comparison and blend as written.

I've been looking at q14x2 codegen in the interpreter, and most things
were already good, unexpectedly even uavg_q14x2.  The biggest surprise
was how bad the min/max codegen was, and looking back, even the min_f32
and max_f32 codegen is super bad.  This CL fixes all that, leaving us
with the ideal codegen using the specific instruction you'd want,
replacing a giant mess of code that recursed down to scalars.

mul_q14x2 is still bad, but an easy follow up.

Change-Id: I77b5d7c9aa20a9a2f5ceb3e40f1e18ace2a1b5c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317310
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-16 17:10:18 +00:00
Mike Klein
4108364efc _mm256_blendv_epi8 needs avx2
Change-Id: Ib10215e1e5a86bf78cc34f9dca670417bb217b73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317271
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-16 03:40:01 +00:00
Mike Klein
c3ad6a1e59 make skvx::if_then_else work at byte granularity
The default implementation of if_then_else is logically bitwise,

   (cond & true_val) | (~cond & false_val)

The existing skvx specializations work only for 32-bit lanes, but we can
easily make them work for any type where the whole vector is the right
size by reducing the granularity down to byte level.

Existing code using 32-bit values and 0xffff'ffff or 0x0000'0000 masks
will continue to work the same.  But this now lets us use, e.g. 16-bit
values with 0xffff and 0x0000 masks, or even things like 32-bit values
and a mask like 0xff00ff00, selecting byte by byte.

We can't go any lower without falling back on the generic bitwise
implementation, so we'll have to settle for not getting to use a mask
like 0x0f0f0f0f.

Change-Id: I8518cb3cafc7f6e1480b4ae8af50daad2d28c5df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317170
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-09-15 21:29:41 +00:00
Chris Dalton
31bf3d9bb5 Relax SkStrokeRec::hasEqualEffect
Ignores the miter limit if the join type is not kMiter.

Bug: skia:10419
Change-Id: Ib05895cf90c7bb0e25e9e8c3e26c13fef32f2e97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317163
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-09-15 20:05:40 +00:00
Brian Salomon
c2a9a9716e New version of SkImage::MakeFromYUVAPixmaps()
Takes SkYUVAPixmaps. Still implemented in terms of SkYUVAIndex[4]
internally.

Replace all internal use cases except wacky_yuv_formats.

Takes GrRecordingContext rather than GrContext.

SkVideoDecoder updated to take GrRecordingContext.

Bug: skia:10632

Change-Id: I6e9b9b6a4f11333bce6f87c1ebff0acb297f6540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316837
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-15 16:13:50 +00:00
Kevin Lubick
272e8bcd24 [fuzz] Add libfuzzer binaries to BUILD.gn
For the longest time, the libfuzzer binaries used by oss-fuzz
were just hacked onto the BUILD.gn file. This removes that patch
and makes them buildable from Skia proper.

After this, there should not be any modifications oss-fuzz needs
to do to a Skia checkout before it builds and runs.

Of note, oss-fuzz will define skia_use_libfuzzer_defaults to be
false so it can control those flags with more finesse (e.g.
fuzz with ASAN, fuzz with hong fuzz instead of libfuzzer). I
added on skia_use_libfuzzer_defaults so that a normal developer
gets something that works by default.

Bug: skia:10713
Change-Id: I024f5805060cba8f8560e1c2569b9309fb49a564
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316536
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-09-15 14:52:02 +00:00
Greg Daniel
37fd658981 Add input attachment support to program building.
This is also the final wire to connect, so with this CL we will try
using input attachments for dst blends in available.

Bug: skia:10409
Change-Id: I8bd953ea5eb056a55d8bf36d91008a9d7298d84d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315650
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-09-14 19:59:47 +00:00
Adlai Holler
302e8fb771 Downgrade SkImage to GrImageContext
We still occasionally downcast, so this is not airtight,
but it (1) allows us to know where we are downcasting and
(2) lets us move away from GrContext (and hopefully remove
it sooner than later.)

All three canaries are currently broken =( so here we go!

Bug: skia:104662
Change-Id: I84efe132574690b62ea512e194e4f9e318e9c050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316218
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-14 17:01:07 +00:00
Adlai Holler
d8dfd7a224 Elevate caps methods to GrRecordingContext
This partially unblocks Chrome from migrating from
SkCanvas-getGrContext to SkCanvas-recordingContext.

Change-Id: I1100387497ba8b482005bb1d147e9768590afe95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316449
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-09-14 15:58:57 +00:00
Kevin Lubick
493f89e577 [fuzz] Standardize, document, and backport fuzzing defines.
We had several defines around the code base that were not
very descriptive. Additionally, we had a patch of extra
runtime restrictions living in oss-fuzz that were applied
when fuzzing over there for some fuzzers.

This has all be consolidated and controlled via the defines
documented in site/dev/testing/fuzz.md

As such, we can remove one of the patches that is in oss-fuzz,
taking us closer to being able to fuzz in the CI/CQ.

PS 1 renames existing fuzz defines to the new schema.
PS 2-3 backports skia.diff from oss-fuzz and changes those
definitions to have the _GREATLY modifier.
PS 5+ further condenses the defines so that there is one
define for gating the runtime checks.

Change-Id: Ia4ad96f30c1e9620a2123b510e97c6f501a2e257
Docs-Preview: https://skia.org/?cl=316443
Bug: skia:10713
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316443
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-09-14 13:36:10 +00:00
Mike Reed
186866c461 expose clear way to create default mips
Change-Id: Id533b71d56fc44d8f86db24c5c4e9131d57479a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316716
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-09-12 15:19:15 +00:00
Ben Wagner
e4383b8f1e Add SkFILEStream constructor which takes a size.
Allows the user to limit the stream to a subset of the entire file.
SkFILEStream uses the current FILE position as the base position for the
stream; this allows the user to further limit the length of the stream
to a range of bytes in the file.

Change-Id: I36131ff19e75b65d501eabdfd9368f8fbb2e177f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316357
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-09-11 19:50:24 +00:00
Ben Wagner
bb60c2149e Refactor SkFILEStream for clarity.
Rename fSize to fEnd (since it is actually the offset of the end
underlying file, not the size of the file), fOriginalOffset to
fStart, and fOffset to fCurrent. Also initialize in the order fEnd,
fStart, then fCurrent to maintain the invariant that fCurrent should
always be kept within the range of fStart and fEnd, inclusive.

Change-Id: I8801288320cf82b071e4621c0e770ce16016953a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316453
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-09-11 19:49:04 +00:00
Florin Malita
66b45a7f40 [skottie] Add support for invert/YIQ
The Invert layer effect [1] also supports YIQ selectors [2]:

  -- YIQ
  -- Luminance (Y)
  -- In Phase Chrominance (I)
  -- Quadrature Chrominance (Q)

[1] https://helpx.adobe.com/after-effects/using/channel-effects.html#invert_effect
[2] https://en.wikipedia.org/wiki/YIQ

Change-Id: I54b1c81a786ff6f2bdea6456b45b435b2c0fea07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316446
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-11 14:55:44 +00:00
Greg Daniel
d358cbebd4 Add support for plumbing GrDstSampleType through Ops and Pipeline creation.
This CL adds a new type GrDstSampleType to say how we will sample the dst.

We add tracking of the GrDstSampleType in the recording of GrOps and
then during execution passing the information along to the GrPipeline.

In general the tracking of GrDstSampleType is a global state of a GrOpsTask
so it is kept separate fro the DstProxyView which is more specific to a
single Op on the GrOpsTask.

Bug: skia:10409
Change-Id: Ie843c31f2e48a887daf96cee99ed159b196cb545
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315645
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-11 14:42:34 +00:00
Mike Klein
215d2b0fa4 impl SkMulDiv255Round with SkMul16ShiftRound
Inlining shift=8 is trivial for any compiler.
This eliminates the need to unit test the two functions are the same.

Change-Id: Icd181ff11eab73fba26755a9fbecd57260c38bbf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315887
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-09-09 17:01:17 +00:00
Mike Reed
81606b5d97 remove unused (and bit-rotting) Lua support
Change-Id: I1ee2d21b79e929e5976825ae75aa4db960b034c9
Docs-Preview: https://skia.org/?cl=315856
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315856
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-09-09 14:33:32 +00:00
Mike Reed
d849a75ad3 use pathbuilder
Change-Id: Icb4d3f98440b53ba38270cc1f43fc43e6724d36b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315736
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-09-09 12:43:00 +00:00
Jim Van Verth
b8ae7fa12a Reland "Use Microsoft's ComPtr to wrap D3D12 objects."
This is a reland of 0ef049177f

Original change's description:
> Use Microsoft's ComPtr to wrap D3D12 objects.
> 
> Change-Id: I4bd173428a2b65f0bc1994fb794ef9d4d68d5ba0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314957
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Id0199db4061c67ed53da35e74dc31a004744be95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315655
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-09-08 22:04:05 +00:00
Jim Van Verth
bbbc28e0ba Revert "Use Microsoft's ComPtr to wrap D3D12 objects."
This reverts commit 0ef049177f.

Reason for revert: Looks like this is introducing a memory leak.

Original change's description:
> Use Microsoft's ComPtr to wrap D3D12 objects.
> 
> Change-Id: I4bd173428a2b65f0bc1994fb794ef9d4d68d5ba0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314957
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

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

Change-Id: Ib0333c00a7f8c3650bd2b077cbdfb6926c5870f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315653
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-09-08 19:09:24 +00:00
Jim Van Verth
0ef049177f Use Microsoft's ComPtr to wrap D3D12 objects.
Change-Id: I4bd173428a2b65f0bc1994fb794ef9d4d68d5ba0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314957
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-09-08 17:22:50 +00:00
Brian Salomon
9e5a60c9db Don't set BASE/MAX mip map level on PowerVR.
Speculative fix for Chrome crashes.

Implemented by separating out LOD and level caps.

Also don't allow GrContextOptions to enable manual mip mapping
if level control is not available.

Change-Id: Ibdf647792e1e018efeffa0af34ceb59e751e6749
Bug: chromium:1123874
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315638
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-08 17:22:30 +00:00
Brian Salomon
c6655070d0 SK_API on SkYUVAPixmaps::SupportedDataTypes.
Bug: skia:10632
Change-Id: I346529e6ef0d5f859b6959199dd05ddde2d72ebe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-09-08 14:46:10 +00:00
Brian Salomon
59c60b0cb3 Reland "Add idea of DataType to SkYUVAPixmapInfo."
This is a reland of ed63444587

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:10632
Change-Id: I35b55b7477c11c822fdb3729a9f84acff1eb785d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315284
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-03 18:05:17 +00:00
John Stiles
7571f9e490 Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'.
Mechanically updated via Xcode "Replace Regular Expression":

  typedef (.*) INHERITED;
    -->
  using INHERITED = $1;

The ClangTidy approach generated an even larger CL which would have
required a significant amount of hand-tweaking to be usable.

Change-Id: I671dc9d9efdf6d60151325c8d4d13fad7e10a15b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-03 03:41:26 +00:00
Michael Ludwig
c7fa895e50 Revert "Add idea of DataType to SkYUVAPixmapInfo."
This reverts commit ed63444587.

Reason for revert: trying to unblock android roller, which incorrectly thinks this has a merge conflict: https://b.corp.google.com/issues/167576324

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I72c39539a4766f10cac3ca3cdef6c503a8319ff1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314895
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-09-02 21:26:39 +00:00
Mike Klein
0ce0f6d5ab update SkNx allTrue/anyTrue
There's an _mm_movemask_ps() intrinsic that gets at the movmskps
instruction, which grabs the top (sign) bit of each float directly
without needing to reinterpret them as bytes.

I wouldn't really have done this but I think Chrome's clang is
miscompiling the version at head that uses _mm_movemask_epi8().  The
SkNx<2,float> `!(a+b == a*b).anyTrue()` test case fails when I use that
compiler, and spooky things like adding SkDebugf() make it pass again.

Change-Id: Idd0698d46ccfe9a00909faca1c6693a70e91157a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314860
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-09-02 17:11:45 +00:00
Mike Klein
a1711092b2 skvx spring cleaning
- remove some workarounds
  - more SI/SIN/SIT/SINT use
  - rewrap a lot of code to 100 cols
  - etc. misc.

Change-Id: I78b7ff272afcbb8658cf147aad8af85d0e2acf42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314676
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-09-02 15:22:55 +00:00
Brian Salomon
ed63444587 Add idea of DataType to SkYUVAPixmapInfo.
DataType describes the data type of YUVA channels
independent of how they are grouped into planes.

Adds mapping functions between SkColorType/channel count
and DataType.

SkYUVAPixmapInfo can be constructed from DataType and will
choose appropriate SkColorTypes for each plane.

Valid SkYUVAPixmapInfos now have the same DataType for each
plane (could relax this in the future, esp for alpha plane).

SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
combinations of SkYUVAInfo::PlanarConfig and
kYUVAPixmapInfo::DataType supported by a GrContext (based on
supported texture formats).

SkImageGenerator/SkCodec YUVA query API now takes a
SupportedDataTypes.

Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-02 13:21:45 +00:00
Brian Osman
a73c9d7606 Make some internal runtime effect API private
No public user needs these.

Change-Id: Ieeb519a0778b01697c9bbb3b91ce8423eaa94e57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314316
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-01 14:51:29 +00:00
Brian Salomon
ffd61ca012 Simpler SkYUVAPixmapInfo construction
Bug: skia:10632
Change-Id: I40636d004f8458b3eb578caeeb9e77594ce8bc54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313908
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-31 13:45:46 +00:00
Mike Reed
3872c98951 Move convexity enum out of public
Also, move first-direction into SkPathRef.h so it can be referenced
by name in SkPath (instead of using uint8_t)

No functional change expected.

Change-Id: Ica4a8357a8156fd9a516118f23599a965b0fdd47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313980
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-30 13:04:22 +00:00
Mike Reed
8702b8f444 don't return unknown from computing-convexity, as documented
Change-Id: I3b71a49a6329efe40f7388b1d4d9401edc1c7c88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313977
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-29 18:13:50 +00:00
Greg Daniel
ae1672bdb5 Remove the kFramebufferOnly flag from our validation checks again.
This flag was added recently since I noticed it was missing and should
be checked. However, Dawn fails this check in chrome since it doesn't
report this flag correctly to DDLs. Going back to the previous status
quo for now.

Bug: skia:10672
Change-Id: Ib825fe5a69bff7af0d9893b95cd4df80289be7b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313905
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-08-28 20:17:19 +00:00
Mike Reed
6052c0bee0 Only expose isConvex on path publicly.
Subsequent CLs can work on combining convexity and direction

Bug: skia:10670
Change-Id: Ia44769ea88ffd99a56d4c6729a80a2044e790ec2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313837
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-28 16:56:29 +00:00
Brian Salomon
280fa3d303 Remove use of texture swizzle in GL backend.
This has always been a potential source of a bug. If the same texture is
used twice in a shader with different swizzles we would overwrite the
swizzle for the first use by that of the second use since there is
only one fixed function swizzle per texture. It's not part of the
sampler state.

We set the swizzle when it is a feature, but always to RGBA.

Also, highly speculative that this may improve ANGLE D3D11 ES3
performance compared to ES2.

Bug: skia:10644
Change-Id: I8877afc3043c5ddaafd26ea9f9bd372303328c71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313682
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-08-28 15:22:29 +00:00
Mike Reed
43c78abe04 Remember to track convexity/direction for IsA shapes (e.g. oval, rrect)
In a follow-up, I will explore more clearly tying together convexity
and direction internally -- perhaps a unified enum?
    [ unknown, convex_cw, convex_ccw, concave ]

Change-Id: I9fc2a2205f40050f4c24c5bec7fc25c8b6d2461c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313680
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-28 12:51:57 +00:00
Greg Daniel
638b2e8594 Add GrInternalSurfaceFlag for vulkan input attachment.
This also includes all the plumbing of this flag throughout our proxy
and surface system.

Bug: skia:10409
Change-Id: I48d40012049240cfa80e045ea090f68ce2d2ff0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313676
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-27 20:05:29 +00:00
Adlai Holler
bcfc554fde Add GrDirectContext arg to SkImage::readPixels
Note: The polarity of the staging flag is inverted from usual because
a G3 dependency with no SkUserConfig.h relies on the legacy API.

Once this lands, we will migrate them and others, then remove the
staging API. The inverted staging flag is kind of nice, actually - I may
use that pattern in the future. It means less total CLs and it's just as
easy to flip the bit on or off during debugging.

Bug: skia:104662
Change-Id: I48cba1eeae3e2e6f79918c6d243e0666e68ec71b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310656
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-27 19:26:29 +00:00
Brian Osman
b6bd0d2094 Make SkRuntimeShaderBuilder safe for reuse
Previously, if you snapped off a shader and then changed uniforms
(without drawing & flushing), we'd trigger the SkData assert about
calling writeable_data when not-uniquely-owned. Now we lazily copy the
SkData when necessary.

Includes unit test that previously failed.

Bug: skia:10667
Change-Id: If8d9dd8106d41e66560d760cb36ed83371791fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313678
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-27 16:09:37 +00:00
Brian Salomon
be0e42cb8f New helpers for SkYUVAInfo when used with pixmaps.
SkYUVAPixmapInfo is a SkYUVAInfo with per-plane color types and row
bytes. It describes a set of pixmaps that make up a planar image.
Consolidates validity checks of the SkYUVAInfo with the color types
and row bytes. It can provide SkImageInfos for each plane and also
assist with configuring planes to share a common allocation.

SkYUVAPixmaps is a collection of SkPixmaps that are valid for a
SkYUVAInfo. It can either wrap existing SkPixmaps or allocate and
own the memory. It consolidates validity checking of SkPixmaps with
the SkYUVAInfo. Replaces sk_gpu_test::YUVAPixmaps.

Minor tweaks to SkYUVAInfo naming, parameter order consistency, adds a
hasAlpha() method.

Bug: skia:10632
Change-Id: Ib0f48b8448fff22805fd0c04e07887d0b7338b76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312886
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-27 15:39:56 +00:00
Greg Daniel
398ecf1876 Remove unused factories that take characterizations.
Change-Id: I871319ee663261c06f9f9270813ee2908e38fecb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313576
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-26 21:29:44 +00:00
Ben Wagner
4d09f2d15c Format and comment SkScalarInterpFunc
Consistently use less than for comparisons and ordering and add braces.
Make documentation a bit more direct.

Change-Id: I3286ff3fac3e276b2e40afab5c9a27e202eab9cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313556
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-08-26 20:50:34 +00:00
Mike Reed
f2845ac499 Always (pre)compute path bounds when using a builder
Change-Id: I42ce8d2c7e6852a85b3aa798c772a2a0b1ce6c3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313477
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-26 19:24:34 +00:00
Mike Klein
62a0f15f33 remove __ARM_FEATURE_CRC32 workaround
Just noticed that this is no longer set for -arch arm64
(but is, correctly, for -arch arm64e).

Change-Id: I607bb052ce67f91186852156d832d97eed33788b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313239
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-25 22:36:41 +00:00
Mike Reed
ad5494d1d9 use pathbuilder
Change-Id: I11c18d4ff0e60cc33d742cf49359039395abc6b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313256
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-25 22:27:20 +00:00
Mike Reed
92f6eb1602 use pathbuilder
Change-Id: I2bca419a3273a9cc8a984b0f4159f518968c6652
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313077
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-25 16:29:48 +00:00
Mike Reed
58cc97a11f Use factories to avoid using (deprecated) path editing methods
Change-Id: Iae9944f6bba5a91c4643b3c3745c4c352bd07a17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312845
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-24 19:53:13 +00:00
Jim Van Verth
36b86aff6b Revert "Remove ARC from Metal backend"
This reverts commit 6541013b53.

Reason for revert: TSAN issues with GrFence, and crash in GrMtlPipelineStateBuilder::CreatePipelineState.

Original change's description:
> Remove ARC from Metal backend
> 
> Change-Id: I5ab28f6eda3b37d1b82c94c7cc6eaa2ce59157da
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311113
> Reviewed-by: Adlai Holler <adlai@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,bsalomon@google.com,adlai@google.com,johnstiles@google.com

Change-Id: I031629b483fc46de8bd3751253e5391c2ce87853
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312843
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-24 17:16:54 +00:00
Jim Van Verth
6541013b53 Remove ARC from Metal backend
Change-Id: I5ab28f6eda3b37d1b82c94c7cc6eaa2ce59157da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311113
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-24 16:20:42 +00:00
Brian Salomon
87d42e5d12 A new way to specify YUVA planar data from SkCodec to SkImage_Lazy
Tunnels through SkImageGenerator as well.

The new SkCodec interface doesn't assume three 8 bit planes.

New SkYUVASpec more clearly defines chroma subsampling and siting of
the planes.

The intent is to use this for other YUVA APIs as well, in particular
SkImage factories in the future.

In this change we convert to the SkYUVASpec to SkYUVASizeInfo
and SkYUVAIndex[4] representation. But the intent is to use
the SkYUVASpec representation throughout the pipeline once
legacy APIs are removed.

orientation GM is replicated to test a variety of chroma
subsampling configs.

Bug: skia:10632

Change-Id: I3fad35752b87cac16c51b24824331f2ae7d458d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309658
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-08-24 14:25:32 +00:00
Mike Reed
370cbc70e0 remove legacy signatures
Change-Id: I2b12d938d29b71408eb4d35988c8e66b5421c3af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312638
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-23 01:07:52 +00:00
Mike Reed
d16d654762 use pathbuilder
Change-Id: I996e4ad9a603db42d9ae750488db44ee3e84d742
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312637
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-08-22 19:33:32 +00:00
Mike Reed
457c6ddff0 remove unused enums for picture-recorder
Change-Id: I43e74a56d0aa68260ac9a9020a06a308ad75f694
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312248
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-08-21 21:20:40 +00:00
Greg Daniel
7b62dcae5a Add image usage flags to GrVkImageInfo
Bug: skia:9898
Change-Id: I46a66d4415af0bb013201ce756e8dbceb9e234cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311437
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-21 16:34:20 +00:00
Greg Daniel
6a4e145832 Make some public vulkan structs use default initialization.
We will still need to go through clients to remove uses of the main ctors
so that it can be deleted.

Change-Id: I7bdfa00ac56b2404cc7b2f183104ee97b4da1de7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311452
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-08-21 14:33:20 +00:00
Heather Miller
2f2658506c Update Skia milestone to 87
Change-Id: Ic755236e56a0b8064c5539c0a483fffbd4d9f334
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312156
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2020-08-20 12:50:02 +00:00
Mike Reed
4aac2f95c6 Can we remove this flag to picture-recording?
Change-Id: I08b75bee4d86b8539ee4374c699a3a1003b67784
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311725
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-20 12:29:42 +00:00
Chris Dalton
6b3c2f653b Move GrWangsFormula::nextlog2 to sk_float_nextlog2
Other code outside this namespace will want to use this method soon.

Bug: skia:10419
Change-Id: Ib155f224866fd333b8f9a4b78e6c9e51ac0600df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311936
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-08-19 23:45:12 +00:00
Adlai Holler
ed1bf120d9 Remove GrContext variant of SkImageGenerator::isValid
This method isn't used by anyone, and I needed to land SOMETHING
in the middle of banging my head against CL 310656 :-)

Bug: skia:104662
Change-Id: Iaf529ac7551b22213891eb4be78d7904938aa989
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311816
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-08-19 19:47:14 +00:00
Mike Reed
18305c3d36 pass 'nested' bool to approximateOpCount
Change-Id: I5b1baf2bc3aafa03c1d0cace4f7c09a09cf4a084
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311112
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-19 16:45:53 +00:00
Ben Wagner
81eabce6a3 SkCustomTypefaceBuilder to set SkFontStyle
Allow the user of SkCustomTypefaceBuilder to set the SkFontStyle of the
resulting SkTypeface. This allows users to build font families.

Fix the Font_flatten test to actually work (instead of relying on the
magic behavior of nullptr for SkTypeface), add a test with the custom
typeface, and reduce the number of times the inner loop runs from
302,400 times to 4,032 times so that the test finishes in a reasonable
amount of time.

Bug: skia:10630
Change-Id: I0b5e939552ee4a9a1249eefbb7a7279a59b38e5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311596
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Xiao Yu <xster@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-19 00:09:55 +00:00
Robert Phillips
8e54a6e9e1 Enhance assert to dump more information
Hopefully, this will let Chrome track down promiseImage fulfillment
mismatches.

Bug: 1116848
Change-Id: Ia1e5d6f7af4e2808ae4adfad85f4e96c1ea4fbd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311096
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-18 13:53:25 +00:00
Mike Reed
e9d783c4d2 use pathbuilder
Change-Id: I4b40107b45cd829595e89d75e19fd063acee4221
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311106
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-17 22:05:00 +00:00
Mike Reed
15a5403cd3 Migrate to using SkPathBuilder
Change-Id: I86a75670d7b919313747175ca3e49ef7472061fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310977
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-17 14:17:49 +00:00
John Stiles
a008b0fa8b Enable ClangTidy check readability-redundant-smartptr-get.
To my surprise, this even works with homegrown smart pointers (such as
SkTLazy).

https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html

Find and remove redundant calls to smart pointer’s .get() method.

Examples:

  ptr.get()->Foo()  ==>  ptr->Foo()
  *ptr.get()  ==>  *ptr
  *ptr->get()  ==>  **ptr
  if (ptr.get() == nullptr) ... => if (ptr == nullptr) ...

Change-Id: I8ff541e0229656b4d8e875c8053a7e6138302547
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310976
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-16 15:56:48 +00:00
John Stiles
fe0de30a87 Enable ClangTidy check modernize-use-nullptr.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.

Change-Id: Iaea2d843154c70e49d62affdc5dceb3bca8c1089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310297
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-14 16:14:30 +00:00
Robert Phillips
2bfee21d94 Require a direct context to precompile a DDL's programs
Change-Id: I0c16c1cb2181a22ec0339d993a031d0fef0fc276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310068
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-14 14:35:41 +00:00
Florin Malita
c9c4e2e9ef Componentize SkAudioPlayer
Relocate under modules/audioplayer and package as a standalone
component.

Change-Id: If9dc72bb0abe170049a514c9931186703a3c138a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310058
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-08-14 13:46:06 +00:00
John Stiles
1cf2c8d6ec Enable ClangTidy flag modernize-use-override.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html

Adds override (introduced in C++11) to overridden virtual functions and
removes virtual from those functions as it is not required.

virtual on non base class implementations was used to help indicate to
the user that a function was virtual. C++ compilers did not use the
presence of this to signify an overridden function.

Change-Id: If66d8919358f72a4035190caf8d7569268037a9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310160
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-14 10:54:45 +00:00
Leon Scroggins III
326b98981e Add platform image encoder for using NDK APIs
Bug: skia:10369

Add SkEncodeImageWithNDK, mirroring the CG and WIC versions, for
encoding with the NDK APIs added to R.

Rename SK_ENABLE_NDK_DECODING to SK_ENABLE_NDK_IMAGES and use it for
both encoding and decoding.

Move code for converting to/from NDK types into a common location.

Update encode_platform.cpp to use NDK encoding APIs when available and
to use both types of webp (lossy and lossless). Add tests specifically
for the new implementation.

Update NdkDecodeTest to use ToolUtils::equal_pixels for comparing
pixels.

Change-Id: Ic62f89af27372ccce90b8e028e01c388a135a68c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308800
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-13 15:21:41 +00:00
Mike Reed
8a8be22597 audio player (for mac)
Change-Id: I491df748d22dfa566000c265a61f62f81755e5a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309792
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-13 15:09:32 +00:00
Adlai Holler
14dc791bc4 Reland "Migrate SkImage::MakeFromTexture to GrRecordingContext"
This reverts commit 74b83a4ea9.

Reason for revert: Flutter is updated

Original change's description:
> Revert "Migrate SkImage::MakeFromTexture to GrRecordingContext"
> 
> This reverts commit daa9e7455d.
> 
> Reason for revert: Broke Build-Debian9-Clang-arm-Release-Flutter_Android_Docker
> 
> Original change's description:
> > Migrate SkImage::MakeFromTexture to GrRecordingContext
> > 
> > Android migration landed in Android CL 12234077
> > Chrome migration is landing in Chrome CL 2335812
> > 
> > Note: makeFromCompressedTexture is not used by Chrome.
> > 
> > Bug: skia:104662
> > Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Auto-Submit: Adlai Holler <adlai@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> 
> Change-Id: I570945521c6cd78dfeea81e492b7e2b31dd0e6f5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308505
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

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

Bug: skia:104662
Change-Id: Ie1d7fd9e597e6e6e5bd91bec086e83a8c1f45a37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309321
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-12 18:35:51 +00:00
Robert Phillips
079455c739 Make the GrSmallPathAtlasMgr a flush-time object
This will allow the small path renderer to be used w/ DDLs.

This is broken out of the omnibus CL:

https://skia-review.googlesource.com/c/skia/+/307776 (Split the small path renderer into record-time and flush-time pieces)

Bug: 1108408
Change-Id: I64cc6ff677d0aead7cf2f097c0e7fbb15b49d49d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309304
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-12 13:30:56 +00:00
Leon Scroggins III
4f4be9bd4b GrVkTypes: Change externalFormat to be uint64_t
This matches the Vulkan type. This also fixes a warning when comparing
to another uint64_t.

Update GrVkSamplerYcbcrConversion::Key to match as well.

Change-Id: I6fc5d9456ee466dc3d98240acf935139a7808a02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309325
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-11 20:33:18 +00:00
Adlai Holler
c41ae2a3cf Reland "Migrate MakeCrossContextFromPixmap to GrDirectContext"
This reverts commit ae04cc9099.

Reason for revert: Flutter g3 roll complete

Original change's description:
> Revert "Migrate MakeCrossContextFromPixmap to GrDirectContext"
> 
> This reverts commit 066f7d6b1a.
> 
> Reason for revert: Cant land until flutter PR 20235 reaches g3
> 
> Original change's description:
> > Migrate MakeCrossContextFromPixmap to GrDirectContext
> > 
> > This function isn't used by Chrome so we migrate directly.
> > Flutter migration is at https://github.com/flutter/engine/pull/20235
> > 
> > Bug: skia:104662
> > Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> 
> Change-Id: I100a87075ffdf5c0cda78c95f1cfe3310f97630e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308501
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

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

Bug: skia:104662
Change-Id: I32e36aa1c70902296e7f28d0f8b52d4e55b264a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309320
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-11 19:53:06 +00:00
Jim Van Verth
765c5928ef MSAA improvements for Direct3D.
* Fixes quality value
* Enables grabbing sample positions
* Enables centering samples for non-hardware AA

Change-Id: I5cabc0804b4a57347b7072b100c17310155c0ebc
Bug: skia:10476
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308798
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-11 14:21:05 +00:00
Robert Phillips
5edf510941 Add plumbing for access to the flush-time GrSmallPathAtlasMgr
This isn't connected to anything yet and parallels what is done
for the text GrAtlasManager.

The rough pattern is that the GrContext hierarchy implements creating
the atlas but it is only exposed/made available via the flush state
(which derives from GrDrawMeshOp::Target).

TBR=bsalomon@google.com
Bug: 1108408
Change-Id: Iad7b5648877dbd20840e8d47c1d24131098ded94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309128
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-11 12:53:55 +00:00
Brian Osman
a4b9169fb6 Remove 'in' variables from SkRuntimeEffect
Runtime effects previously allowed two kinds of global input variables:
'in' variables could be bool, int, or float. 'uniform' could be float,
vector, or matrix. Uniform variables worked like you'd expect, but 'in'
variables were baked into the program statically. There was a large
amount of machinery to make this work, and it meant that 'in' variables
needed to have values before we could make decisions about program
caching, and before we could catch some errors. It was also essentially
syntactic sugar over the client just inserting the value into their SkSL
as a string. Finally: No one was using the feature.

To simplify the mental model, and make the API much more predictable,
this CL removes 'in' variables entirely. We no longer need to
"specialize" runtime effect programs, which means we can catch more
errors up front (those not detected until optimization). All of the API
that referred to "inputs" (the previous term that unified 'in' and
'uniform') now just refers to "uniforms".

Bug: skia:10593
Change-Id: I971f620d868b259e652b3114f0b497c2620f4b0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309050
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-08-10 22:00:44 +00:00
Robert Phillips
3262bc8f66 Clarify that the GrDirectContext uniquely holds the text atlas manager
Bug: 1108408
Change-Id: Iad0b634a8a0d6dac64e3571a32e755d124401f66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309077
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-10 17:23:54 +00:00
Mike Reed
375721d7bb SkPathView for ownerless (can live on stack) SkPaths
Follow-on CLs will push higher up in SkDraw, so that everywhere today
we have to cons-up (with the associated mallocs) a temp SkPath we can
replace it with a stack-based SPath...
- drawRect
- drawOval
- drawRRect
- drawLine(s)
(similar to how this CL already handled quads and triangles)

Bug: skia:10566
Change-Id: I882b4f4c60e80235ca83c86c926e905b269a7afd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307784
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-07 20:39:38 +00:00
John Stiles
ec9b4aab87 Enable ClangTidy check readability-const-return-type.
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html

`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)

In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.

This check does not affect pointer and reference returns, where
constness is important.

Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-07 17:42:38 +00:00
Brian Osman
871aa74797 Add support for children to runtime color filters
Like shaders, sampling a null child will return the input color (in
this case, the output of the skia shader stage). This gives us a path
to removing the implicit input color passed to main, which is the real
goal. Using this to create more interesting color filters is also
possible, although we need to add the versions of sample() that take a
color to really unlock the potential.

Change-Id: I6a7506055120756497d7583f14d6f928180825fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308515
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-08-07 14:50:36 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Adlai Holler
74b83a4ea9 Revert "Migrate SkImage::MakeFromTexture to GrRecordingContext"
This reverts commit daa9e7455d.

Reason for revert: Broke Build-Debian9-Clang-arm-Release-Flutter_Android_Docker

Original change's description:
> Migrate SkImage::MakeFromTexture to GrRecordingContext
> 
> Android migration landed in Android CL 12234077
> Chrome migration is landing in Chrome CL 2335812
> 
> Note: makeFromCompressedTexture is not used by Chrome.
> 
> Bug: skia:104662
> Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>

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

Change-Id: I570945521c6cd78dfeea81e492b7e2b31dd0e6f5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308505
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-06 17:25:09 +00:00
Adlai Holler
ae04cc9099 Revert "Migrate MakeCrossContextFromPixmap to GrDirectContext"
This reverts commit 066f7d6b1a.

Reason for revert: Cant land until flutter PR 20235 reaches g3

Original change's description:
> Migrate MakeCrossContextFromPixmap to GrDirectContext
> 
> This function isn't used by Chrome so we migrate directly.
> Flutter migration is at https://github.com/flutter/engine/pull/20235
> 
> Bug: skia:104662
> Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I100a87075ffdf5c0cda78c95f1cfe3310f97630e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308501
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-06 16:17:28 +00:00
Brian Osman
92aac1e1b3 Disallow runtime effect color filters that depend on position
Some of these checks are currently redundant (we don't allow color
filters to have children right now). But the next CL will re-add that
capability, and the unit tests here will ensure we don't re-break things
by allowing child-sampling to violate the color filter invariant.

Change-Id: I54c10d8b1d1e376c13347296765185d42b9f644a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-06 16:06:47 +00:00
Mike Klein
81b276ea98 add SkGraphics::AllowJIT()
Change-Id: I82aeea670c19e08e51ddc094f66f41244e4f5ec8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308497
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-06 14:38:26 +00:00
Adlai Holler
daa9e7455d Migrate SkImage::MakeFromTexture to GrRecordingContext
Android migration landed in Android CL 12234077
Chrome migration is landing in Chrome CL 2335812

Note: makeFromCompressedTexture is not used by Chrome.

Bug: skia:104662
Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-06 14:02:56 +00:00
Adlai Holler
066f7d6b1a Migrate MakeCrossContextFromPixmap to GrDirectContext
This function isn't used by Chrome so we migrate directly.
Flutter migration is at https://github.com/flutter/engine/pull/20235

Bug: skia:104662
Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-06 14:00:57 +00:00
Mike Klein
0d6f81593b iwyu fixes for VS 16.7's STL
This lets us build with the STL from the new Visual Studio 16.7 release,
https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.7.0

Specifically, I think this is from STL updates,
https://github.com/microsoft/STL/wiki/Changelog#vs-2019-167

Probably this one,

    <array> no longer includes <algorithm>, <iterator>, and <tuple>; this is
    a source-breaking change for projects that weren't strict about
    including what they use. #482

Change-Id: Id95a7966c636b70b56522bc80e6daa626749e916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308496
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-06 13:45:07 +00:00
Leon Scroggins III
f21d6b9b71 Reland "Add an SkImageGenerator that uses NDK APIs"
This reverts commit 07438b0cda.

Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 18:55:30 +00:00
Adlai Holler
2bc83187bf Remove staging API for SkImage::makeWithFilter
Chrome migration landed in CL 2335640

Bug: skia:104662
Change-Id: I787d7f469ff474bec1e7e2803cdd492e18821a6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308191
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-05 17:51:46 +00:00
Adlai Holler
f7129fc173 Migrate MakeFromAdoptedTexture to GrRecordingContext
This also follows up on the comments Rob left in his zombie review.

Bug: skia:104662
Change-Id: I7031f7b2832eb3f47025e5d269248b854cc912e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307780
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-05 17:47:25 +00:00
Leon Scroggins
07438b0cda Revert "Add an SkImageGenerator that uses NDK APIs"
This reverts commit cfef980939.

Reason for revert: Breaking Google3 roll

Original change's description:
> Add an SkImageGenerator that uses NDK APIs
> 
> Bug: skia:10369
> Bug: skia:10371
> 
> This will allow Skia clients developing for Android 11+ to rely on
> Android's NDK APIs for decoding, which will allow them to decode
> without including their own decoding libraries (e.g. libjpeg-turbo).
> Using these APIs also provides support for static HEIF images.
> 
> Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
> visually.
> 
> Add tests and a grayscale png.
> 
> Update some test bots running Android R to specify ndk_api so they will
> run the new code.
> 
> Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

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

Change-Id: Ifed506a76a0ff5903d101c1bf7330d319b8376a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10369
Bug: skia:10371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308180
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 14:42:51 +00:00
Leon Scroggins III
cfef980939 Add an SkImageGenerator that uses NDK APIs
Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 13:44:39 +00:00
Adlai Holler
273bc3000d Remove two staging APIs post-Chrome-migration
These two staging flags were removed in Chrome CL 2327135

Bug: skia:104662
Change-Id: I5b794f0c5e2c53cca82ec471dda3da3a722f5c9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307781
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-04 18:48:00 +00:00
Ben Wagner
6fbd92db65 Better serialize variations, separate SkFontData.
SkFontDescriptor and its serialization and usage are updated to better
reflect how variations should be serialized. In addition this begins
teasing apart SkFontData since it is now mostly an artifact of how the
FreeType port works than anything else.

This also removes SkTypeface::MakeFromFontData since it is no longer
used and since SkFontData (which it takes as a parameter) was never
public. SkFontMgr::makeFromFontData now only exists to support older
skps and may be removed in the future.

Change-Id: I266bd5e87de85788661cdf5c571592ea1f2ae669
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307344
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-08-04 16:38:26 +00:00
Mike Reed
093de4eb2c Use more of pathbuilder
Bug: skia:9000
Change-Id: Ia5c16ffbaeebbdd027c692c96095cfa181030d35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307702
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 21:04:55 +00:00
John Stiles
fbd050bd0b Enable ClangTidy check modernize-make-unique.
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.

This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.

Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-03 17:53:52 +00:00
Mike Reed
cfb130c662 Add arc methods to path builder
Bug: skia:9000
Change-Id: I0a25c6f792f59230762651386da74e547b073930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307558
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 15:50:01 +00:00
Mike Reed
74a7a81b98 fix addOval and addRRect on builder
Need to notify the underlying pathref if we've made oval or rrect

Bug: skia:9000
Change-Id: I57a801f1fb446b99634d7b028249a812a5a978f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307516
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 13:18:17 +00:00
Mike Reed
b746d5c02b add static factories for SkPath
Bug: skia:9000
Change-Id: I474d512cafd79d7c74b42ee86cb34c039fd960b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307458
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-02 23:40:06 +00:00
Mike Reed
4b4cd13d44 Builder has addPolygon, plus start hiding edit methods
Bug: skia:9000
Change-Id: I5d7df2d720090a6d9c80443b39041fb17ede4b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307347
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-02 21:33:06 +00:00
Mike Reed
5bc663a55b add relative segment methods
Bug: skia:9000
Change-Id: I1e7a4f3c799b7f6cd20e415880300a577a5a3c16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307346
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-01 18:07:24 +00:00
Mike Reed
2243d77c5c use pathbuilder
Bug: skia:9000
Change-Id: I08a50c9f5e9993d9dd427f154077c56f6097e947
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307345
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-01 02:32:04 +00:00
Leon Scroggins III
577536aa1a Remove "dummy" to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 162536543
Change-Id: I40df639e2f42da6d99d897a02cf05aecff682061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307226
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-07-31 19:11:23 +00:00
Jose Dapena Paz
dc4da5ac9a GCC: fix type passed to vcvt_f32_f16 to be a float16x4_t in SkVx.h
GCC intrisics type validation is stricter than the one in Clang, so
passing a uint16x4_t to a function expected to accept float16x4_t
is not valid.

Bug: chromium:819294
Change-Id: I6d68e5458345e78bdb05dd028481fe9cae36c5ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307276
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-31 19:09:33 +00:00
Florin Malita
76e22a31a8 Fix path builder initial gen ID
kEmpty means 'empty path', we want 0 to recompute as needed.

Change-Id: Ia9b2eb4f8e4b73ab2d5c05721cc9189be3653acb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307223
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-31 18:46:03 +00:00
Brian Salomon
17dc63f01d Don't define SK_GL when no other GPU backends are enabled
SK_GL must explicitly be defined to enable the GL backend,
e.g. by setting skia_use_gl in gn args.

Change-Id: I61008b5422f4690e6f012609b239cd74e63d9f92
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306732
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-31 14:14:35 +00:00
John Stiles
f8869a24e7 Remove SK_REQUIRE_LOCAL_VAR macro.
The ClangTidy check `bugprone-unused-raii` has been enabled at
review.skia.org/306838; this check provides equivalent protection.

Change-Id: I9f3858bfd2bede107d509a5a206a08293d5f914c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306953
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-31 02:32:01 +00:00
Mike Reed
dab30349d7 mark SkPathBuilder as SK_API
Bug: skia:9000
Change-Id: I9c557460bc9cfbfa6c0506219452ae149b43546c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306950
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-30 22:06:21 +00:00
Elliot Evans
6b2602ed2d Remove remaining usages of skvx::mad
This CL attempts to remove the remaining subset of skvx::mad usages.
https://skia-review.googlesource.com/c/skia/+/304853 removes all usages
of skvx::mad but causes small differences in rendering, so it is not
suitable for landing.

https://skia-review.googlesource.com/c/skia/+/306702/ removes all
non-nested usages of skvx::mad

Change-Id: Iab5d4cfd0feb856c38b3ebbfe3bf3ed5aad20fe6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306722
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Elliot Evans <elliotevans@google.com>
2020-07-30 20:41:09 +00:00
Adlai Holler
e34b282ed0 Migrate MakeFromAdoptedTexture to GrDirectContext
More recontexting for SkImage. Chrome flag in CL 2323135.
Flutter migration landed in https://github.com/flutter/engine/pull/19962

Bug: skia:104662
Change-Id: Id725eb130310639457ba90f378ecdb334dd5f3cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306182
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-29 20:15:00 +00:00
Ben Wagner
0795361b45 SkUNREACHABLE should fail, not be UB.
The use of __builtin_unreachable() and __assume(false) are actually
injections of undefined behavior. They do not crash and they may allow
the compiler to assume that any values which could cause that location
to be reached cannot occur. They should only be used after code which
cannot return but the compiler cannot know that (such as inline assembly
which does not return and calls to functions which should have been
declared noreturn but were not).

Replace their use with __builtin_trap() and __failfast(). These are
similar to __builtin_debugtrap() or __debugbreak() but also indicate
that execution should not be resumed.

Change-Id: I46c1362f4e86944cc8e03f6f5837875ac71b69f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297024
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-29 17:24:29 +00:00
Adlai Holler
52ea577f93 Migrate MakeFromYUVATexturesCopy* to GrRecordingContext
These methods aren't used by our clients – plus we're only de-powering the
arg here so we should do fine on canaries.

Bug: skia:104662
Change-Id: I2ff5a4e06a5e82458148d555b6dc8643e7e5f60f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306336
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-29 15:00:36 +00:00
Mike Reed
8c7ecc1c06 Revert "Revert "Never share pixels when we make a subset image""
This reverts commit 39d1c1ebb6.

Fix: update gm to handle failures from (bad) gpu: PreAbandonGpuContext


Change-Id: I5a8584ec3493df6c9b9bb94fb84716fda0aadccb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306378
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-29 12:42:16 +00:00
Mike Reed
3a608e5bc9 remove (unused) DirectTo... methods
Change-Id: Ie5eea2902c64fc44e4e6e53b1ee3b869d430d482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306331
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-28 23:47:07 +00:00
Mike Reed
39d1c1ebb6 Revert "Never share pixels when we make a subset image"
This reverts commit 3eff2459d4.

Reason for revert: did I break abandongpu bot?

Original change's description:
> Never share pixels when we make a subset image
> 
> - mostly just affects Lazy images (raster was already always copying)
> - issue with other factories that offer subsetting
>    - (e.g. MakeFromGenerator)
>    - can we remove those options, and require makeSubset() afterwards?
> - greatly simplifies dealing with mipmaps
> 
> Landing this would obsolete
> https://skia-review.googlesource.com/c/skia/+/305960
> 
> Related: https://skia-review.googlesource.com/c/skia/+/306136
> 
> Related: https://bugs.chromium.org/p/skia/issues/detail?id=10544
> 
> Change-Id: I074420543bd2fcd46ed1620bbf0eed00371ab018
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305970
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>

TBR=mtklein@google.com,bsalomon@google.com,robertphillips@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Iab2f92855fe61e48f0e432b7257eb7ddef78fcfa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306377
Reviewed-by: Mike Reed <reed@google.com>
2020-07-28 21:29:45 +00:00
Mike Reed
3eff2459d4 Never share pixels when we make a subset image
- mostly just affects Lazy images (raster was already always copying)
- issue with other factories that offer subsetting
   - (e.g. MakeFromGenerator)
   - can we remove those options, and require makeSubset() afterwards?
- greatly simplifies dealing with mipmaps

Landing this would obsolete
https://skia-review.googlesource.com/c/skia/+/305960

Related: https://skia-review.googlesource.com/c/skia/+/306136

Related: https://bugs.chromium.org/p/skia/issues/detail?id=10544

Change-Id: I074420543bd2fcd46ed1620bbf0eed00371ab018
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305970
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-07-28 21:20:57 +00:00
John Stiles
ace773d8c0 Use SkScalar type where appropriate.
Change-Id: Iec4c3dedd0790fc637a914517b2abbb8e303520f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306320
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-07-28 20:13:37 +00:00
Ben Wagner
1e67f7fced Mark sk_abort_no_print [[noreturn]].
It isn't expected that sk_abort_no_print should return (it should
abort). This also allows removal of the SkUNREACHABLE from SK_ABORT.

Also make sk_abort_no_print actually not able to return.

Change-Id: Ibd5eda019820ed7e91de37a048efdfb0d1097aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306188
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-28 17:40:31 +00:00
Mike Reed
564d49ec10 Remove subset parameter from making encoded/generator images
Since subsetting may require rasterizing/resolving the generator, we may
also need access to the GrDirectContext. To simplify apis, rely on
makeSubset() for that.

Related: https://skia-review.googlesource.com/c/skia/+/305970

Change-Id: I1980e3c823fb6cf54f197c350942c2f82b03e20f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306136
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-28 17:33:12 +00:00
Adlai Holler
c0ca856c05 Change makeTextureImage staging to allow either API
This fixes a Chrome canary failure in skia CL 305970 where
Chrome has the flag set, and so we can't internally call the
GrDirectContext variant.

This matches the more recent migrations we've done. Hopefully
soon Chrome's GrDirectContext CL will get its final approvals and
all of this can go away.

Bug: skia:104662
Change-Id: I09cdff54e01c22578a970e5967815a2e470752bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306185
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-28 15:05:26 +00:00
Leon Scroggins III
a4c8098aea Remove gendered language
Bug: chromium:1101491
Bug: b/161896447

Found using

  git grep -wiEIl \ '(he)|(she)|(his)|(hers)|(him)|(her)|(guy)|(guys)'

Change-Id: I6b91853de067fd4c2e84f7ec70275522ce6c8bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306186
Commit-Queue: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-28 15:02:41 +00:00
John Stiles
9119625aae Remove unnecessary macros from SkString header.
They have been replaced with equivalent constants (and given the
requisite k prefix).

Change-Id: I70907eec234e0861cc97aac1ca03086faca42f9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306160
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-28 15:00:21 +00:00
John Stiles
738c271b4a Update DataEntry struct to properly support move semantics.
Previously, DataEntry supported only move-construction but not move-
assignment.

Change-Id: I1dc1b2bc90a3dfe4cd74d4a6c2986b7d777f84d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306156
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-27 23:27:31 +00:00
John Stiles
0307e9114c Remove unreferenced function SkStrDup.
This isn't used, and doesn't seem like we will have a use for it going
forward. The SkString class should be used to allocate strings.

Change-Id: I024d1d7edb5d4946fa9ecfd4e10af84afc8b5df8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306065
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-27 21:31:37 +00:00
Herb Derby
53453f76b5 split transformed mask from SDFT
* transformed masks -> GrTransformedMaskSubRun
* GrMaskSubRun is SDFT -> GrSDFTSubRun

There is much duplicate code, which will be cleaned up shortly.

Change-Id: If54e388e89f7db15ddfd4b4354f0a1b4d6f5e36b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305686
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-26 16:59:44 +00:00
Greg Daniel
69267913ef Remove resource from GrD3DBuffer.
We will rely on the tracking of GrBuffers on the command list to manage
lifetime of d3d buffers. This also means we won't destroy the underlying
d3d buffer resource until the destructor.

Change-Id: I26084b8fffc65038891a0e48662d6a864c5dd8c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305719
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-07-24 20:30:00 +00:00
Brian Osman
b107a11f88 Add several more values to SkYUVColorSpace
Includes full-range Rec709 and BT2020, as well as more precise
matrices for 10 and 12 bit BT2020.

Bug: chromium:1108626
Change-Id: I28cbce982a00c082c8b510dbb7b144bdc1ce02e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305596
Reviewed-by: Dale Curtis <dalecurtis@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-24 18:49:10 +00:00
Kevin Lubick
7c8659256b Inclusive language
Bug: 842296
Change-Id: I4564f96d4f179211df19893270ccc222abcdd446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305439
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-24 13:33:53 +00:00
Robert Phillips
b25e0650dd Convert more tests to GrDirectContext/GrRecordingContext pair
TBR=bsalomon@google.com
Change-Id: I5bb78f4e36c4037669e7907cbe818da743480ef4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305009
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-23 12:49:06 +00:00
Mike Reed
3d30ca6d21 Add CubicResampler to makeShader
Only works on raster backend for the now.

Bug: skia:10344
Change-Id: I2c82d5345ae83a2bb2744ab27e3d971c57ea989e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303271
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 21:50:11 +00:00
Greg Daniel
95afafb2b0 Reland "Add GrContext api to update compressed backend textures."
This reverts commit ceebe424b1.

Reason for revert: relanding with fix

Original change's description:
> Revert "Add GrContext api to update compressed backend textures."
> 
> This reverts commit 2c180304dc.
> 
> Reason for revert: attempted workaround did not fix techno spark so needs further investigation
> 
> Original change's description:
> > Add GrContext api to update compressed backend textures.
> > 
> > Bug: chromium:1099255
> > Change-Id: I0c3f25ddb037e47e3b910fa89c3d8b3aa27b3114
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302265
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: Ib5433def02dc5dad97dcdbd4476ced6de2361e6a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1099255
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302576
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

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

Bug: chromium:1099255
Change-Id: Ie238a56b7f12fea8b6e251a050e5e2f4b20d2ede
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304741
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-22 16:46:55 +00:00
Adlai Holler
40ad5fd50a Migrate SkImage::flush methods to GrDirectContext
Flag landed in Chrome CL 2310889.

Bug: skia:104662
Change-Id: I616c7e6cd16104132bb0764c6d786a5cbeb4dd47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304797
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-22 15:02:35 +00:00
Adlai Holler
247835b6c8 Reland "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit d13b97f94c.

Reason for revert: Fixed chromium canary

Original change's description:
> Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
>
> This reverts commit 7f0129d424.
>
> Reason for revert: Broke Chrome roll
>
> Original change's description:
> > Migrate SkImage::makeWithFilter to GrRecordingContext
> >
> > The staging flag landed in Chrome CL 2307531.
> >
> > Bug: skia:104662
> > Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Bug: skia:104662
Change-Id: I815677659f776966b1c7e362ce3df444834dd482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304803
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-07-22 12:58:23 +00:00
Adlai Holler
01373555fe Remove GrContext variant of SkImage::isValid
Chrome was migrated in CL 2310974.

Bug: skia:104662
Change-Id: I0a49a7a6787fcce4c2a934c09140a3e4dad95869
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-22 12:49:23 +00:00
Brian Salomon
d007281c9a Fix clang 12 Wsuggest-override and Wsuggest-destructor-override
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 01:11:36 +00:00
Adlai Holler
d13b97f94c Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit 7f0129d424.

Reason for revert: Broke Chrome roll

Original change's description:
> Migrate SkImage::makeWithFilter to GrRecordingContext
> 
> The staging flag landed in Chrome CL 2307531.
> 
> Bug: skia:104662
> Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 20:02:10 +00:00
Mike Reed
22874781cf make more constructors constexpr
Intended to help https://skia-review.googlesource.com/c/skia/+/303271

Change-Id: I9a66e39ae7de84c30900f208b7368bdc1e2d8f0e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304740
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-21 17:44:57 +00:00
Brian Salomon
8c82a87a6b Rename GrTexture/Proxy/Priv mip map members/functions
Change-Id: Ib55cab0ef76ced165d1936e7d084edc7fa579c55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304737
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 17:43:17 +00:00
Adlai Holler
7f0129d424 Migrate SkImage::makeWithFilter to GrRecordingContext
The staging flag landed in Chrome CL 2307531.

Bug: skia:104662
Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 17:37:27 +00:00
Herb Derby
1d17e49041 constify GrAtlasTextOp::Geometry
fSubRunPtr is currently mutable, but that will change in future CLs.

Change-Id: Ia3ab40855d7ea7c42eadf8889688fefb064f1bc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304696
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 16:56:27 +00:00
Brian Salomon
69100f05bb Rename GrCaps fields and methods from MipMap to Mipmap
Change-Id: I44d151dc80aca8fc6426735ee17224cb5b8aa576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304603
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:56:21 +00:00
Greg Daniel
373d7dd0ed Add new GrContext::updateBackendTexture call that takes an SkColorType.
Change-Id: Iba71698f52eba3e7a99e0712a51ce48953b995db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304601
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:47:27 +00:00
Brian Salomon
40a40623c8 Rename GrBackendTexture::fMipMapped -> fMipmapped
Also mipMapped params to GrBackendTexture functions to mipmapped
GrBackendTexture::hasMipMaps -> GrBackendTexture::hasMipmaps

Misc test vars fMipMapped -> fMipmapped

Change-Id: Ic0651d14fc106c21b0ab45529875b95ed8dc2dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-21 15:29:06 +00:00
Brian Salomon
a6db510563 Rename GrMipMapsStatus GrMipmapStatus
For consistency with other enums and public APIs.

Change-Id: I026da5529f11051693cae5691c7ad92fad5ed446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304597
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-21 15:12:30 +00:00
Brian Salomon
7e67dcaea6 Rename GrMipMapped GrMipmapped
Change-Id: Ia2cfbca8982b57399b6681cbb4501c2933ab4df7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304576
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 14:06:35 +00:00
Mike Klein
5333784c8c remove stray weakref include
Change-Id: I016de62543b5ba16a7193262cea343a77a71ba3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304201
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-20 21:05:54 +00:00
Mike Reed
6d0ab954e9 read/write m44
Inspired by https://skia-review.googlesource.com/c/skia/+/303271

Change-Id: I64816f8db1742d263c8f668a7b44a08f20d82f5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304065
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-20 20:45:04 +00:00
Brian Osman
48a643daac SkRuntimeEffect: Always include GrTypesPriv, clean up variable type code
GrTypesPriv seems safe to include even without the GPU backend, which
lets us remove the condition from the struct layout. Hoisting and
reformatting the type conversion code just to make the core of the
factory easier to read. (More of this is coming).

Change-Id: I6e36b92789debc7b2630117c285c592ca7cbc37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304001
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-20 16:33:03 +00:00
Adlai Holler
9f1760bf73 Remove two unused deprecated SkImage functions
This is part of a larger effort to clean up the SkImage API and require
users to provide the direct GPU context for manipulating GPU images.

Bug: skia:104662
Change-Id: Ic7fd675a6ec09f001266fd79efdf084368ab6cd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303630
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-17 17:02:10 +00:00
Herb Derby
c24a6afdb0 create SkAtlasSubRun API subclass SkMaskSubRun
The SkMaskSubRun is just a temporary name while I pull out the
different subclasses.

Change-Id: I363742a98a0596ba3d282b918cc0492ab1e0e5d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303357
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-17 15:55:20 +00:00
skia-autoroll
3164b4494f Roll skcms from c21106442079 to f73242142ce5 (1 revision)
https://skia.googlesource.com/skcms.git/+log/c21106442079..f73242142ce5

2020-07-16 mtklein@papyrus.localdomain add skcms_TransferFunction_isFooish()

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skcms-skia-autoroll
Please CC nifong@google.com,mtklein@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Change-Id: I77846e3f984c295e25f7a72c38cdb0002de24a8f
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Tbr: nifong@google.com,mtklein@google.com
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303442
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-07-16 21:50:37 +00:00
Mike Reed
fd6f709ce8 Revert "Revert "Serialize mipmaps""
Fix: use ImageGenerator factory instead of SkCodec, in case the client
provides generators in some other fashion (other than SkCodec).

This reverts commit 442d424a72.

Change-Id: Ia22f44ef83900413f905fe38570d18a640fca98e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303496
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-16 21:30:27 +00:00
Adlai Holler
4caa935bfe Migrate MakeTextureImage to take GrDirectContext
This is part of a larger effort to force SkImage users to specify
the direct context they want to use when manipulating GPU images.

Chrome CL 2299194 (landed) enables the staging flag.

bug: skia:10466
Change-Id: I959db57dd8dca5c2622eb5ffaa7de161c4d6d8f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302643
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-16 16:17:28 +00:00
Robert Phillips
07531a0f97 Switch the DDLRecorder over to holding a GrRecordingContext ...
and related changes. This is another CL in the series that is replacing
GrContext with the GrDirectContext/GrRecordingContext pair.

Change-Id: Id0a3cfd5a5f92f7680d9c58f3a1753322311221c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302637
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-15 23:17:03 +00:00
Ben Wagner
c0693db3f5 Remove SkFontArguments::Axis.
Replaced with SkFontArguments::VariationPosition and
SkFontArguments::VariationPosition::Coordinate since the arguments are
about a variation specification and it's coordinates.
SkFontParameters::Axis actually deals with axes and their properties.

Change-Id: I377c9c5efa8e7b7e2649fc038f765062e30391e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302905
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-15 20:59:22 +00:00
Mike Klein
4d680cdf07 a bunch of half-related stuff
- add f32<->f16 functions to skvx
  - add f32<->f16 x86 instructions to skvm::Assembler
  - add f32<->f16 ops to skvm,
    using the skvx functions in the interpreter

Still TODO:
    use the new x86 instructions in the JIT

(For now like in many other ways, the aarch64 JIT
continues to languish.  Will pick that back up one day.)

Change-Id: Ib8dc1ccdc75ecb23769ea4947d66d3ab22520f23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302942
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-15 20:47:31 +00:00
Elliot Evans
72b8aea019 Fix experimental_simd CanvasKit build.
Although it appeared that the experimental_simd CanvasKit build was
working, the build was not producing actual wasm SIMD operations. This
CL fixes that issue by changing the build arguments.

This issue also fixes an incorrect type issue with the SkVx wasm SIMD
implementation.

Bug: skia:10453
Change-Id: If26f84b09e4d84df36be589245878c821972dffc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302669
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-15 20:39:42 +00:00
Adlai Holler
3a22017402 Reland "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit 779813a239.

Reason for revert: Avoid null dereference in DDL test case

Original change's description:
> Revert "Add a direct context arg to makeColorTypeAndColorSpace"
>
> This reverts commit a56da9ee92.
>
> Reason for revert: UBSAN complains in Vulkan OOPRDDL mode
>
> Original change's description:
> > Add a direct context arg to makeColorTypeAndColorSpace
> >
> > This is part of a larger effort to de-power SkImage and force users to
> > specify the GPU context for all new images.
> >
> > Staging flag landed in Chrome CL 2296632.
> >
> > Bug: skia:10466
> > Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10466
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

Bug: skia:10466
Change-Id: I59de0bd2b33989b1af08e8af2f8a52542b6b5db0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302829
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-15 17:21:44 +00:00
Mike Reed
13711ebe68 rename SkMipMap to SkMipmap
Change-Id: I1fa8a0482a717847236a30b4851061f4074b7755
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302644
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-15 13:26:13 +00:00
Adlai Holler
779813a239 Revert "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit a56da9ee92.

Reason for revert: UBSAN complains in Vulkan OOPRDDL mode

Original change's description:
> Add a direct context arg to makeColorTypeAndColorSpace
> 
> This is part of a larger effort to de-power SkImage and force users to
> specify the GPU context for all new images.
> 
> Staging flag landed in Chrome CL 2296632.
> 
> Bug: skia:10466
> Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-15 13:02:55 +00:00
Adlai Holler
a56da9ee92 Add a direct context arg to makeColorTypeAndColorSpace
This is part of a larger effort to de-power SkImage and force users to
specify the GPU context for all new images.

Staging flag landed in Chrome CL 2296632.

Bug: skia:10466
Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-14 22:36:49 +00:00
Herb Derby
b2db9797c5 subclass GrPathSubRun from GrSubRun
Move PathGlyph to GrPathSubRun, and make the array for the path
data directly in the alloc instead of in a vector.

Change-Id: I861cb934e356f526f96e593d25019b00451f77b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302640
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-14 20:49:07 +00:00