Commit graph

16 commits

Author SHA1 Message Date
Bruce Mitchener 6a82732435 Add license to vello-encoding, vello-shaders. 2023-08-01 21:39:17 +07:00
Chad Brokaw b103a55301 rework radial gradients
Adds full support for COLRv1 radial gradients based on the two-point conical gradient algorithm at https://skia.org/docs/dev/design/conical/

Also adds robustness to degenerate cases in gradient encoding:
* Radial where p0 == p1 && r0 == r1 renders transparent solid
* Empty stops render as transparent solid
* Single stop renders as solid
2023-05-09 18:09:53 -04:00
Chad Brokaw e9c2ce1623 resolve merge conflicts 2023-05-03 14:53:36 -04:00
Chad Brokaw 4f9ae4c937 Merge branch 'main' into gradient-fixes 2023-05-03 14:49:57 -04:00
Chad Brokaw c68d011c7c feature gate full pipeline encoding support
Adds a new feature called "full" (on by default) that enables encoding support for the full pipeline.
2023-05-03 12:22:51 -04:00
Chad Brokaw 46328c7a2c cleanup for review
* rename resolve_simple to resolve_solid_paths_only to better capture the semantics of the function
* move duplicated buffer size computation code to separate function
* change Resolver::resolve to call resolve_solid_paths_only when encoding.patches.is_empty() is true. This is likely to be slightly faster and will ensure that the "simple" code path is actually used.
2023-05-02 16:42:50 -04:00
Chad Brokaw c3ca624c1e Add resolve function for path only pipeline
Adds a new `resolve_simple` function that doesn't handle late bound resources (gradients, images and glyph runs).
2023-05-02 14:07:25 -04:00
Chad Brokaw 15cd306af6 Extend modes for gradients
This patch implements the pad, repeat and reflect extend modes for gradient brushes. Adds a new example demonstrating the functionality.

Also fixes a few bugs:
* Clamps alpha in blend.wgsl for the `blend_compose` function. The `Plus` mode was generating `alpha > 1.0` leading to incorrect rendering.
* Small change to radial gradients in fine.wgsl to reject pixels outside the cone when the circles don't nest. This requires further work to properly extend the cone when one of the radii is not 0.
2023-04-30 23:11:57 -04:00
Arman Uguray 2b0eab2bbc fix some clippy errors/warnings 2023-04-18 15:15:01 -07:00
Arman Uguray e9278a9253 [vello_encoding] Declare bump buffer sizes in terms of element count 2023-04-18 15:02:31 -07:00
Arman Uguray 4ae4177510 [vello_encoding] Fixup copyright headers 2023-04-18 14:46:16 -07:00
Arman Uguray fe29125a84 Remove unused WG size declarations 2023-04-18 14:46:16 -07:00
Arman Uguray 0256d8a92f [vello_encoding] Minor clean ups and correctness fixes
- Use the buffer sizes in src/render.rs as the current 128K is not
  sufficient for even the test scenes
- Add BumpAllocators type and bump buffer size
- Support the `base_color` render option
- Use immutable type construction where possible
- Fix the path tag stream length calculation to use the offsets stored
  in Layout. This both matches the current behavior in src/render.rs and
  makes it so that CpuConfig's construction no longer needs the Encoding
  type as an input
- Renamed CpuConfig & GpuConfig types to 'RenderConfig' and
  'ConfigUniform'
2023-04-18 14:46:16 -07:00
Arman Uguray 3ff490fc13 [vello_encoding] Declare padding in binding types to match WGSL layout 2023-04-18 14:46:16 -07:00
Chad Brokaw 9f27fae64e capture computation of workgroup and buffer sizes 2023-04-18 14:46:16 -07:00
Arman Uguray db2fefdc8f [vello_encoding] Move the encoding module into its own crate
This change moves the vello encoding logic to a new crate under
crates/encoding. Combined with the `vello_shaders` crate, this enables
lightweight integration of the Vello pipelines into renderers that don't
depend on wgpu (or perhaps written in languages other than Rust).

The Scene/Fragment API currently remain the vello crate.
2023-04-18 14:46:14 -07:00