Commit graph

110 commits

Author SHA1 Message Date
Bruce Mitchener 4a7d3285d6 deps: with_winit: Update notify-debouncer-mini and console-log. 2023-07-27 22:05:36 +07:00
Bruce Mitchener 6e9b5c092f
Merge pull request #343 from waywardmonkeys/update-bevy-example
with_bevy: Update to bevy 0.11 release.
2023-07-20 23:27:12 +07:00
Bruce Mitchener a66e94f7b9 deps: Update usvg to 0.33 from 0.29
This is not the latest version currently available, but the
changes to update to 0.34 are more involved, so we'll do
this intermediate step now.
2023-07-18 10:58:37 +07:00
Bruce Mitchener 3b3d369508 with_bevy: Update to bevy 0.11 release.
* Use `add_plugins` as `add_plugin` is deprecated.
* Use `world.resource` instead of unwrapping `world.get_resource`
  as it gives better error messages.
* Add the `VelloRenderer` to the render app in the `finish` method
  as the `Renderer` is async and may not have initialized by the
  time that the Vello plugin is being set up.
2023-07-10 13:06:41 +07:00
Bruce Mitchener c005e1b188 headless: Use pollster from workspace.
This prevents having 2 versions of `pollster` pulled into the workspace.
The workspace provided `pollster` `0.3`, while `headless` was still
using `0.2.5`.
2023-07-03 16:41:48 +07:00
Arman Uguray cf25068795 [test_scenes] Add test scenes that demonstrate incorrect clipping
Added a test scene that demonstrates the clipping bugs reported in
vello#286 and vello#333.
2023-06-28 18:38:44 -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 4fcc348940 Change to caniuse for webgpu 2023-06-01 06:59:53 -07:00
Raph Levien 6ed6e4a940 Address review feedback 2023-05-31 17:44:57 -07: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 8eb02ce330 Suppress one more warning in wasm case 2023-05-18 15:45:44 -07:00
Raph Levien 8158e77859 Rustfmt
I should set up git pre-push hooks. Also, I am surprised this needed a fmt, and would not add all the extra vertical space if it were up to me, but the reason we use default rustfmt is to avoid spending mental energy on such details.
2023-05-18 11:19:56 -07:00
Raph Levien 8f413c5b44 Fix headless example 2023-05-18 11:16:10 -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 780cff09db add examples from COLRv1 spec 2023-05-16 02:35:20 -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 ced6309a3b support two point radial with r0 > 0.0 2023-05-06 03:27:53 -04:00
Chad Brokaw 2db555145e clean up test scene code 2023-05-03 15:29:45 -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
Raph Levien 1b3938e54f Clean up casting
Get rid of unneeded clone and make syntax nicer.
2023-04-29 08:22:49 -07:00
Raph Levien e7c7f10524 Cargo fmt 2023-04-29 08:19:28 -07:00
Raph Levien 9c7e084239 Focus canvas on setup 2023-04-29 08:19:01 -07:00
Raph Levien a20c9e1592 Oops, forgot to commit mmark.rs 2023-04-29 08:18:04 -07:00
Raph Levien 6fc1ed8e13 Cargo fmt 2023-04-29 08:16:28 -07:00
Raph Levien f4a2fc616b Mmark example
This commit ports the mmark example from the mmark branch, and also makes the complexity adjustable through up/down arrow keys.
2023-04-29 07:55:31 -07:00
Raph Levien 495229bf10 Combine tiger and splash screen
Always show the tiger, and include key bindings.
2023-04-28 17:15:28 -07:00
Raph Levien 152fa00843 Basic splash screen
Just has key bindings for now.
2023-04-28 16:44:37 -07:00
Raph Levien 8a083d9473 Nicer HTML
It's easier with innerHTML rather than constructing DOM by hand.
2023-04-28 14:33:24 -07: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
Daniel McNab 299b47ea06
Update the bevy example to wgpu 0.16 (#313)
* Update the bevy example to wgpu 0.16

After https://github.com/bevyengine/bevy/pull/8446

* Remove inaccurate README warning
2023-04-27 08:41:17 +01:00
Daniel McNab 1529945a5a Update cargo-run-wasm 2023-04-24 15:46:18 -07:00
Arman Uguray 51f00fbd1f Fix the headless example for wgpu 0.16 2023-04-24 10:41:25 -07:00
Arman Uguray bb117da352 Enable wasm-bindgen feature of instant crate 2023-04-23 16:00:01 -07:00
Arman Uguray 4642fa024f [with_winit] Set the canvas size to thw winit Window's inner size
This prevents the scaling caused by the hardcoded canvas dimensions on
high dpi platforms.
2023-04-23 12:02:39 -07:00
Arman Uguray 5543ad01fe [examples] Use instant crate's time::Instant
crates.io/crates/instant provides a std::time::Instant implementation
that works on both WASM and non-wasm builds.
2023-04-23 12:02:39 -07:00
Arman Uguray 23f26ef2a1 [svg] Log parse and render times separately
The examples logged the total processing time for an SVG including both
parse and GPU buffer encoding times. Times for these two operations are
now logged separately.
2023-04-21 18:31:20 -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
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
Raph Levien 8cfe903f7e Change image to flower
Using vector graphics for the image doesn't make a huge amount of sense. The flower photo is by Raph and happily licensed to anyone who wants to use it.
2023-03-22 15:53:44 -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 703d22f4b7 [frame_stats] Use match statement for color coding graph 2023-03-21 15:29:16 -07:00
Arman Uguray 6f3051837f [frame_stats] Adapt the graph scale based on the current mean frame time
This allows the graph to display at a reasonable scale in the face of
fluctuations and a max recorded sample that is much larger than the
current average.
2023-03-21 15:16:45 -07:00
Arman Uguray e6f4f6de57 [frame_stats] Draw thresholds for 16.66ms, 33.33ms, and 8.33 timings
Also added color coding for the bar graph based on these thresholds.
2023-03-21 11:38:38 -07:00
Arman Uguray 5ba2826460 [frame_stats] Scale the frame time graph linearly
The sqrt scale doesn't add much value any more since the max frame time
can be reset with a keypress.
2023-03-21 11:34:33 -07: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 02a222f435 [frame_stats] Reduce stats time delta between elapsed() and next frame start time
This does not account for the time spent in processing
`Stats::add_sample` but it should be very close.
2023-03-21 11:34:20 -07:00
Arman Uguray a1c0df1058 [frame_stats] Track frame time more tightly
We now track the frame time from snapshot to snapshot corresponding to
the exact presentation time.
2023-03-21 11:34:14 -07:00