Commit graph

105 commits

Author SHA1 Message Date
Arman Uguray
89fb1b89da [frame_stats] Add frame statistics UI to with_winit example
Added a module for frame time statistics and UI layer that displays
the average, minimum, and maximum frame time alongside FPS. The UI
can be toggled by pressing the `S` key.
2023-03-21 11:33:22 -07:00
Daniel McNab
17096ad878
Update for Bevy 0.10 and other dependencies (#290) 2023-03-16 15:44:10 +00:00
Daniel McNab
fd6bfe91d6
Fix handling of interactivity (#295)
* Fix handling of interactivity

* Sort out silly mixup
2023-03-16 13:38:43 +00:00
Florian Köhler
c503973739
Add space key for transform reset (#294)
Co-authored-by: Florian Köhler <power-unsealed>
2023-03-15 15:18:16 +00: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
165b3a083b Let's add images 2023-03-09 17:18:03 -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
d72ad14059 Add a test scene that animates the base color
The test scenes can now supply their own optional base (background)
color. In the with_winit example, we also allow the user to provide a
base color as a CLI option. The precedence is as follows:

   1. Use the color from the CLI options, if any.
   2. Otherwise use the scene provided base color, if any.
   3. Otherwise default to black.
2023-03-03 11:30:12 -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
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
2ef58adad5 Glyph run API 2023-02-23 22:59:03 -05:00
Chad Brokaw
c65c19dc4f add additional test scene 2023-02-22 22:32:04 -05:00
Daniel McNab
db243aed4e Add a keyboard key to rotate the scene 2023-02-22 12:35:28 +00:00
Jason Davies
5f59a2e818
Fix include_str! compile error in examples/scenes. (#279)
I don't think CARGO_MANIFEST_DIR should ever end in "/", though I've
only checked on Linux and macOS.
2023-02-11 09:44:18 +00:00
Arman Uguray
68022d2f4f
Merge pull request #277 from DJMcNab/headless
Create a headless example
2023-02-09 08:05:26 -08:00
Daniel McNab
56939df615 Re-use render context in headless 2023-02-09 09:34:53 +00:00
Daniel McNab
19552ad819 Update to better match other examples 2023-02-08 22:48:34 +00:00
Daniel McNab
3a63f00e7e Fix handling of wgpu to hopefully be valid 2023-02-08 21:43:24 +00:00
Arman Uguray
fb4cfcdc9e
Merge pull request #275 from DJMcNab/bevy_stageless
Migrate the bevy example to stageless
2023-02-07 13:35:03 -08:00
Daniel McNab
d366151970 Support changing the output directory 2023-02-07 16:37:29 +00:00
Daniel McNab
6e1481db40 Finish the headless example 2023-02-07 16:26:56 +00:00
Daniel McNab
65a7970382 Setup infra for headless examples 2023-02-07 12:52:22 +00:00
Arman Uguray
2690c3602d
Merge pull request #271 from armansito/pr-conflation-examples
Introduce test scenes that demonstrate conflation artifacts
2023-02-06 15:24:38 -08:00
Daniel McNab
ef44c17f92
Update dependencies, and add more metadata (#272) 2023-02-06 20:12:46 +00:00
Daniel McNab
7abbf2ece2 Migrate the bevy example to stageless 2023-02-06 15:45:36 +00:00
Arman Uguray
97e6e12799 Use accessible colors that maintain contrast in the conflation scene 2023-02-03 12:27:42 -08:00
Arman Uguray
fff43bba0d ran cargo fmt; fixed spelling in comment 2023-02-03 09:34:12 -08:00
Arman Uguray
dc2e6690c4 Introduce test scenes that demonstrates conflation artifacts
Added two scenes that demonstrate conflation artifacts as described in
https://github.com/linebender/vello/issues/49. The first scene
demonstrates adjacent triangles and rects that belong to the same path
and use opposite winding.

The second scene demonstrates strokes with overlapping square caps
(these strokes are currently expressed as rects painted with the NonZero
fill rule).
2023-02-03 09:32:41 -08:00
Daniel McNab
020a7f5c01
Split the examples into frontends with a shared scene repository (#262) 2023-02-03 10:22:39 +00:00
Daniel McNab
9721d4a6ac
Some WASM changes - including a run_wasm alias (#251) 2023-01-31 16:12:46 +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
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
Joe Neeman
338bd30870 Allow selecting GPU from env 2023-01-21 14:30:40 -06:00
David Himmelstrup
9ba85075d4
example: SVG viewer based on usvg (#260) 2023-01-21 18:20:56 +00:00
Chad Brokaw
516fd6c981 Update for peniko changes
This applies updates for the gradient API in peniko and pins the git dependency so prevent further breakage. Also removes Cargo.lock.
2023-01-17 12:31:57 -05:00
Daniel McNab
44058a8578
Improve the svg parser (#247)
* Improve the svg parser

* Handle `opacity`

* Double the segments buffer

* Rotate the multiplication

This matches firefox's output, although it is contrary to my use
of 3d transformation matrices

* Double ptcl size

Seems to be required to show entire scene at 4k
2023-01-16 18:22:35 +00:00
Daniel McNab
ed60031185
Add hot reloading of shaders to the winit example (#252) 2023-01-16 17:24:48 +00:00
Daniel McNab
db4fc4e449
Give buffers names when buffer_labels feature is enabled (#254) 2023-01-16 17:16:45 +00:00
Daniel McNab
eec111c633
Support click and drag for svgs, as well as scene fragment caching (#244)
* Support caching the image, and click and drag motion

* Remove debug print

* Clean up examples to have command line parsing

* Address review comments
2023-01-13 19:30:08 +00:00
Chad Brokaw
c6ac5bf590 Support even-odd fill rule
Add logic for handling the even-odd fill rule to `SceneBuilder` and the coarse and fine shaders.
2023-01-10 15:22:04 -05:00