Commit graph

73 commits

Author SHA1 Message Date
Chad Brokaw 14eef3fafb
Merge pull request #316 from linebender/gradient-fixes
General gradient improvements
2023-05-16 02:36:42 -04:00
Chad Brokaw 570a0f3ce4 Re-export font API
Just exports fello from the glyph module so we can construct FontRefs in xilem.
2023-05-10 13:54:42 -04: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 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
Arman Uguray 84915dc289 Use expect instead of unwrap on image format block size 2023-04-23 16:09:17 -07:00
Arman Uguray 8a35c51289 Roll wgpu to 0.16 2023-04-23 12:02:39 -07:00
Arman Uguray 2b0eab2bbc fix some clippy errors/warnings 2023-04-18 15:15:01 -07:00
Arman Uguray fe29125a84 Remove unused WG size declarations 2023-04-18 14:46:16 -07:00
Arman Uguray ad82519444 [vello_encoding] Use the vello_encoding crate in the vello renderer
Removed the workgroup count and buffer size calculations from
src/render.rs. This code now uses the types returned by the
vello_encoding crate for this purpose.
2023-04-18 14:46:16 -07:00
Arman Uguray 899ecaa430 Remove the reduced render method
This method was intended for the coverage mask variant of the pipelines
that was present in piet-gpu. This code has regressed since the wgpu
rewrite and the mask rendering variant of the pipelines will be
redesigned. Remove this for now instead of having to maintain it until
the rewrite.
2023-04-18 14:46:16 -07:00
Arman Uguray 6d2b98cade [vello_encoding] Re-export vello_encoding::Glyph from vello
This makes it so that users of the vello crate that use the Glyph type
don't need to directly depend on the vello_encoding crate.
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
Chad Brokaw 4c5ff6b5bf
Merge pull request #297 from linebender/vello-fello
Replace font backend
2023-03-21 22:07:36 -04:00
Chad Brokaw eb8cc5275f Replace font backend
This replaces the old moscato font backend with one that has proper support for variable fonts.
2023-03-21 19:27:21 -04:00
Arman Uguray 8bd1bdfaa8 [frame_stats] Use wgpu::PresentMode::AutoVsync/AutoNoVsync for VSync mode
The Auto* modes should have wider compatibility as they implement
fallback behavior based on what the platform supports. This also means
that on web "vsync off" will likely be incorrect.
2023-03-21 11:34:26 -07:00
Arman Uguray 1250cdcf86 [frame_stats] Add a VSync toggle key; show the current VSync state in stats UI 2023-03-21 11:34:08 -07:00
Chad Brokaw 923c949e95 Remove some unused imports 2023-03-10 21:00:42 -05:00
Chad Brokaw 37f05b853c Address initial review feedback
* Add comment about naughty ptr2int cast
* Change Option to anyhow::Result in test scene ImageCache
* Replace magic constant with pixel stride from selected format
2023-03-10 15:14:34 -05:00
Chad Brokaw a8585781cd move atlas rect to info
Atlas offset and image size were originally stored in the ptcl but are not tile dependent. Moving these to info saves 8 bytes per image tile.
2023-03-10 01:42:50 -05:00
Chad Brokaw 165b3a083b Let's add images 2023-03-09 17:18:03 -05:00
Chad Brokaw 86b1a66af0 Address review feedback
* reorganize GlyphCache::get_or_insert() to use the HashMap entry API
* change DrawGlyphs::hint() parameter name from `yes` to `hint` for clarity
* change Layout::path_data() to return bytes instead of [f32; 2]. Path segments could be encoded as i16, making this incorrect
2023-03-06 18:29:43 -05:00
Chad Brokaw 69dd838d09 post rebase fixups 2023-03-06 11:41:12 -05:00
Chad Brokaw 5e216adfa8 Merge branch 'main' into glyph-run 2023-03-06 08:17:45 -05:00
Daniel McNab 5156447346
Make the with_winit example run on android (#273) 2023-03-05 11:33:30 +00:00
Chad Brokaw 15efb8b3f6 fixes after rebase
* remove SceneBuilder::finish() calls
* remove old Config struct
* comment about syncing structs in config.wgsl
2023-03-03 20:46:50 -05:00
Chad Brokaw fca106a5ce Merge branch 'main' into glyph-run 2023-03-03 20:30:10 -05:00
Arman Uguray 12d5dcd34f Use clap to parse base-color option; remove unused width/height parameters 2023-03-03 14:28:07 -08:00
Arman Uguray acfd570440 Handle error that can be returned by render_to_texture 2023-03-03 11:32:39 -08:00
Arman Uguray 3bbf108df5 Renamed clear_color to base_color; addressed review comments 2023-03-02 14:29:44 -08:00
Arman Uguray 05fa8c7c39 RenderParams struct for render-time options
The texture and surface render API now takes render-time parameters
(such as clear color, target width/height) as a RenderParams struct.

The examples have been updated to demonstrate this. The with_winit
example now accepts a clear color as a command line option.
2023-03-02 11:25:19 -08:00
Arman Uguray 8eabc12a72 Add a clear_color uniform
Introduced an RGBA8 config parameter to apply as a base blend color in
the fine stage of the full pipeline.
2023-03-02 09:26:31 -08:00
Chad Brokaw 82391534c0 small fixes
* make SimpleText::add_run accept glyph_transform and style parameters so it doesn't unconditionally do oblique strokes
* replace fill/stroke methods on DrawGlyphs with a single draw method that accepts either fill or stroke styles
* update peniko rev to access the new style types used above
* for now, change glyph cache to only cache non-zero fills. Prior to this, style was ignored in the key which could lead to incorrect rendering.
2023-02-24 16:13:48 -05:00
Chad Brokaw 39e35ceba9 fix copypasta comment 2023-02-23 23:29:34 -05:00
Chad Brokaw 2ef58adad5 Glyph run API 2023-02-23 22:59:03 -05:00
Chad Brokaw 6612b7a8ef
From typo in comment 2023-02-22 21:47:35 -05:00
Chad Brokaw 033870d91e Fix brush transforms
This fixes an incorrect application of the inverse transform for radial gradients in fine.

Also fixes an edge case in `SceneBuilder` where a brush transform is identical to the path transform leading to a corrupt encoding.
2023-02-22 20:10:00 -05:00
Daniel McNab 56939df615 Re-use render context in headless 2023-02-09 09:34:53 +00:00
Daniel McNab 65a7970382 Setup infra for headless examples 2023-02-07 12:52:22 +00:00
Daniel McNab f84e244fd7
Update to wgpu 0.15 (#263) 2023-01-31 16:07:03 +00:00
Raph Levien db018da537 Make wasm port work again
This cheats somewhat, using the non-robust version of the pipeline for
wasm, and blocking on native.
2023-01-26 17:41:30 -08:00
Raph Levien 264fd3ec12 Merge branch 'main' into async 2023-01-26 17:27:53 -08:00
Raph Levien d6cbae2a3f Fixes to get example running in wasm
A number of things were wrong:

* The args were missing to `run`
* The robust memory changes introduced uniformity errors
* `clear_buffer` is a todo for wgpu on wasm
* Some more time calls crept in
* Initializing both env_logger and console_logger fails

In addition, we conditionally opt the shaders into
`workgroupUniformLoad`, as that's available on wasm but not yet native.

Some of the things (args, uniformity errors) are important fixes. Other
things (clear_buffer, wUL being optional) are workarounds for wgpu
limitations and have TODO items to be removed when wgpu catches up.
2023-01-26 12:19:12 -08:00
Raph Levien 3b766d9969 Fix broken non-buffer_labels build 2023-01-25 06:33:38 -08:00
Raph Levien 418256ffd1 Start async wiring
Make async versions of the main library entry points, and invoke those from the with_winit example.

Right now this just prints the contents of the bump buffer before just running the fine dispatch, but it could apply conditional logic.
2023-01-24 21:09:00 -08:00
Raph Levien 17907893af Create Render struct
Separate coarse and fine stages as separate methods of Render struct.
2023-01-24 17:42:53 -08:00
Raph Levien e47c5777cc Make bind_map persistent
We'll be persisting some buffers across recordings, so make the mapping from id to actual resource scoped to the engine rather than a single `run_recording` call.

Part of the change is being explicit about which buffers to free and when. That will enable more fine-grained reuse of buffers, including within a recording.
2023-01-24 17:42:29 -08:00
Joe Neeman 338bd30870 Allow selecting GPU from env 2023-01-21 14:30:40 -06:00
Chad Brokaw 0c0c61dc82 Address review feedback
* Add counts to offsets when comparing against buffer size limits
* Remove multiplication by 4 in blend buffer allocation (we use units of u32)
* Move buffer sizes from BumpAllocators to Config
* Add comments about early exit
2023-01-18 21:36:32 -05:00
Chad Brokaw c66e7a270c
add comments for buffer sizes
Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
2023-01-17 22:48:53 -05:00