When 3D layers are present, we need a camera view even when no explicit
camera is present.
TBR=
Bug: skia:8914
Change-Id: I408986d516e03bc4f80c7c09103e09821704ff2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Currently, the camera view transform is attached to the render tree as a
TransformEffect. This means it gets "flattened" to an SkMatrix in isolation,
and does not compose with other layer transforms in 4x4 format.
Refactor the implementation to
- build the camera transform upfront
- compose (chain) all layer transforms from this camera transform
This ensures that transform composition happens in SkMatrix44.
E.g. render tree topology change (TE == TransformEffect)
Before:
[root]
|
[TE]<---[CameraT]
|
------------------------------------
| |
| |
[TE]<--[Layer1T] [Layer2T]-->[TE]
| |
[Layer1] [Layer2]
| |
After:
[root]
|
|
------------------------------------
| |
| [CameraT] |
| / \ |
[TE]<--[Layer1T]<-- --->[Layer2T]-->[TE]
| |
[Layer1] [Layer2]
| |
TBR=
Bug: skia:8914
Change-Id: Idd407712f75c48623b5299a4284ddb17b98c155f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249217
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
- Copy effect state to particle uniforms before each script, so changes
from spawn or update are visible.
- Guard path binding against out of range access
- New effect that actually stresses both of these conditions
Change-Id: Ice6112793099e515438af8bb863e9e1bf03d08b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249125
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Gives enough information to locate variables by name (using the same
scheme as glGetUniformLocation), and provide hints about type and size.
Bug: skia:9513
Change-Id: I9444f1042471967a79c9f05167dcdb78eca41bad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244502
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Simplify burst handling. Scripts should just add to burst (if
they want to handle programmatic bursting, as well).
Update most effects to handle dynamic updates to position better,
and add a sample effect meant to be used with mouse tracking.
Change-Id: Ia302e1d04e62e2b07974807c44067786cc10a8ad
Bug: skia:9513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248798
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Instead of rendering all .mp4 frames then encoding, we can kick off
rendering and have the encoder consume frames in order as they become
available.
This uses std::promise / std::future pairs to make the handoff: frame
producers fulfill thieir promise by moving their image into set_value(),
and the encoder (main thread) consumes them by moving those images out
of the paired std::future(). It may not be obvious, but the line
sk_sp<SkImage> img = frame.get_future().get();
does move the image into `img`... gMP4Frames does not hold a ref once
.get_future().get() has returned. (Though depending on when you look,
the surface still might.)
This lets us get going on encoding as soon as the first frame is ready,
and hypothetically means encoding should finish shortly after the last
frame draws. But, different frames cost different time to draw, and we
can't control the order they'll return. We _do_ have control over the
order they're started, and we're doing that exactly wrong using a LIFO
thread pool. I've added .mp4 encoding starvation stats to show this...
when I run in LIFO order it looks typically something like
starved min 0ms, med 0ms, avg 4.12333ms, max 2115ms, sum 2474ms
frame time min 12ms, med 292ms, avg 307.208ms, max 711ms, sum 184325ms
106.68user 57.27system 0:04.55elapsed 3601%CPU (0avgtext+0avgdata 3159748maxresident)k
0inputs+1528outputs (0major+772790minor)pagefaults 0swaps
Mirroring the batch order with (i = frame_count - 1 - i) results in less
starvation, less memory usage, better scaling, and a quicker wall time.
starved min 0ms, med 0ms, avg 0.896667ms, max 382ms, sum 538ms
frame time min 13ms, med 374ms, avg 344.365ms, max 918ms, sum 206619ms
111.64user 52.56system 0:03.62elapsed 4529%CPU (0avgtext+0avgdata 2660912maxresident)k
0inputs+1528outputs (0major+649031minor)pagefaults 0swaps
Change-Id: Ic60e8eac856af238ef32e3383d86f6c24e5c7851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247674
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Change-Id: If57514c9e7e8d0a417eb9388873bbb348fc49076
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247384
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This runs way faster than skottie2movie, even with Mike's patch.
We could probably ditch skottie2movie with this CL and one adding --gpu?
Change-Id: I41376c2cd636eb75a3a6d2aaa75bef48211a1021
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247377
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
This was only being used in one effect (and for no good reason). SkSL is
plenty powerful to re-implement something similar if required, at no
real performance cost.
Re-implemented the one effect that used it with simpler math in the
script, updated the copy of that effect in the gallery.
Docs-Preview: https://skia.org/?cl=247040
Change-Id: I68c86d6550dd4f003f6ba5ecd0febab37b86540b
Bug: skia:9513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247040
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Fixed some bugs for flutter tests
Change-Id: I43f4b4b185152a8d642127370da5f80fb96f1e9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239444
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Currently we only constrain vertically, assuming shaped lines don't
overflow horizontally. This is not true for very long words.
Update kVisualResizeToFit and kVisualDownscaleToFit to constrain in
both dimensions.
Also drop the early exit condition because
a) it makes less sense when checking in 2 dimensions (there are
multiple answers which fit snugly in one dimension, but we're
ultimately selecting for the largest font size)
b) it probably doesn't trigger much in practice
Existing tests cover the change in behavior.
Bug: skia:9471
Change-Id: I4e53a51500b02ba7db26dad249458bcf491b088a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246305
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
There are more parts of ParagraphStyle and TextStyle, but
this should be a bulk of the components.
Bug: skia:9469
Change-Id: I87fff6700f41cff49ecbee3a1339e84c36699c93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244837
Reviewed-by: Julia Lavrova <jlavrova@google.com>
The intent is to allow the creation of a MakeFontMgrRunIterator which
uses the passed font's typeface as the primary typeface, but uses a
given family name and style as for the request for fallback fonts. This
allows the user to provide the actual request for the primary typeface
as opposed to making a request based on the resolved primary typeface
(which may not be the right thing to do).
To support this, the selection of language for fallback is also added.
Since this information is already in the language iterator, this change
makes the font iterator the lowest priority iterator for consume,
allowing the font iterator to rely on the current value of the language
iterator to provide the language.
In order to allow these changes to be exercised, this also adds a few
generic 'Make' methods for bidi and script. These new methods will use
the best available implementation. These are needed since the most
capable implementations may not always be available (such as on our
testing ios builds).
Change-Id: I1b8d9c9007058adcb2a26e0581d903b835a6118f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245460
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
For motion blur we're sampling within some window around a given t.
If t is close to the layer in/out point, things get murky: for samples
which fall outside the layer lifespan, we skip drawing => fewer samples
are accumulated => the opacity of the result drops => visual glitches.
The solution is to modulate the frame alpha based on the number of
*visible* samples, and skip rendering when no samples are visible.
Bug: skia:9486
Change-Id: I8d9692ae1589b43d9e6f728d7b7ac2fbf39153fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245363
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
The lack of encapsulation was finally starting to bother me. Had to
change the Interpreter namespace to a struct so that it could be
friended, but otherwise this was a nice and simple cleanup.
Also updated the comments on the two run functions, and renamed
fInputSlots to fUniformSlots, to reflect recent clarification
around in vs. uniform.
Change-Id: I24bbc59778b3ab6448bffcf98133d5c149a060a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244883
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The CoreText version relies on undefined behavior and the DirectWrite
version makes an extra copy of the data. This fixes several issues
introduced in https://skia-review.googlesource.com/c/skia/+/229384 .
Change-Id: I29a2170465bafcf6fe7ae5ad107e85a9e882bd33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244721
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Limit the optional/top layer size to the dest area.
Change-Id: Ic3825ff3c12d87b01f18f52ea60bfc31710e2272
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244885
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Pre-compute the scale matrix based on the main thread animation size,
to avoid touching thread-local animations before null-checking.
Change-Id: Ib2b91d9db7d60a1bd31b21972de136fd838b8377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244836
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
- Update the parameter lists to both run and runStriped so
that they're in the same (sane) order, named consistently,
and always take counts with pointer arguments.
- Add the same count-based safety checks to run that were
already in runStriped.
- Remove the N parameter to run, it was only used to run
things one-at-a-time (other than one spot in unit tests),
and it simplifies the code quite a bit. If you want to run
multiple times, use the striped version. I also moved that
functions 'N' earlier in the parameter list, to make the
pattern of the remaining parameters clearer.
- Remove an interpreter benchmark class that was never used.
Change-Id: Ibff0a47bdb2d29d095a0addd27e65ab13cb80fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244716
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
By passing null into reportSurface, it "crashes" the test, allowing me
to visually inspect the results while running locally. However, on
production code, it just breaks the tests.
Change-Id: I93339f03ee5a9f86959b30353912526a442f6375
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244677
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This repurposes much of our embedded SkFontMgr code
to take in data directly instead of from compiled-in
variables.
Also makes no_font and no_embedded_font work better.
Bug: skia:9469
Change-Id: Ibde49c9a448cfca79c5712aa9abbe15997a163d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244510
Reviewed-by: Ben Wagner <bungeman@google.com>
This reverts commit 85705c1b3b.
Change-Id: If189dafce53491728296a4292c76af55b05835ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244509
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Useful for excluding encoder/IO from scaling tests.
Change-Id: Ib76cc07a54d3cd3e00b4a3b3c9ea6f049440b7f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244396
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
This reverts commit ac18a5ca60.
Reason for revert: breaking Chrome roll
Original change's description:
> remove 'in uniform' support from GrSkSLFP, make rules more clear
>
> Bug: skia:
> Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=brianosman@google.com,ethannicholas@google.com
Change-Id: I6e53f5197c751d961abfa21861b940d4168de213
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244508
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: I9d02ff9f6bcc86cdc10e01a4e3379014557172e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244507
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Bug: skia:
Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
I think this is largely free win if done once at process startup:
$ time out/skottie_tool -i ~/Downloads/mb/data.json -w before
166.59user 29.42system 0:06.13elapsed 3195%CPU (0avgtext+0avgdata 1994888maxresident)k
$ time out/skottie_tool -i ~/Downloads/mb/data.json -w after
93.36user 34.96system 0:04.76elapsed 2690%CPU (0avgtext+0avgdata 1968568maxresident)k
$ idiff before after
1333 files are identical.
Change-Id: I5454aed5e64bf78d61dfdc22ea1ce629714bd70c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244120
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
$ time out/skottie_tool -i ~/Downloads/mb/data.json -w after
Animation loaded with 2 errors, 0 warnings.
!! Could not create typeface for Google Sans|Bold.
!! Could not create typeface for Google Sans|Medium.
frame time min 28ms, med 286ms, avg 441.18ms, max 1982ms, sum 264708ms
93.74user 33.03system 0:04.70elapsed 2694%CPU (0avgtext+0avgdata 1976980maxresident)k
Things are looking pretty reasonable scaling-wise when we take ~5
seconds to run and some frames take up to ~2 seconds.
Change-Id: I0bfd955afcd9b8ac18e6614e1b5aa6889a06059a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244121
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Also removed some older effects that weren't interesting, improved others,
cleaned up the unused functions in several, and renamed most of them to
reflect which feature they're demonstrating.
Change-Id: Ib44a00ec3d25e852a1d1661918137ba13d30c86b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244119
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
There's an implicit +1 to the SkTaskGroup worker count, as the
main/scheduling thread also participates in the queue.
This is quite confusing.
Adjust the --threads parameter such that 1 means single threaded,
2 means rendering on two threads, etc.
Change-Id: Ib55c4b0a29cb342c7d18a15384e1c511614ee7af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243740
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Parallelize frame rendering and encoding:
- introduce a caching/pre-decoding resource manager.
- dispatch individual frames to a task group
- use per-thread animation instances and sinks
Change-Id: I91549ed20e3346c445defa0d8734648f8a89f8df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243659
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
MotionBlurEffect makes use of many abilities some consider to be
unnatural. Notably, it mutates the state of its subtree at render time
(gasp) to sample various time points.
Mutation triggers scene graph invalidation, which bubbles up the
ancestor chain. While we immediately revalidate the subtree, we
cannot do the same for ancestors (no full scene knowledge). This means
post-rendering, we leave some SG nodes dirty - which triggers various
debug asserts).
The easiest fix is to temporarily suppress invalidation bubbling at the
MotionBlurEffect node level (this is safe, because we always revalidate
the subtree).
Also add a post-render assert for tighter state validation.
Change-Id: I376b7a8880f71d85e595c419334b42bc4720ac65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243420
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Also adds tests for static png,jpg,gif
Was unable to simply expose drawDrawable because the JS
side of things does not understand inheritance (specifically,
it doesn't know what is a descendant from SkDrawable).
Change-Id: I6a833c93f22ef90ae12e901168ff428e20504209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242562
Reviewed-by: Kevin Lubick <kjlubick@google.com>
CQ_INCLUDE_TRYBOTS=skia.primary:Build-Win-MSVC-arm64-Debug,Build-Win-MSVC-x86_64-Debug
Change-Id: I381da9c2b2e9b98bc50e8d80ead10ad048e50fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243036
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
The gist here is to use saveLayer() to create a buffer to draw each
subframe into, but not actually use it to draw anything at restore()
time, hence, canvas->clear(0). (SkCanvas sniffs out cleverer approaches
like 0 alpha or SkBlendMode::kDst.)
Instead, we accessTopLayerPixels() and slurp the subframe out into a
16-bit accumulator, then when all subframes have drawn and accumulated
there, one more saveLayer() and accessTopLayerPixels() lets us put them
back, shifting back down to 8-bit.
The hot parts of the profile are drawing the frames themselves, then the
accumulate / repack code in renderToRaster8888Pow2Samples().
$ time out/skottie_tool -i ~/Downloads/mb/data.json -w bar
Before: 28.39user 1.14system 0:29.54elapsed
After: 22.08user 1.12system 0:23.21elapsed
I'm not proud of it.
...
...
...
I am a bit!
Now using one layer.
Change-Id: I241529fad4c5b55c6abc55793f2d9c9693a03c18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242853
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>