Commit Graph

15 Commits

Author SHA1 Message Date
Nader Jawad
3206cce503 Fix: Release skia resources when RenderNode layer is configured
-Updated StretchEffect to null out the child texture
of the SkRuntimeEffectBuilder after the shader is created
-Release optional mask surface used for
stretching the hole punch
-Release SkRuntimeEffectBuilder instance on RenderNode's
StretchEffect

Fixes: 183592264
Test: manual + re-ran cts tests
Change-Id: I90952666d7489985de9ce798ab792cf3fd7f6087
2021-06-23 11:48:58 -07:00
Nader Jawad
6aff4814a7 Refactor SkImageFilter usage to cache results.
If an SkImageFilter is used, create an image
snapshot with the filter applied to avoid
re-computing it on each draw invocation

Bug: 188450217
Test: Re-ran CTS tests

Change-Id: Ib790669e14ada9d4ebbfac958d699e2b5242f2d7
2021-06-10 23:03:03 -07:00
Nader Jawad
76d84aec28 Improve Stretch shader performance more
Refactor stretch shader to always work in
skia's coordinate system instead of normalizing
the input coordinates.
Improves performance on coral by approximately 10-20% across
various use cases on top of the branching refactoring
perf improvements
~1k fps to ~1.1k fps on non-surfaceview cases
~500 fps to ~600 fps o surfaceview cases

Bug: 187718492
Test: manual
Change-Id: I0b36f48699739979948bfec160a8aa64fc80b7a7
2021-05-13 20:43:18 -07:00
Nader Jawad
91a55b613d Improve Stretch shader performance
Refactor stretch shader to return within
conditional blocks instead of falling
through to main function body.
Improves performance on coral by approximately 60%
~600 fps to ~1k fps on non-surfaceview case
~300 fps to 500 fps on surfaceview case

Bug: 187718492
Test: manual
Change-Id: Ida0d0dee9c94b0ac210a024708100283fecc2a5c
2021-05-13 19:08:04 -07:00
Nader Jawad
bc341860f0 Updated HWUI to calculate the stretch bounds for a surface
Added logic to StretchEffect to be able to calculate the
stretched position of a pixel on an input texture based
on the current stretch parameters.

Updated shader to leverage linear easing instead of
cubic in order to have a reversible method that
can be used to map input textures to the corresponding
stretch position.

Bug: 179047472
Test: manual

Change-Id: Id32afcf0df1cca03e68ac0c594d307a1090264f2
2021-05-07 22:45:26 -07:00
Nader Jawad
197743ff9c Update hole punch logic in HWUI
--Updated HWUI holepunch logic for SurfaceView to
also apply the stretch to the hole punch
--Updated RenderNode callbacks to also include
an offset from the ancestor RenderNode that also
has a stretch configured on it
--Added new test activity to verify hole punch
logic

Bug: 179047472
Test: manual
Change-Id: Ibbaf8248a31839ba9dc352ecb9fef54e1276918e
2021-05-03 18:08:47 -07:00
Brian Osman
64ee324b93 Update frameworks/base to use newer SkRuntimeEffect::MakeForShader
This enforces stricter rules on the SkSL at effect creation time, and
ensures it's valid as an SkShader (vs. an SkColorFilter). Also updated
some SkSL that was already (or would become) illegal:

- Child shaders must be declared 'uniform', not 'in'
- sampling a child requires coordinates

Bug: skia:11813
Change-Id: I743b985b5012723186a43e58e9e3ccf29d809d2b
(cherry picked from commit 7556777511)
2021-04-26 18:31:36 +00:00
Michel Comin Escude
9ed86141f2 Adjusted interpolation and stretch intensity
Updated stretch intensity to 0.016 and added a new uniform to control
the intensity of the interpoloation

Bug: 183768138
Test: ran EdgeEffectTest and visual
Change-Id: Iac10bee5980802fffe838ed83e02b7c41dee6f71
2021-04-13 12:30:51 -07:00
Nader Jawad
8f5d66b748 Do not use SkImageFilter for Stretch
Refactor stretch implementation to manually
draw the shader as a rect instead of using
SkImageFilter

Bug: 184184033
Test: Re-ran stretch tests
Change-Id: I6263f5474b185b3f81ef9fd1bec3e43e86da49f2
2021-04-07 16:07:00 -07:00
Nader Jawad
dbc85fcb85 Fixed inverse constant
Updated inverse stretch affected distance to
be inverse the affected distance not the actual
stretch in the x/y direction

Bug: 183768138
Test: Re-ran CTS tests
Change-Id: Id3784e8902aa7dc199e10f228eeee5c24f968831
2021-04-03 13:31:13 -07:00
Nader Jawad
ebb26b1fe9 Updated StretchEffect to use cubic easing
Updated SKSL shader to use cubic easing
instead of smoothstep. Fixed issue where
max stretch distances were not being normalized

Fixes: 184198532
Bug: 183768138
Test: re-ran EdgeEffect tests + manual
Change-Id: I1c4811e71c09b5e807235e3fb30755d8d6430a54
2021-04-02 11:06:24 -07:00
Nader Jawad
7148aa7270 Stretch breaks on wembley
Work around GPU driver issues on Wembley.
Refactor the overscroll stretch shader to
explicitly return values in the helper methodsd
instead of using out parameters to store the
result.

Fixes: 182566543
Test: manual
Change-Id: Ib9c57d7cb3de06bc7155fa2af364d70cbf2ea812
2021-03-31 14:27:12 -07:00
Nader Jawad
a225d21f7d Updated EdgeEffect parameters for overscroll stretch
Added dampening logic to caluclate the distance to
overscroll.
Updated StretchEffect to support independent
maximum stretch amounts for the x/y axis

Removed debugging parameters to configure
stretch distance since they are no longer
used. Removed hidden API calls to configure
stretch distance in ScrollView/HorizontalScrollView

Bug: 179047472
Test: re-ran EdgeEffectTests
Change-Id: I4698669273d364695a21c2cce00ec2cfec41b2cc
2021-03-18 22:41:42 -07:00
Nader Jawad
6701a6014f Wire SKSL based stretch shader to HWUI
--Ported SKSL based stretch shader from OpenGL prototype
--Hooked up the stretch APIs in RenderNode to the stretch
shader.
--Updated RenderNode layer logic to promote the RenderNode to
a layer if there is a stretch to be applied to it in order
to feed the layer as input to the stretch shader

Bug: 179047472
Test: builds + sample overscroll stretches + updated CTS test
Change-Id: I744ff70099fe251ce07f23d067bf13444a468c08
2021-03-03 14:56:17 -08:00
John Reck
5cb290bf54 Add stretch plumbing
Bug: 179047472
Test: builds & boots

Change-Id: I30b5d6683160af598f98555f61af1cf5a7639bbe
2021-02-01 14:41:07 -05:00