Skip to content

Commit

Permalink
Merge branch 'main' into update_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PoignardAzur authored Mar 2, 2024
2 parents 3a3d69f + 5d30f52 commit 4d2f356
Show file tree
Hide file tree
Showing 17 changed files with 398 additions and 277 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/web-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Web Demo Update

on:
push:
branches:
- main

jobs:
release-web:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: install wasm-bindgen
uses: jetli/[email protected]
with:
version: 'latest'

- name: build (wasm)
run: cargo build -p with_winit --bin with_winit_bin --release --target wasm32-unknown-unknown
env:
RUSTFLAGS: '--cfg=web_sys_unstable_apis'

- name: package wasm
run: |
mkdir public
wasm-bindgen --target web --out-dir public target/wasm32-unknown-unknown/release/with_winit_bin.wasm --no-typescript
cat << EOF > public/index.html
<html>
<title>Vello Web Demo</title>
<meta content=no-cache http-equiv=Cache-control>
<meta content=-1 http-equiv=Expires>
<script type=module>import initSync from"/vello/with_winit_bin.js";initSync(`/vello/with_winit_bin_bg.wasm`);</script>
<link as=fetch crossorigin href=/vello/with_winit_bin_bg.wasm rel=preload type=application/wasm>
<link crossorigin href=/vello/with_winit_bin.js rel=modulepreload>
</head>
<body>
<style>
body {
margin: 0;
padding: 0;
}
</style>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './public'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
42 changes: 25 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[workspace]
resolver = "2"

