Commit Graph

7 Commits

Author SHA1 Message Date
Derek Sollenberger
783e5aeb2e Refactor RuntimeShader to support easier assignment of uniforms.
uniforms are no longer set as single block of bytes where the caller
has to know the offset, but instead by the string identfier in the
shader.  This CL only supports floats, but future expansions of this
will provide helpers for ints, colors, and byte[].

Also by storing the shaders and uniforms in the RuntimeShaderBuilder
we can more easily copy them.  This enables Canvas.drawRipple to not
just copy the compiled SkSL effect, but also all the uniforms and
other input shaders set on the RuntimeShader.

Bug: 177051137
Test: HwAccelerationTest
Change-Id: I4733f42ba662546be6bebc37f0b89832778e66ce
2021-01-15 13:03:25 -05:00
Derek Sollenberger
df301aaa54 Initial framework needed to draw circle with RuntimeShader.
This also adds the ability for RenderThread to animate a few
predefined shader uniforms.

Bug: 177051137
Test: demo in ag/13296877
Change-Id: I6e58e671ad1242a07ecb1cf4cdb48031f85c2088
2021-01-08 12:47:31 +00:00
Mike Reed
3ed3089fdb Use SkSamplingOptions when creating image-shader
Test: make

Change-Id: Ie979cdb10263a08ea3d8c817234b94c9b61abb76
2020-12-14 17:51:13 -05:00
Derek Sollenberger
80e3a1a908 Add basic support for input shaders to RuntimeShader.
This adds the ability for Java RuntimeShaders to provide other
shaders as inputs.  This is a first pass API and should be updated
to mirror the SkRuntimeShaderBuilder API that enable callers to set
the uniforms and inputs shaders by name instead of passing arrays.

Test: HwAccelerationTests
Bug: n/a
Change-Id: I53a15ad864bede2fecc1e2459dca983d224114a0
2020-10-02 15:55:03 -04:00
Leon Scroggins III
fa2e92020f Cleanup/document Shaders for UI rendering module
Bug: 156636925
Test: make

Remove UnsupportedAppUsage false-positives from Shader and BitmapShader.

Change public/package-protected methods that should only be called by
subclasses to protected and mark them @hide.

Document why other @hide methods must be @hide.

Remove unnecessary if statement in BitmapShader constructor.

Change-Id: If3e87c45cbbab1df180387dd6ccfda1ec2ecb153
2020-05-15 15:00:54 -04:00
Brian Osman
bc44fa0fa8 Use SkRuntimeEffect rather than SkRuntimeShaderFactory
The old API was a shim over the new API, and will be deleted soon.
The new API is actually public, simpler, and more powerful.

Test: Everything still builds.
Change-Id: I11af8da9132e23a070e87dd5a7401c4854dd102a
2020-01-03 20:31:50 +00:00
Stan Iliev
6867fc8778 Implement a new Shader API, which can run custom code on GPU
Add RuntimeShader hidden API, which calculates pixel output with
a fragment shader running on GPU.
Extend ColorFiltersMutateActivity HWUI test to use new API and
show how to animate uniforms on UI thread.

Test: Updated HwAccelerationTest
Change-Id: Ia26e44259b12099924facba250880cbbd9be21c7
2019-12-03 11:38:29 -05:00