Commit Graph

10685 Commits

Author SHA1 Message Date
Herb Derby
e32e1aba34 replace GrOpMemoryPool with GrMemoryPool
Change-Id: I93fdeaa3ea6be73619f82859bb53aa88fae3262b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329962
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-10-27 16:15:11 +00:00
Greg Daniel
65476e0f5b Add uma histogram tracking for the number of submit render passes.
This uma stat can allow us to look a few different things. First we can
look at the distribution of render passes per submit (including mean,
median, ect.). Additionally we can do things like sum the total number
of renderpasses from all submits and divide by the total number of
frames (Compositing.Display.DrawToSwapUs::TotalCount) to get the
average number of render passes per frame and not just submit.

Technically under the hood the ENUMERATION and LINEAR_EXACT macros will
do the same thing and we could just use ENUMERATION here. However to
match how chrome uses their UMA macros it is more correct to use the
LINEAR_EXACT since we aren't counting enum values. Chromes macros
actually have static asserts the values are or are not enums, but the
skia implementations do not.

Includes some minor updates to names to match chromes UMA macro values.

This still requires the chrome implementation of the new macro.

Bug: skia:10871
Change-Id: Idbc4d2fc649bbdefd0952a002c3327cb700b552b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329776
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-10-27 14:35:20 +00:00
Chris Dalton
81b270a659 Optimize SkChopCubicAt to chop at two points at once
Adds an SkChopCubicAt overload that performs two chops at once in
SIMD. Also updates SkChopCubicAt to accept T values of 0 and 1. This
has been the source of bugs in the past.

Bug: skia:10419
Change-Id: Ic8a482a69192fb1685f3766411cbdceed830f9b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327436
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-10-26 21:36:25 +00:00
Mike Klein
0a7e2fa5d5 remove dead computeSegmentMask()
Bug: skia:10866
Change-Id: I06c675a423380d30017ebcc5485d556211d403fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329390
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-10-26 15:23:43 +00:00
Ben Wagner
9abf719e67 Remove code guarded by SK_LEGACY_SURFACE_PROPS.
This removes the last of the SkFontHost LCD globals and the
SkSurfaceProps::kLegacyFontHost_InitType.

Bug: skia:3934
Change-Id: Ic2342a3ea3dbcd075d6817cbd3fc27274e376b8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329364
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-10-23 22:41:36 +00:00
Mike Reed
d6e6a3c507 update dox for drawPaint
Bug: skia:7745
Change-Id: I3b43aa28349d8525f85f6caaf416659f90c9b285
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328816
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-10-20 19:48:11 +00:00
Adlai Holler
9ae860a9fe Reland "Remove GrContext"
This reverts commit 3172208ad0.

Reason for revert: Fixed issues

Original change's description:
> Revert "Remove GrContext"
>
> This reverts commit 2edf18d818.
>
> Reason for revert: breaking wasm-debugger
>
> Original change's description:
> > Remove GrContext
> >
> > Woo!
> >
> > Change-Id: Ifa3ff7e79c7048c2f1d808cc9705593d72886f08
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326436
> > Auto-Submit: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ie05bda5dad7fb5d369ebe579d2e009fdb99c0729
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326941
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: I141a473439a2b444aac1944e434e8b48d9fda428
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327217
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-20 17:20:51 +00:00
Adlai Holler
b270568f29 Almost remove GrContext
This is everything except for literally removing the class.

Change-Id: I2f16caf865d1bcf9c0f267aed73313c0676a73bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327222
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-20 15:52:01 +00:00
Brian Salomon
9f8ee0dbb1 Remove legacy SkImageGenerator YUV planes interface
Bug: skia:10632
Change-Id: Iaed6b51e03ef9023a74d77f3262104c1677c416f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327917
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-20 13:44:11 +00:00
Brian Salomon
c1a249d1dc Revert "Revert "New variant of SkImage::MakeFromYUVATextures.""
This reverts commit be8004d2fb.

Bug: skia:10632
Change-Id: I52dd36ae167623563c7554c40092442a3822ee3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327760
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-19 15:37:29 +00:00
kylechar
97a1e67c45 Add context option to disable mipmap support
This is desired for a short term memory improvement on low memory
devices.

