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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>