Commit Graph

336 Commits

Author SHA1 Message Date
Florin Malita
a9379fb8ed [skottie] Contrast cleanup
- fix/update sample labels
  - make a note of sin-based improved approximation

TBR=
Change-Id: I53b02cd8a6dd1499805b9782fb6378d344476b87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286037
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-29 13:57:22 +00:00
Florin Malita
f2072332f4 [skottie] Non-legacy (is this modern?) contrast effect support
Implement non-linear contrast using a cubic polynomial approximation,
as a SkRuntimeEffect.

The effect range is significantly more constrained than the legacy
version: https://www.desmos.com/calculator/ehem0vy3ft

Change-Id: I86bdbb9cc0d30065780f87705d2d4d39385609cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285840
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-29 12:42:41 +00:00
Florin Malita
fc75d5c52d [skottie] Brightness and Contrast effect
Add support for brightness/contrast, "legacy mode".  This effect can
be represented as a color matrix.

Brightness transfer function: https://www.desmos.com/calculator/zne0oqwwzb

Contrast transfer function: https://www.desmos.com/calculator/x5rxzhowhs

Change-Id: I2e6bb0f5f809aa0f33362bf753d2fe447059eaaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285577
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-28 14:33:12 +00:00
Florin Malita
bf03ac53f1 [skottie] Initial outer/inner glow
Supported controls:

  - color
  - opacity
  - size
  - inner source (edge/center)

Change-Id: I1ada43fe46fa5557e11279abca6128042acef965
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285005
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-23 13:46:48 +00:00
Florin Malita
e35a7ea7a9 [skottie] Initial inner shadow layer style support
Implement drop and inner shadow styles using explicit image filters.

Remove existing style support from DropShadowEffect.cpp, as it now
has a new cozy place with its inner sibling.

Supported properties:

  - color
  - opacity
  - angle
  - distance
  - size (sigma)

Change-Id: I5b7e3c75678e036a20c1908b84c74a670a5aa196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283918
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-17 19:57:08 +00:00
Herb Derby
31f6d043af Schedule using tree order traversal the DAG.
Trace out the tree from the DAG. Trace nodes
with fan-out > 1 after all out edges have been traced.

Change-Id: Ic078d212adf95a19146fcbd9fb8d103ea23360ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283557
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-04-15 17:13:06 +00:00
Mike Klein
45d9cc86b3 remove i16x2 ops
These are neat but mostly just a distraction for now.
I've left all the assembly in place and unit tested
to make putting these back easy when we want to.

Change-Id: Id2bd05eca363baf9c4e31125ee79e722ded54cb7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283307
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-04-13 19:08:11 +00:00
Brian Osman
95c26efc90 Pure SkSL RNG for particles
Change-Id: I2cb6255a553852a292427d6dc9ef8c5ed7f8286d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252926
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-10 17:20:07 +00:00
Florin Malita
0022f5cf1b [SkTrimPathEffect] Preserve wrap-around continuity
In inverted mode (Mode::kInverted), the trim result represents the
logical segment [stop..start] (wrapping around at the path's end).

We currently emit two segments [0..start] and [stop..1], in that
exact order.  This behavior breaks continuity for single closed
contour paths.

Update SkTrimPath to

1) emit the segments in the correct order ([stop..1],[0..start])

2) skip the connecting moveTo for closed paths

Bug: skia:10107
Change-Id: Icd280554ba7291c985f504793feff104df2a4a99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-07 14:40:17 +00:00
Florin Malita
0ba30328d0 [skottie] Corner pin effect
Note: works for well-formed poly-to-poly (perspective) transforms, but
doesn't support AE's degenerate corners semantics (concave/inverted
polys) at this point.

Bug: skia:10100
Change-Id: I5b3492b008302495b616867c139c6e5ad6dc57df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281595
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-05 16:47:06 +00:00
Mike Klein
4067a9429a the return of bit_clear
bit_clear is at least useful as a special case for select(),
which helps with code readability.

Add is_NaN() and use these all together in sweep gradient.