Bug: chromium:1138979
Change-Id: I7df41a9c4d21b7a7f62b738e6358b36dd262f77d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327345
Commit-Queue: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-10-19 14:50:59 +00:00
Brian Salomon
be8004d2fb Revert "New variant of SkImage::MakeFromYUVATextures."
This reverts commit fea12238ed.

Reason for revert: MSAN/SwiftShader failure

Original change's description:
> New variant of SkImage::MakeFromYUVATextures.
>
> Takes a new type GrYUVATextures. This a set of GrBackendTextures and
> SkYUVAInfo that have been pre-validated to be compatible.
>
> Bug: skia:10632
>
> Change-Id: Id252f8662ede0f268e88fd40dc1b0b8f4ab6345f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317762
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I5350d4f9b1eda0503fb0af9db8575a734bdc811f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327922
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 22:32:54 +00:00
Mike Klein
f60a76e2ac switch SkTPin impl to pin NaN to lo
It's just much easier to remember and think about
max(lo, min(x, hi)) than max(min(hi, x), lo), and
both pin NaN to one of the two limits.  I'm not sure
if anything in Skia depends on which limit we pin to.

Change-Id: Iceca36a8fffd7072180e82b8b6eb81cbdb5ac97f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327788
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-10-16 21:08:51 +00:00
Brian Salomon
fea12238ed New variant of SkImage::MakeFromYUVATextures.
Takes a new type GrYUVATextures. This a set of GrBackendTextures and
SkYUVAInfo that have been pre-validated to be compatible.

Bug: skia:10632

Change-Id: Id252f8662ede0f268e88fd40dc1b0b8f4ab6345f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317762
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-16 21:03:31 +00:00
Mike Klein
137068d837 impl SkTPin with std::{min,max}
Change-Id: I70b2fdea570a9091afc81a1455fa61f90b0357a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327786
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-16 21:01:01 +00:00
Mike Klein
8aa0edfed2 move SkTPin to include/private
Change-Id: Ib0dc823d331a7cddc5da1d1be83136ce803a7871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327783
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-10-16 19:45:11 +00:00
Mike Klein
a0c6731b12 update SkTPin()
- Reword the comment to explain how it differs from std::clamp().
 - Document and test an alternative form using std::{min,max}.

Change-Id: I3a97b98a15303478a5a7ff8d0536829f6d5f1586
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327696
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-16 15:50:32 +00:00
Brian Salomon
7db7139f40 Revert "Revert "Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.""
This reverts commit 839fb228ac.

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-arm-Debug-Chromebook_GLES
Bug: skia:10632
Change-Id: I7c9fc21f03dfd0537fed6074e550dd8a500a12b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327623
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 14:58:13 +00:00
Brian Salomon
839fb228ac Revert "Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage."
This reverts commit db0288d747.

Reason for revert: undeclared tuple size

Original change's description:
> Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.
>
> LazyYUVImage now supports making images from a generator and from
> textures. It uses ManagedBackendTexture to manage texture plane
> lifetime via ref-counting.
>
> Adds some supporting utility functions to SkYUVAInfo and
> SkYUVAPixmaps.
>
> Eases transition of forthcoming MakeFromYUVATextures API change.
>
> Bug: skia:10632
>
> Change-Id: I8cfd747c27076d1627da6ea8a169e554a96049e0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326720
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Icdfb70f7dadd97eace8f88d5a886d31534102f5f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327622
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 13:37:43 +00:00
Brian Salomon
db0288d747 Move all YUVA image creation in GMs into sk_gpu_test::LazyYUVImage.
LazyYUVImage now supports making images from a generator and from
textures. It uses ManagedBackendTexture to manage texture plane
lifetime via ref-counting.

Adds some supporting utility functions to SkYUVAInfo and
SkYUVAPixmaps.

Eases transition of forthcoming MakeFromYUVATextures API change.

Bug: skia:10632

Change-Id: I8cfd747c27076d1627da6ea8a169e554a96049e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326720
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-16 13:19:01 +00:00
Mike Reed
f1f1e7dd36 Hide shrinkToFit -- not needed now that we have pathbuilder
Step one is to make it private -- only skottie needs it at the moment
Stpe two is to modify pathops to use builders, and then we can likely
remove it shrinkToFit entirely (since builder.snapshot() is already snug).

