We no longer need to maintain a separate `fTypeMap` for mapping types
to SpvIds, since the op cache handles this automatically.
We also now support deduplicating instructions that don't have a result,
such as decorations. (In particular, we needed to avoid emitting the
SpvDecorationArrayStride op every time the array type was accessed, but
this op doesn't have a result ID.)
Change-Id: I779b8c8e3de5973b8f487b28c0a8ece9a1041845
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529732
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, we stringized the types and put them into fTypeMap. Using
the op cache is a simpler mechanism that should work equally well.
Output diffs are almost all ID reorderings. In a few cases we
managed to deduplicate function types that stringize differently but
come out the same in SPIR-V (e.g. no float/half distinction).
Change-Id: If7de5b2dafa12d05c3c2c497a243e9e3908dfee7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529805
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
For importing into G3, this will simplify the regex needed
and allow us to stub out things not supported (e.g. gazelle)
Change-Id: I770f5dee6f29e555356742dae36212ad6cfb713a
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529836
Reviewed-by: Ben Wagner <bungeman@google.com>
Change-Id: I3f6e25ec7b31339bfc9bd2435bc9226e6d9be06b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529498
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Fix starting angle to be the positive x axis instead of the vertical
upward axis, support repeat modes, fix clipping of sectors that cross
the 0/360 degrees position. No longer cut off sweep gradients outside
start and end angle.
Update test font with new sweep examples from [1].
[1] https://github.com/googlefonts/color-fonts/pull/98
Fixed: skia:13208, skia:13209, skia:13210
Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts
Change-Id: I1bf4e3dd6184229dfd8b2a81aa6670e4f2be8937
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529460
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This reverts commit f274197de1.
Reason for revert: Glyphs are render wrong
Original change's description:
> Use Slugs to render non-Blob text
>
> Weaken the assert to allow Slugs to draw if the matrix is the same as
> when the Slug was created with.
>
> Bug: skia:13214
> Change-Id: If0820408208378d57711afb31082a918c00ffc63
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529811
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Bug: skia:13214
Change-Id: Ifa675b74f05f32f36d77d7b48ec157c308c9c076
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529936
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Herb Derby <herb@google.com>
Weaken the assert to allow Slugs to draw if the matrix is the same as
when the Slug was created with.
Bug: skia:13214
Change-Id: If0820408208378d57711afb31082a918c00ffc63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529811
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This used to be uint8_t and was changed to uint32_t to soak up some
unused bits. However, it turns out that it was actually sitting in a
three byte region, so declaring this uint32_t accidentally made SkGlyph
larger. Changing this to uint16_t should allow it to soak up two of the
three unused bytes.
Bug: chromium:1315972
Change-Id: If02dc5d9f38db2715fb08a762246d16055e06214
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529812
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Bug: skia:12701
Change-Id: Ic4eea73c37e4b9c02040d5f7ba7bd7beb468d53b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529721
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: Ic19d7591c90f75f04dd1c58b406f2b770f9780c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529351
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
If we start with an OpConstantComposite, then we do an
OpCompositeExtract from it, we can look up the result directly from op
cache and avoid doing any work. This helps our matrix code a lot.
Change-Id: Idfbdc0c69676b9c1e91cdc57bf0d6382b9b5d8d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529339
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Many chromium adjacent projects have started using this repo to fetch
all of the Vulkan and SPIRV repos in a single bundle. Using this ensures
that we get a group of repos that should work together (atomically), and
simplifies autoroller configuration (we just need one roller for
vulkan-deps that does transitive rolls of the children, rather than five
separate rollers).
Change-Id: I015edb5811be60eb2275cdfe195138317d341a03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529730
Reviewed-by: Eric Boren <borenet@google.com>
This library is now used by Dawn, so will be required to get the roller
working again. Landing this separately (and unused), first.
Change-Id: I22a820e4996299ccdc9181ac96fb617eb7933c5b
Bug: dawn:1365
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529725
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
PaintRotate needs to rotate counter-clockwise, but was rotating
clockwise due to passing the font's value unchanged to
SkMatrix::RotateDeg. Negate the value to achieve counter-clockwise
rotation.
For PaintSkew, we compute the tangent from the values in the font and
set up a skew matrix with that. Since we're using the trigonometric
functions to set up the matrix, the angle works in counter-clockwise
direction.
So this previously worked correctly for skew in the x
direction, but not in the y-direction due Skia using a y-down coordinate
system. Negate the y-angle from PaintSkew before calculating the
tangent and setting up the matrix.
Bug: skia:13190
Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts
Change-Id: I98329f9746bcc6e875c4f87982782470e0f0a17d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529076
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Dominik Röttsches <drott@google.com>
Add dimensions to the glyph digest to enable SkRemoteGlyphCache to build
SubRuns directly.
It would be nice to use SkGlyphRect to encode this information but,
the MSVC-2019 compiler has problems producing correct code on 32-bit
machines.
Change-Id: I519ffecf3c727f608a8e6972742aee04b65a283a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529613
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
https://en.cppreference.com/w/cpp/container/span/subspan
The real std::span::subspan in C++20 allows the "count" argument to
default to `std::dynamic_extent` (a fancy way of spelling ~0U). I didn't
think it would be worth adding `skstd::dynamic_extent`, but I did have
a use for an unbounded subspan, so I added a single-argument version to
SkSpan.
Change-Id: I297cc452cf2db727a3f9869ff8f46f3527e19370
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529603
Reviewed-by: Arman Uguray <armansito@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The field SkGlyph::fForceBW is currently used by the DirectWrite
SkScalerContext implementation to let generateImage know that
generateMetrics needed to fall back to aliased rendering in order to
load the glyph. This is part of a more general issue where
generateMetrics must generate the metrics based on some glyph
representation and then generateImage must use that same representation
to draw.
Currently this consistency comes from ensuring that generateMetrics and
generateImage make the same decisions, with the only real information
passed from generateMetrics to generateImage being the mask format.
However, there have always been multiple glyph represenations for a
given mask format (like outline masks vs. embedded bitmap masks) and now
there are four (soon to be five) different color formats. While the mask
format and bounds are enough to allocate the space for a glyph
rendering, this is not enough information for generateMetrics and
generateImage to agree on which glyph rendering to choose. The
additional required information has come from implicitly coding
generateImage to make the same decisions generateMetrics would have.
However, these decisions may have been based on information which is
expensive to compute, like probing the font for which representations a
glyph may have.
To transmit this extra information, formalize that generateMetrics may
state which decisions it made (which glyph representation it used) so
that generateImage can use this information explicitly instead of
implicitly. Do this by expanding fForceBW and renaming it
fScalerContextBits and documenting what it is used for.
Change-Id: I91ba747233447f4d7bea81b0dcde51e49fa705fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529604
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
The invariant for drawing is that this strike must be pinned in
the cache. If it is not, then dump a stacktrace.
Bug: chromium:1315730
Change-Id: I73a79d8d3c45262753ef64b679e4af23cd1d6eea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529557
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Based on some code archaeology, we believe that textures (not samplers)
should always be used for subpass inputs.
Change-Id: Ida461e20f3b4f236918e72076e9c008ac280b8ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529609
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Previously, we didn't usually generate OpConstantComposite ops for
matrices. Now, a matrix assembled from constants should come out as a
constant.
Change-Id: I458718901686dffb84e4079a81017d61195420d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529338
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The output changes here are almost entirely a wash, because we already
had support for caching scalars and vectors. Almost all changes are just
inconsequential reorderings of IDs, and the removal of RelaxedPrecision
decorators on constants (which were not meaningful).
Change-Id: I45340c4a240cb504b7c4a934b3db178d2f39ec99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528709
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This reverts commit acb8770918.
Reason for revert: possibly breaking g3 roll
Original change's description:
> skif:LayerSpace<SkRect>::roundOut/In have epsilon tolerance.
>
> Adds a little tolerance so that e.g. left=30.999994 with roundOut
> will still round to 31 not 30. Helps avoid cases where imprecision
> leads to including an entire unwanted row/column of an input image
> to an image filter.
>
> This Chrome change must land first:
> https://chromium-review.googlesource.com/c/chromium/src/+/3577185/
>
> Bug: chromium:1313579
> Change-Id: I143c8f99b90413a6b610f2b3a5e54e648777ca68
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528652
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: chromium:1313579
Change-Id: Ia5589858afb042fae142357983f5ccf50ecc0020
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529628
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
We have a new `writeInstruction` call which can cache instructions as
they are written. This allows us to reuse existing instructions instead
of recomputing the same things twice.
This feature is largely untapped in this CL. As a demonstration that it
works, we no longer check the `fNumberConstants` map when writing
numbers, and instead rely on the cache to deduplicate OpConstant
instructions. Followup CLs will leverage the feature more heavily.
Change-Id: I6c25d0c2db7888ace05c24f8f9961d25c91b93b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528817
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Evolution over time led to a bit of gnarly logic around sampler
creation in SPIR-V. I've untangled it a bit.
Change-Id: I1987dd9b06c66f55051d72a6de4e950813697dbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529499
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Historically this code generator has used -1 as a sentinel "invalid"
SpvID. It's clearer to give this concept a name. The "NA" name is
borrowed from SkVM, and existing code using -1 has been updated.
Change-Id: I1733df4fb0bd440f849390046a7f26973e518976
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529519
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Add dimensions to the glyph digest to enable SkRemoteGlyphCache to build
SubRuns directly.
Bug: skia:13192
Change-Id: I8e68fe4ef144344347d4bc23865821d8517709fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529517
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Bug: skia:12698
Change-Id: Ibd09f64d2f8690719d0cb6ed1f34abf6cdcf4497
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527916
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug fix for https://skia-review.googlesource.com/c/skia/+/529126
This only affects Graphite, so there was no need to revert and fix.
Bug: skia:12787
Change-Id: Iab20b26e90083f1659d0c6502bd8e2d85ecb6fec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529518
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This will allow `is_globally_reachable_op` to be used in other places.
Change-Id: I99ea05b0a1da685a24d96700b395b4d13df0993e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529122
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: Ia799cdff5288efe5d5d53e8d8f77cf32f3343371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529131
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
In profiling, calculating the inverse of the 4x4 every draw call or on
every clip operation was measurable, but it really only needs to be
done if the transform is stale before the next time it's used.
Code is a little cleaner now too, since we're staying skgpu:: types
more than before.
Bug: skia:12787
Change-Id: Ib6313f211c8ebd6a484878bf9975e5ad6a4e750f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529126
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>