Change-Id: I57a54f8956f85e0db0662b33f8446b8dc7342d8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281685
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-05 16:44:16 +00:00
Mike Klein
aa68109a59 special-case overhaul
- new this-> convention: never use it when calling common public
    Builder methods like splat(), bit_and(), etc like you'd see in
    normal user code, but always use it when calling private methods
    like this->push(), this->isImm(), this->allImm().

  - use c++17 if-statements to scope this->allImm() variables tighter.

  - check for x.id == y.id cases where applicable, including a tweak
    to min() and max() to make them able to hit the special case.

  - add special cases for I32 +,-,*, and remove an old unimportant
    unit test that assumed we didn't fold these.

  - add special cases for select(), and use select() in a few more
    places where it's clearer and now just as efficient.

Change-Id: Idaac9250ac5a95a48d33eeba1cc4380c8c91629d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281678
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-05 15:41:36 +00:00
Mike Klein
cca2acfb77 remove little-used bit_clear() and bytes()
bit_clear() is just another bit_and(),
and bytes() is a way of expression pshufb
that we never really use (yet).

Can always add them back later, but there's
some extra complexity to think about for each
that I'd like to not think about now:

  - common sub-expression elimination between bit_and and bit_clear
  - large constant management JIT'ing bytes

Change-Id: I3a54afa963231fec1d5de949acc647e3430ed0d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281557
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-03 18:16:54 +00:00
Mike Reed
6e9b179d20 move ducky images into images
Change-Id: I819c23d38989f81d2e493ad8eea0c22cfd364284
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279036
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-03-25 12:19:56 +00:00
Florin Malita
ae58199380 [skottie] Initial drop shadow style support
Plumb layer style parsing, and extend existing DropShadowAdapter to
support both drop shadow style and drop shadow effect.

Change-Id: Id99a419dacd06dc38dc4cf84ff4ecb92218c45f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279020
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-25 12:14:26 +00:00
Herb Derby
43f7641e1b Arrange instruction to reduce register pressure
When converting from Instructions to OptimizedInstructions
place instructions that reduce register pressure earlier in
the instruction list.

This change reduces some register pressure in SkVM, and
improves the bitmap_RGBA_8888_A_scale_bilerp benchmark by
about 5%.

Change-Id: If5f6385bd2f7720701d1c827265062b35491a790
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276485
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-17 21:37:18 +00:00
Mike Klein
5caf7dee25 restore Op::round
While I think trunc(mad(x, scale, 0.5)) is fine for doing our float
to fixed point conversions, round(mul(x, scale)) was kind of better
all around:

   - better rounding than +0.5 and trunc
   - faster when mad() is not an fma
   - often now no need to use the constant 0.5f or have it in a register
   - allows the mul() in to_unorm to use mul_f32_imm

Those last two points are key... this actually frees up 2 registers in
the x86 JIT when using to_unorm().

So I think maybe we can resurrect round and still guarantee our desired
intra-machine stability by committing to using instructions that follow
the current rounding mode, which is what [v]cvtps2dq inextricably uses.

Left some notes on the ARM impl... we're rounding to nearest even there,
which is probably the current mode anyway, but to be more correct we
need a slightly longer impl that rounds float->float then "truncates".
Unsure whether it matters in practice.  Same deal in the unit test that
I added back, now testing negative and 0.5 cases too. The expectations
assume the current mode is nearest even.

I had the idea to resurrect this when I was looking at adding _imm Ops
for fma_f32.  I noticed that the y and z arguments to an fma_f32 were by
far most likely to be constants, and when they are, they're by far likely
to both be constants, e.g. 255.0f & 0.5f from to_unorm(8,...).

llvm disassembly for SkVM_round unit test looks good:

~ $ llc -mcpu=haswell /tmp/skvm-jit-1231521224.bc -o -
	.section	__TEXT,__text,regular,pure_instructions
	.macosx_version_min 10, 15
	.globl	"_skvm-jit-1231521224"  ## -- Begin function skvm-jit-1231521224
	.p2align	4, 0x90
"_skvm-jit-1231521224":                 ## @skvm-jit-1231521224
	.cfi_startproc
	cmpl	$8, %edi
	jl	LBB0_3
	.p2align	4, 0x90
LBB0_2:                                 ## %loopK
                                        ## =>This Inner Loop Header: Depth=1
	vcvtps2dq	(%rsi), %ymm0
	vmovupd	%ymm0, (%rdx)
	addl	$-8, %edi
	addq	$32, %rsi
	addq	$32, %rdx
	cmpl	$8, %edi
	jge	LBB0_2