bug: skia:9000

Change-Id: I9126bcb6fc2094fbeede2acb1f211b0ab771feba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-10-15 19:47:06 +00:00
John Stiles
f4bda743ff Rename SkTArray::reserve to reserve_back.
The semantics of `vector::reserve` and `SkTArray::reserve` were not the
same. SkTArray::reserve takes a delta over the current array size,
whereas vector takes a total array size. This could lead to subtle
errors with over- or under-reservation, hurting performance.

This CL renames `SkTArray::reserve` to `SkTArray::reserve_back` to give
the SkTArray behavior a distinct (hopefully easily understandable) name,
leaving its functionality as-is.

Change-Id: Icbd3114bb317fd5f307f393c02ae6fb6f83764e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326956
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-10-14 21:42:11 +00:00
Mike Reed
c924a88e33 SkPath::shrinkToFit() needs to perform copy-on-write
When we shrink a path, we might relocate its underlying arrays.
Doing so would invalidate any outstanding Iterators. The caller must
handle this for its path object, but there may be copies elsewhere,
which have just ref'd the underlying arrays. To keep these copys'
iterators alive, we defensively "copy-on-write", so as to not relocate
their buffers.

Incidentally, update SkContourMeasureIter's constructor to clarify that
it is iterating through its copy of the path, and not the original.

Change-Id: I5c9331ab36ac8e156218532478f6d7105fd97cdc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326438
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-10-14 20:24:11 +00:00
Robert Phillips
3172208ad0 Revert "Remove GrContext"
This reverts commit 2edf18d818.

Reason for revert: breaking wasm-debugger

Original change's description:
> Remove GrContext
>
> Woo!
>
> Change-Id: Ifa3ff7e79c7048c2f1d808cc9705593d72886f08
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326436
> Auto-Submit: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: Ie05bda5dad7fb5d369ebe579d2e009fdb99c0729
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326941
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-14 18:30:13 +00:00
Adlai Holler
2edf18d818 Remove GrContext
Woo!

Change-Id: Ifa3ff7e79c7048c2f1d808cc9705593d72886f08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326436
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-10-14 17:47:31 +00:00
Robert Phillips
52ace08ef8 Fix special case in SkRRect::setOval where the oval devolves to a rect
Bug:1119593
Change-Id: I6c25c54840f44b5143e40b4ec5da403a737e9d1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326441
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-10-14 17:44:51 +00:00
Adlai Holler
a069304560 Rename GrContextPriv to GrDirectContextPriv
Change-Id: I3fccadd8a2860dbee73f93f995738146373f8a39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326196
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-10-14 16:46:01 +00:00
Mike Klein
f4c6463695 refine SkPath::approximateBytesUsed()
Instead of looking at point/verb/weight counts, add an
SkPathRef::approximateBytesUsed() using their reserve counts.

This shows SkPathBuilder::snapshot() can return more memory-efficient
SkPaths than SkPathBuilder::detach(), at the cost of a copy.

Change-Id: I4e208c41643480d7682daba6ac674ffa63c74de2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326608
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-10-14 15:05:36 +00:00
Adlai Holler
53cf44cfaf Migrate GrContextPriv & ivars to GrDirectContext
After this, GrContextPriv gets renamed and GrContext gets removed.

Change-Id: I49b034e4669876becb50b93c5fe3af887481e1ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326158
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-10-14 14:32:49 +00:00
Mike Klein
9a6efa6be2 move scalar functions out of SkVx.h
Now that we have skvx::map(), anyone can write this sort of
scalar-to-vector code.  There are no vector instructions for these, so
they'll never going to be particularly interesting for SkVx to provide.

We did work out _approximate_ versions of each of these for SkVM, and
that's what we use to evaluate these programs there.  So if this stuff
really matters we could port that logic back over to SkVx.h.

But in terms of pure refactoring, I think this is where we want to sit
until we decide to use those approximations.  I don't really want to
invest much time in the SkSLByteCode interpreter any more.

Change-Id: I4e595dee5fd9e608905305e46b2aebcab986c561
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326277
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-10-14 14:24:46 +00:00
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