members = [
"crates/encoding",
"crates/shaders",
Expand All @@ -13,27 +12,33 @@ members = [
"examples/with_bevy",
"examples/run_wasm",
"examples/scenes",
"examples/shapes",
"examples/simple",
]

[workspace.package]
# Vello version, also used by other packages which want to mimic Vello's version.
# Right now those packages include vello_encoding and vello_shaders.
#
# NOTE: When bumping this, remember to also bump the aforementioned other packages'
# version in the dependencies section at the bottom of this file.
# Additionally, bump the Vello dependency version in the 'simple' example.
version = "0.1.0"

edition = "2021"
version = "0.0.1"
license = "MIT OR Apache-2.0"
rust-version = "1.75"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/linebender/vello"

[package]
name = "vello"
description = "An experimental GPU compute-centric 2D renderer"
version.workspace = true
description = "An experimental GPU compute-centric 2D renderer."
categories = ["rendering", "graphics"]
keywords = ["2d", "vector-graphics"]

# This crate is intended for publishing, but not ready yet
publish = false

version.workspace = true
license.workspace = true
exclude = ["/.github/", "/doc/", "/examples/", ".gitignore"]
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true

[features]
Expand All @@ -42,26 +47,29 @@ hot_reload = []
buffer_labels = []

[dependencies]
vello_encoding = { workspace = true }
bytemuck = { workspace = true }
skrifa = { workspace = true }
peniko = { workspace = true }
wgpu = { workspace = true, optional = true }
raw-window-handle = "0.6"
futures-intrusive = "0.5.0"
vello_encoding = { path = "crates/encoding" }
raw-window-handle = { workspace = true }
futures-intrusive = { workspace = true }
wgpu-profiler = { workspace = true, optional = true }

[workspace.dependencies]
bytemuck = { version = "1.12.1", features = ["derive"] }
skrifa = "0.15.4"
vello_encoding = { version = "0.1.0", path = "crates/encoding" }
bytemuck = { version = "1.14.3", features = ["derive"] }
skrifa = "0.15.5"
peniko = "0.1.0"
futures-intrusive = "0.5.0"
raw-window-handle = "0.6"

# NOTE: Make sure to keep this in sync with the version badge in README.md
wgpu = { version = "0.19" }


# Used for examples
clap = "4.1.0"
clap = "4.5.1"
anyhow = "1.0"
instant = { version = "0.1.12", features = ["wasm-bindgen"] }
pollster = "0.3.0"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Other platforms are more tricky, and may require special building/running proced
Because Vello relies heavily on compute shaders, we rely on the emerging WebGPU standard to run on the web.
Until browser support becomes widespread, it will probably be necessary to use development browser versions (e.g. Chrome Canary) and explicitly enable WebGPU.

The following command builds and runs a web version of the [winit demo](#winit).
The following command builds and runs a web version of the [winit demo](#winit).
This uses [`cargo-run-wasm`](https://github.com/rukai/cargo-run-wasm) to build the example for web, and host a local server for it

```shell
Expand All @@ -191,6 +191,8 @@ rustup target add wasm32-unknown-unknown
cargo run_wasm -p with_winit --bin with_winit_bin
```

There is also a web demo [available here](https://linebender.github.io/vello) on supporting web browsers.

> [!WARNING]
> The web is not currently a primary target for Vello, and WebGPU implementations are incomplete, so you might run into issues running this example.
Expand Down
4 changes: 3 additions & 1 deletion crates/encoding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "vello_encoding"
version = "0.1.0"
version.workspace = true # We mimic Vello's version
description = "Vello types that represent the data that needs to be rendered."
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true

Expand Down
5 changes: 5 additions & 0 deletions crates/encoding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vello Encoding

This package contains types that represent data that [Vello] can render.

[Vello]: https://github.com/linebender/vello
10 changes: 7 additions & 3 deletions crates/shaders/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[package]
name = "vello_shaders"
version = "0.1.0"
version.workspace = true # We mimic Vello's version
description = "Vello infrastructure to preprocess and cross-compile shaders at compile time."
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true

publish = false # Remove this when the package is ready for publishing

[features]
default = ["compile", "wgsl", "msl"]
compile = ["naga", "thiserror"]
Expand All @@ -28,9 +32,9 @@ msl = []

[dependencies]
naga = { version = "0.13", features = ["wgsl-in", "msl-out", "validate"], optional = true }
thiserror = { version = "1.0.40", optional = true }
thiserror = { version = "1.0.57", optional = true }

[build-dependencies]
naga = { version = "0.13", features = ["wgsl-in", "msl-out", "validate"] }
thiserror = "1.0.40"
thiserror = "1.0.57"

10 changes: 4 additions & 6 deletions crates/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
[package]
name = "vello_tests"
description = "Integration tests for Vello."
edition.workspace = true
version.workspace = true
license.workspace = true
repository.workspace = true
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
vello = { path = "../.." }
image = "0.24.5"
image = "0.24.9"
anyhow = { workspace = true }

wgpu = { workspace = true }
pollster = { workspace = true }
png = "0.17.7"
futures-intrusive = "0.5.0"
png = "0.17.13"
futures-intrusive = { workspace = true }
20 changes: 8 additions & 12 deletions examples/headless/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
[package]
name = "headless"
description = "An example showing how to use `vello` to create raster images"
publish = false

version.workspace = true
license.workspace = true
description = "An example showing how to use Vello to create raster images."
edition.workspace = true
license.workspace = true
repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
publish = false

[dependencies]
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
vello = { path = "../../" }
scenes = { path = "../scenes" }
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }

wgpu = { workspace = true }
pollster = { workspace = true }
env_logger = "0.10.0"
png = "0.17.7"
futures-intrusive = "0.5.0"
env_logger = "0.11.2"
png = "0.17.13"
futures-intrusive = { workspace = true }
8 changes: 2 additions & 6 deletions examples/run_wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
[package]
name = "run_wasm"
publish = false

version.workspace = true
license.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
publish = false

[dependencies]
cargo-run-wasm = "0.3.2"
14 changes: 5 additions & 9 deletions examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
[package]
name = "scenes"
description = "Vello scenes used in the other examples"
publish = false

version.workspace = true
license.workspace = true
description = "Vello scenes used in the other examples."
edition.workspace = true
license.workspace = true
repository.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
publish = false

[dependencies]
vello = { path = "../../" }
vello_svg = { path = "../../integrations/vello_svg" }
anyhow = { workspace = true }
clap = { workspace = true, features = ["derive"] }
image = "0.24.5"
image = "0.24.9"
rand = "0.8.5"
instant = { workspace = true }

# Used for the `download` command
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
byte-unit = "4.0"
dialoguer = "0.10"
ureq = "2.6"
ureq = "2.9"
Loading

0 comments on commit 4d2f356

Please sign in to comment.