LBB0_3:                                 ## %hoist1
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	LBB0_6
	.p2align	4, 0x90
LBB0_5:                                 ## %loop1
                                        ## =>This Inner Loop Header: Depth=1
	vcvtss2si	(%rsi,%rax), %ecx
	movl	%ecx, (%rdx,%rax)
	decl	%edi
	addq	$4, %rax
	testl	%edi, %edi
	jg	LBB0_5
LBB0_6:                                 ## %leave
	vzeroupper
	retq
	.cfi_endproc
                                        ## -- End function

Change-Id: Ib59eb3fd8a6805397850d93226c6c6d37cc3ab84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276738
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-12 21:10:34 +00:00
Mike Klein
7c0332cd35 re-enable fnma
- hook up fmls.4s as fnma_f32
 - add fneg.4s
 - use fneg.4s + fmls.4s to impl fms_f32
 - more tests to exercise these

Change-Id: I60173a5e4618ab968a9361e15334a1d63c001372
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275412
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-03-05 21:58:07 +00:00
Mike Klein
f8db8a5516 disable fnma peephole
Change-Id: I66b251826211653586c64e8495cdfde7d7d8f1a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275410
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-05 20:28:27 +00:00
Herb Derby
d4c4f0c004 Add Multiply-Subtract (fms) to SkVM
Add fms op and instruction generation. Do fms and fnma
instruction selection.

TODO: Add the ops to Arm

Change-Id: I7e53abd7f4752eb99c31dcbff1f2ea7cf28af6c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275197
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-05 18:44:18 +00:00
Mike Klein
823d319f3b do our own fma discovery
Peephole add(F32,F32) for an argument that is a mul().

As a flourish, only generate Op::fma_f32 on machines we know support
real fused mul-adds.  This removes the ambiguity of whether Op::mad_f32
is an FMA or not; the new Op::fma_f32 is always an FMA, and otherwise
you'll just see ordinary mul-add.  No more Op::mad_f32.

Change-Id: I38016a2430774583116d8d6a8ada677012c1a8fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275138
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-03-04 22:29:30 +00:00
Mike Klein
cb50b117e3 get rid of troublesome Op::round
We really only need to_unorm(),
and that's fine with trunc(mad(x, scale, 0.5)).

Change-Id: I1561c678501963a9ae53c22994fc906159fc7199
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275075
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-04 22:26:01 +00:00
Florin Malita
ae2da5e7f9 [skottie] Add another text grouping test
TBR=

Change-Id: I9c1ca3e834fdc5b017446811db52582a326d777b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-03 15:17:20 +00:00
Florin Malita
960f3d4cd1 [skottie] Text anchor point grouping support
Implement all AE grouping modes: character/word/line/all.

 -- character grouping was already supported (default mode)

 -- for word and line grouping, expand the existing domain mapping logic
    to also track cumulative advance and max(ascent) per span, then use
    this info to compute anchor point boxes

 -- for "all" grouping, the anchor point box coincides with the text box

(https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties)

TBR=
Change-Id: I8564f1349d167d82c31862d8f7e57615cdae0dcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 23:07:39 +00:00
Florin Malita
c4fae744d0 [skottie] Fix handling of time-reversed precomp layers
With time-reverse enabled

 - inPoint/outPoint are reversed
 - time stretch is negative

Bug: skia:9958
Change-Id: I5c1197251608aad4b0417cde6ca2600b1b2822fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273808
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2020-02-28 19:42:51 +00:00
Florin Malita
917dddece6 [skottie] Add support for text grouping alignment
AE allows relative adjustments for text animator transform anchor
points [1].

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties

Change-Id: If98d6b522e73a768ed2358d918867d2aefd09071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274044
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-28 18:59:05 +00:00
Florin Malita
9642b31a71 [skottie] Add support for text animator blur
In adition to transforms/opacity/etc, text animators can target
per-glyph opacity.

Change-Id: I6ab63a6e49a64beaf63fc955f0b672a5b8ba84ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272886
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-24 14:01:16 +00:00
Florin Malita
178b860769 [skottie] Initial support for per-character 3D
When per-character 3D is enabled, text properties can be animated in
3 dimensions.

 - position and scale become 3-value vectors
 - in addition to existing "r" (really rz), rotation gains "rx" and "ry"
 - instead of specializing for 3D, expand the existing structures to
   handle both 3D and 2D modes
 - also ensure that sksg::Transform does not flatten to SkMatrix

