Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: repo documentation, crate names #552

Merged
merged 18 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The repository is structured as such:
- `tests/` - Helper code for writing tests; current has a single smoke test and not much else.
- `doc/` - Various documents detailing the vision for Vello as it was developed. This directory should probably be refactored away; adding to it not recommended.
- `examples/` - Example projects using Vello. Each example is its own crate, with its own dependencies. The simplest example is the `shapes` one.
- `integrations/vello_svg` - An SVG rendered based on Vello and usvg. Used in examples. May be moved to `crates/` in the future.
- `integrations/demo_svg` - An SVG rendered based on Vello and usvg. Used in examples. May be moved to `crates/` in the future.
- `shader/` - This is where the magic happens. WGSL shaders that define the compute operations (often variations of prefix sum) that Vello does to render a scene.
- `shared/` - Shared types, functions and constants included in other shaders through non-standard `#import` preprocessor directives (see "Shader templating").
- `src/` - Code for the main `vello` crate.
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

<!-- Instructions

This changelog follows the patterns described here: <https://keepachangelog.com/en/1.0.0/>.

Subheadings to categorize changes are `added, changed, deprecated, removed, fixed, security`.

-->

## Unreleased

### Changed

- [#547](https://github.com/linebender/vello/pull/547) - `RenderContext::new()` no longer returns a `Result` by [@waywardmonkeys](https://github.com/waywardmonkeys)
simbleau marked this conversation as resolved.
Show resolved Hide resolved

## 0.1 (2024-03-04)

- Initial release
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"crates/shaders",
"crates/tests",

"integrations/vello_svg",
"integrations/demo_svg",

"examples/headless",
"examples/with_winit",
Expand Down
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@

# Vello

**An experimental GPU compute-centric 2D renderer**
**An experimental GPU compute-centric 2D renderer.**
simbleau marked this conversation as resolved.
Show resolved Hide resolved

[![Linebender Zulip](https://img.shields.io/badge/Linebender-%23gpu-blue?logo=Zulip)](https://xi.zulipchat.com/#narrow/stream/197075-gpu)
[![dependency status](https://deps.rs/repo/github/linebender/vello/status.svg)](https://deps.rs/repo/github/linebender/vello)
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](#license)
[![wgpu version](https://img.shields.io/badge/wgpu-v0.19.3-orange.svg)](https://crates.io/crates/wgpu)
<!-- [![Crates.io](https://img.shields.io/crates/v/vello.svg)](https://crates.io/crates/vello) -->
<!-- [![Docs](https://docs.rs/vello/badge.svg)](https://docs.rs/vello) -->
<!-- [![Build status](https://github.com/linebender/vello/workflows/CI/badge.svg)](https://github.com/linebender/vello/actions) -->

[![Crates.io](https://img.shields.io/crates/v/vello.svg)](https://crates.io/crates/vello)
[![Docs](https://docs.rs/vello/badge.svg)](https://docs.rs/vello)
[![Build status](https://github.com/linebender/vello/workflows/CI/badge.svg)](https://github.com/linebenvello/actions)
simbleau marked this conversation as resolved.
Show resolved Hide resolved

</div>

Vello is an experimental 2D graphics rendering engine written in Rust, with a focus on GPU compute.
It can draw large 2D scenes with interactive or near-interactive performance, using [`wgpu`] for GPU access.

Quickstart to run an example program:

```shell
cargo run -p with_winit
```
Expand Down Expand Up @@ -45,7 +47,6 @@ Vello avoids this by using prefix-sum algorithms to parallelize work that usuall

This means that Vello needs a GPU with support for compute shaders to run.


## Getting started

Vello is meant to be integrated deep in UI render stacks.
Expand Down Expand Up @@ -108,23 +109,19 @@ surface_texture.present();

See the [`examples/`](https://github.com/linebender/vello/tree/main/examples) folder to see how that code integrates with frameworks like winit and bevy.


## Performance

We've observed 177 fps for the paris-30k test scene on an M1 Max, at a resolution of 1600 pixels square, which is excellent performance and represents something of a best case for the engine.

More formal benchmarks are on their way.


## Integrations

### SVG

This repository also includes [`vello_svg`](./integrations/vello_svg/), which supports converting a [`usvg`](https://crates.io/crates/usvg) `Tree` into a Vello scene.

This is currently incomplete; see its crate level documentation for more information.
A separate integration for rendering SVG files is available through the [`vello_svg`](https://github.com/linebender/vello_svg) crate.
simbleau marked this conversation as resolved.
Show resolved Hide resolved

This is used in the [winit](#winit) example for the SVG rendering.
This repository also includes the [`demo_svg`](./integrations/demo_svg/) integration, which supports a minimal subset of SVG features needed for vello examples. This is used in the [winit](#winit) example for the SVG rendering.
simbleau marked this conversation as resolved.
Show resolved Hide resolved
simbleau marked this conversation as resolved.
Show resolved Hide resolved

### Lottie

Expand All @@ -139,12 +136,12 @@ Examples must be selected using the `--package` (or `-p`) Cargo flag.
### Winit

Our [winit] example ([examples/with_winit](https://github.com/linebender/vello/tree/main/examples/with_winit)) demonstrates rendering to a [winit] window.
By default, this renders the [GhostScript Tiger] as well as all SVG files you add in the [examples/assets/downloads/](https://github.com/linebender/vello/tree/main/examples/assets/downloads) directory using [`vello_svg`](#svg).
By default, this renders the [GhostScript Tiger] as well as all SVG files you add in the [examples/assets/downloads/](https://github.com/linebender/vello/tree/main/examples/assets/downloads) directory using [`demo_svg`](#svg).
A custom list of SVG file paths (and directories to render all SVG files from) can be provided as arguments instead.
It also includes a collection of test scenes showing the capabilities of `vello`, which can be shown with `--test-scenes`.

```shell
cargo run -p with_winit
cargo run -p with_winit
```

Some default test scenes can be downloaded from Wikimedia Commons using the `download` subcommand.
Expand All @@ -165,11 +162,11 @@ This currently draws to a [`wgpu`] `Texture` using `vello`, then uses that textu
cargo run -p with_bevy
```

There is also a separate community integration for rendering lottie and SVG files through [`bevy_vello`](https://github.com/vectorgameexperts/bevy_vello).
There is also a separate community integration for rendering raw scenes or Lottie and SVG files through [`bevy_vello`](https://github.com/loopystudios/bevy_vello).

## Platforms

We aim to target all environments which can support WebGPU with the [default limits](https://www.w3.org/TR/webgpu/#limits).
We aim to target all environments which can support WebGPU with the [default limits](https://www.w3.org/TR/webgpu/#limits).
We defer to [`wgpu`] for this support.
Other platforms are more tricky, and may require special building/running procedures.

Expand Down Expand Up @@ -198,31 +195,33 @@ There is also a web demo [available here](https://linebender.github.io/vello) on

The [`with_winit`](#winit) example supports running on Android, using [cargo apk](https://crates.io/crates/cargo-apk).

```
```shell
cargo apk run -p with_winit
```

> [!TIP]
> cargo apk doesn't support running in release mode without configuration.
> [!TIP]
> cargo apk doesn't support running in release mode without configuration.
> See [their crates page docs](https://crates.io/crates/cargo-apk) (around `package.metadata.android.signing.<profile>`).
>
>
> See also [cargo-apk#16](https://github.com/rust-mobile/cargo-apk/issues/16).
> To run in release mode, you must add the following to `examples/with_winit/Cargo.toml` (changing `$HOME` to your home directory):

```
```toml
[package.metadata.android.signing.release]
path = "$HOME/.android/debug.keystore"
keystore_password = "android"
```

> [!NOTE]
> As `cargo apk` does not allow passing command line arguments or environment variables to the app when ran, these can be embedded into the
> [!NOTE]
> As `cargo apk` does not allow passing command line arguments or environment variables to the app when ran, these can be embedded into the
> program at compile time (currently for Android only)
> `with_winit` currently supports the environment variables:
> - `VELLO_STATIC_LOG`, which is equivalent to `RUST_LOG`
> - `VELLO_STATIC_ARGS`, which is equivalent to passing in command line arguments
>
> - `VELLO_STATIC_LOG`, which is equivalent to `RUST_LOG`
> - `VELLO_STATIC_ARGS`, which is equivalent to passing in command line arguments

For example (with unix shell environment variable syntax):

```sh
VELLO_STATIC_LOG="vello=trace" VELLO_STATIC_ARGS="--test-scenes" cargo apk run -p with_winit --lib
```
Expand All @@ -244,6 +243,7 @@ If you encounter a compilation issue due to a dependency and don't want to upgra
# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1
```

</details>

## Community
Expand All @@ -258,7 +258,7 @@ licensed as noted in the "License" section, without any additional terms or cond

## History

Vello was previously known as `piet-gpu`.
Vello was previously known as `piet-gpu`.
This prior incarnation used a custom cross-API hardware abstraction layer, called `piet-gpu-hal`, instead of [`wgpu`].

An archive of this version can be found in the branches [`custom-hal-archive-with-shaders`] and [`custom-hal-archive`].
Expand All @@ -273,11 +273,11 @@ Many of these items are out-of-date or completed, but it still may provide some

Vello takes inspiration from many other rendering projects, including:

* [Pathfinder](https://github.com/servo/pathfinder)
* [Spinel](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/)
* [Forma](https://github.com/google/forma)
* [Massively Parallel Vector Graphics](https://w3.impa.br/~diego/projects/GanEtAl14/)
* [Random-access rendering of general vector graphics](https://hhoppe.com/proj/ravg/)
- [Pathfinder](https://github.com/servo/pathfinder)
- [Spinel](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/)
- [Forma](https://github.com/google/forma)
- [Massively Parallel Vector Graphics](https://w3.impa.br/~diego/projects/GanEtAl14/)
- [Random-access rendering of general vector graphics](https://hhoppe.com/proj/ravg/)

## License

Expand Down
2 changes: 1 addition & 1 deletion examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ workspace = true

[dependencies]
vello = { path = "../../" }
vello_svg = { path = "../../integrations/vello_svg" }
demo_svg = { path = "../../integrations/demo_svg" }
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
image = "0.24.9"
Expand Down
6 changes: 3 additions & 3 deletions examples/scenes/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use std::fs::read_dir;
use std::path::{Path, PathBuf};

use anyhow::{Ok, Result};
use demo_svg::usvg;
use demo_svg::usvg::TreeParsing;
use instant::Instant;
use vello::kurbo::Vec2;
use vello::Scene;
use vello_svg::usvg;
use vello_svg::usvg::TreeParsing;

use crate::{ExampleScene, SceneParams, SceneSet};

Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn svg_function_of<R: AsRef<str>>(
eprintln!("Parsed svg {name} in {:?}", start.elapsed());
let start = Instant::now();
let mut new_scene = Scene::new();
vello_svg::render_tree(&mut new_scene, &svg);
demo_svg::render_tree(&mut new_scene, &svg);
let resolution = Vec2::new(svg.size.width() as f64, svg.size.height() as f64);
eprintln!("Encoded svg {name} in {:?}", start.elapsed());
(new_scene, resolution)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "vello_svg"
name = "demo_svg"
description = "Render a usvg document to a Vello scene"
categories = ["rendering", "graphics"]
keywords = ["2d", "vector-graphics", "vello"]
Expand Down
File renamed without changes.