Commit graph

81 commits

Author SHA1 Message Date
Arman Uguray
1dea6c0ef0 Fix invalid buffer access errors caught by shader validation
Fixed several other shader validation errors caught when running
vello_shaders natively on Metal.

These were primarily caused by reading an invalid drawtag while
accessing the scene buffer. Scene buffer access in the offending
pipelines now initialize the draw tag to DRAWTAG_NOP if an
invocation ID would land beyond the valid index range of encoded draw
objects.
2023-06-28 12:59:21 -07:00
Daniel McNab
6d57093cc2
Add GPU profiling (#304)
* Add GPU profiling

* Fix conditional compilation for `headless`

* Add full profiling

* Productionise

* Fix MacOS trace file

* Try to make it easier to tell what's important

* Resolve CI issues
2023-06-01 16:10:27 +01:00
Raph Levien
f60cb0c31b Merge branch 'main' into failure 2023-05-31 17:37:43 -07:00
Raph Levien
3774928b24 Enforce clippy lints
This turns on clippy checking and also fixes all lints in the code.

Many lints are obvious improvements. Only a small number are slightly annoying, so I think overall worth having a vanilla default config.
2023-05-18 16:13:32 -07:00
Raph Levien
1f6b47bd78 Quiet warnings
Fixes the warnings remaining in the code, which should in turn let us check that in CI.

Also checks the optional features, which are easy enough to break.
2023-05-18 15:40:40 -07:00
Raph Levien
f3587b1240 Merge branch 'main' into failure 2023-05-18 11:14:22 -07:00
Daniel McNab
abfe9fbb56
Add a stats display for scene complexity (#322) 2023-05-18 18:50:57 +01:00
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
Raph Levien
e399f4792d Display error message when WebGPU not enabled
Detect the case where creating the WebGPU surface fails, and insert a message explaning the failure into the DOM, rather than panicking.
2023-04-28 13:55:24 -07: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