Change-Id: I426a7ee1ff38c1702deb85e9f1db80f6069f36d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272648
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-21 21:14:02 +00:00
Florin Malita
0de01c05b7 [skottie] Clip overflowing paragraph lines
AE discards lines with baselines outside the paragraph box.

This aligns Skottie's behavior with AE for default/top-alignment
(but not for any of the custom vertical alignment modes).

Bug: skia:9933
Change-Id: Id0318f0744bf89580774e89494faf19bfb6f6d14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272376
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-20 18:35:15 +00:00
Ben Wagner
d38f00a12a Skip degenerate contours in glyphs.
Stroking in Skia follows the SVG rules of adding end caps to degenerate
contours. Skip all degenerate contours and degenerate curves on contours
to avoid this.

Bug: skia:9820
Change-Id: I320beeeb3728f39c764729454dcb128a05524d35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268166
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-02-13 16:22:42 +00:00
Mike Klein
5cdeb390d0 only emit _imm ops when JITing for x86
There are probably ways to make this more efficient by only optimizing
what's necessary (e.g. try JIT first, then interpreter only if it fails)
and some other performance improvements to make, but for now I want to
focus mostly on keeping things simple and correct.

The line between Builder::done() and Program::Program() is particularly
fuzzy and becoming fuzzier here, and I think that'll be something
that'll change eventually.

This makes SkVMTest debug dumps more portable, though perhaps less
useful.  Might kill that feature soon now that SkVM is tested more
thoroughly in unit tests and GMs and bots and such.

Change-Id: Id9ce8daaf8570e5bea8b10f1a80b97f5b33d45dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269941
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-10 19:26:05 +00:00
Leon Scroggins III
42a604f431 Allow decoding without color conversion - part 2
Bug: b/135133301

Follow-on to 196f319b.

- Add SkCodec::getICCProfile to match the SkAndroidCodec version.
- Update comments on getPixels() regarding how the SkColorSpace on the
SkImageInfo is treated.
- Add two new images that have ICC profiles that do not map to an
SkColorSpace. Add a test to verify that they have the un-transformed
color we expect.
- Stop uploading ColorCodecSrc images decoded to a null SkColorSpace to
Gold. Though they may be correct, they do not match other images they're
compared against. The new test above verifies that we do not do color
conversion with a null SkColorSpace.

Change-Id: I08635e4262f16500fab32ef97511d305c2c06483
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269236
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-02-07 19:24:33 +00:00
Mike Klein
4bb619554e move instruction specialization later
This adds a specialization pass to Builder::optimize() and moves the
x86-specific _imm ops there, rewriting with the Builder API itself.  I'm
only using the private Builder::push() call for the moment, but that's
enough to make me feel confident that this is a good way forward:  it's
still all going through CSE that way.

We're still doing this any time we're on x86, not when targeting the
JIT, but that'll come next, see the new TODOs.  It's mildly better for
the interpreter to not use the _imm ops, but this is really all still
warmup for optimizations with less mild opinions.

I'm not proud of the switch/goto impl but it's the clearest I found.

Change-Id: I30594b403832343528b95967724fd50324cd79d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269232
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-07 16:21:08 +00:00
Mike Klein
ed9b1f1c1e refactor out a middle representation
Kind of brewing a big refactor here, to give me some room between
skvm::Builder and skvm::Program to do optimizations, bakend
specializations and analysis.

As a warmup, I'm trying to split up today's Builder::Instruction into
two forms, first just what the user requested in Builder (this stays
Builder::Instruction) then a new type representing any transformation or
analysis we've done to it (OptimizedInstruction).

Roughly six important optimizations happen in SkVM today, in this order:
   1) constant folding
   2) backend-specific instruction specialization
   3) common sub-expression elimination
   4) reordering + dead code elimination
   5) loop invariant and lifetime analysis
   6) register assignment

At head 1-5 all happen in Builder, and 2 is particularly
awkward to have there (e.g. mul_f32 -> mul_f32_imm).
6 happens in Program per-backend, and that seems healthy.

As of this CL, 1-3 happen in Builder, 4-5 now on this middle
OptimizedInstruction format, and 6 still in Program.

I'd like to get to the point where 1 stays in Builder, 2-5 all happen on
this middle IR, and 6 stays in Program.  That ought to let me do things
like turn mul_f32 -> mul_f32_imm when it's good to and still benefit
from things like common sub-expression elimination and code reordering
happening after that trnasformation.

And then, I hope that's also a good spot to do more complicated
transformations, like lowering gather8 into gather32 plus some fix up
when targeting an x86 JIT but not anywhere else.  Today's Builder is too
early to know whether we should do this or not, and in Program it's
actually kind of awkward to do this sort of thing while also doing
having to do register assignment.  Some middle might be right.

Change-Id: I9c00268a084f07fbab88d05eb441f1957a0d7c67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269181
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-06 20:09:53 +00:00
Florin Malita
4a6a640299 [skottie] Add support for ADBE Pro Levels2 effect
Similar to existing ADBE Easy Levels2, but provides separate mapping
controls per channel.

Change-Id: Ibc58c58e1e8cb8793d6eb819998c1804ccbbf859
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-05 21:05:08 +00:00
Robert Phillips
d4f68317fe Add SW decode of ETC1 and a GM
The GM exercises the compressed image formats using externally created resources

Note: the original image for the new flower resources can be found on Wikimedia Commons and has a "CC0 1.0 Universal Public Domain Dedication" license.

Bug: skia:9680
Change-Id: I6c5f9a12fcbbecdc3ba548dbb078bc21522073fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267836
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-03 13:56:15 +00:00
Florin Malita
cc982ecbca [skottie] Cleanup: convert remaining effects to new adapter pattern
Also add a couple of tests for missing coverage.

TBR=
Change-Id: I420c71d73657c5d003fda94a4c43dde20a1a6b87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267556
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-30 15:30:08 +00:00
Florin Malita
ad9110026b [skottie] Separate text resize options
The sk_vj text property (Skottie extension) is currently mixing
vertical alignment and resizing semantics into a single enum.  This
precludes certain valid combinations.

Split the resize options into a separate enum (ResizePolicy), and ensure
support for all combinations.

Before:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom
  "sk_vj": 3 -> Shaper::VAlign::kVisualResizeToFit
  "sk_vj": 4 -> Shaper::VAlign::kVisualDownscaleToFit


After:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom

  "sk_rs": 0 -> Shaper::ResizePolicy::kNone
  "sk_rs": 1 -> Shaper::ResizePolicy::kScaleToFit
  "sk_rs": 2 -> Shaper::ResizePolicy::kDownscaleToFit


Bug: skia:9809, skia:9810
Change-Id: I631ae1fa31a9bc9c6958bb480354138591d504ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267040
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Isabel Ren <isabelren@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-29 00:09:42 +00:00
Florin Malita
7c7cd30550 [skottie] Add custom props rendering GM
Also fix a couple of custom props issues:

  - solid layer colors were not dispatched
  - text values were not sync'ed

TBR=
Change-Id: I827f8c1d8c8bb73b03f05de15e1c7c96753a631e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264936
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-17 13:53:02 +00:00
Mike Klein
57bdb24d0e skip no-op masks
extract() can generate silly instruction patterns like

     v0 = ...
     v1 = shr v0 24
     v2 = bit_and v1 FF
     v3 = whatever v2 ...

This CL skips those pointless bit_ands when we see the
mask is an immediate and (0xFFFFFFFF>>shift) == mask.

Change-Id: I2bb3847fbb2efdf24d024870ac37b37bb8f9aa3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263101
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-08 21:59:24 +00:00
Mike Klein
a6434a5ef5 refactor bit ops
- Remove extract... it's not going to have any special impl.
  I've left it on skvm::Builder as an inline compound method.
- Add no-op shift short circuits.
- Add immediate ops for bit_{and,or,xor,clear}.

This comes from me noticing that the masks for extract today are always
immediates, and then when I started converting it to be (I32, int shift,
int mask), I realized it might be even better to break it up into its
component pieces.  There's no backend that can do extract any better
than shift-then-mask, so might as well leave it that way so we can
dedup, reorder, and specialize those micro ops.

Will follow up soon to get this all JITing again,
and these can-we-JIT test changes will be reverted.

Change-Id: I0835bcd825e417104ccc7efc79e9a0f2f4897841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263217
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-08 21:20:54 +00:00
Mike Klein
b5c435579e upgrade debugging tools
- Add instruction numbers to program dumps.
- Dump the program when an assertion fails,
  and print the failing condition or an optional
  other value (e.g. if alpha outside [0,1], print alpha).

With all that and the new commented assert enabled, I'm seeing that
sometimes we get a bilerp alpha of 0x3f800001, just a little more than
1.0f.  Fix still tbd.

Change-Id: I2c20e41ae370d8cd2963e2dbf0fd91aa0fd50061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262808
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-07 18:26:22 +00:00
Ben Wagner
ab51c2ce08 Add more variation support on Mac.
With the recent transition to creating fonts from data as CTFonts and
dropping variation support from macOS 10.11 and earlier, it is now
possible to reliably make variation clones and get the axis information.

Change-Id: Ia9a0922ac94a29e1508d2e74d4ce973751044866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259421
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-12-13 18:16:13 +00:00
Florin Malita
46a331b93f [skottie] Cascading track matte support
Currently, we treat track matte source layers (tagged with td:1) as single-shot mask triggers:
we apply once to the following layer, then move on.

But track mattes can cascade: a layer with a matte can itself be applied as a track matte for the
following layer.

Also, for matte/masking purposes, only the layer content is being considered (ignoring blend mode
and any masks applied to the matte itself).

To support this, refactor the layer attachment code:

  - instead of tracking the presence of a single-shot matte source, always track
    previous layer content trees
  - instead of triggering matte attachment in the presence of a matte source, trigger based on
    the matte *target* property (tt: X)
  - log errors on unknown matte modes

Change-Id: I6c71d4007e1e27d3f3a139344bbf367d7bc6e29d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259820
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-12 21:42:11 +00:00
Florin Malita
e1fa70000a [skottie] Invert effect support
https://helpx.adobe.com/after-effects/using/channel-effects.html#invert_effect

Change-Id: Iac8e291ab9cb57714c50f1e40cecb66b3dc64ee1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259276
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-12-11 23:07:04 +00:00
Florin Malita
6cc49538b3 [skottie] Fix precomposed camera sizing
Precomp layers can have a different size vs. main composition.

Instead of relying on the global animation (main comp) size, use the
current (pre)comp size when setting up cameras.

Change-Id: I54106375fb39dde2bfd11e14a38e5ec3e7190764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258156
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>
2019-12-05 14:34:15 +00:00
Brian Osman
db2e7641be Particles: SkImageBinding to allow sampling an image from script
Provides functionality similar to AE property maps

Change-Id: I1705706a6b7e25fbab55465f2e20d0b145330b0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255977
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-03 15:22:20 +00:00
Brian Osman
d12f2786e2 Use ResourceProvider in particles
Currently just for image drawable, but going to use this for
references to other kinds of data in bindings, too.

Change-Id: Ic6673530013337bbaadd2d3f1c040626ec24ffb8
Bug: skia:9513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256776
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-27 16:45:23 +00:00
Mike Klein
1cb05993af all-constant peepholes
This adds a bunch of tests for ops that can all be evaluated directly in
skvm::Builder.  You can see the sort of effect this has by looking at
the diffs for SkVMTest.expected... lots of `v3 = sub_f32 v2 v2`
transformed to `v3 = splat 0 (0)` and that sort of thing.

My favorite part is handling many assert_true() calls at compile time!

While the old inter-Op code parallels aren't as clear now, these new
early-out tests kind of work like comments explaining each op.  I find
that nice.  I found it hard to parse so many uses of the word "splat" so
I did go back to isImm() from isSplat(), and added allImm() to test for
and read several immediates all at once.

Some of this is less C++17 than I'd like. :/

Change-Id: Ie8187d5d184195e3c0c92d613508fb708c28302f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255814
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-21 22:00:11 +00:00
Florin Malita
ad76b2ee25 [skottie] One-node camera support
So far Skottie has been assuming all cameras are two-node (have a point
of interest).

AE also supports one-node cameras, where the camera does not auto-orient
towards a POI but starts off perpendicular to the z == 0 plane.

(https://helpx.adobe.com/after-effects/how-to/camera-animation.html)

Change-Id: Id565de7d8feb9a762940ac372c1bbbcce2e2dfc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254559
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-14 18:45:18 +00:00