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

Move to A Single Example Executable #4756

Merged
merged 11 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
511 changes: 96 additions & 415 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [

# default members
"d3d12",
"examples/*",
"examples/",
"naga-cli",
"naga",
"naga/fuzz",
Expand All @@ -23,7 +23,7 @@ members = [
exclude = []
default-members = [
"d3d12",
"examples/*",
"examples/",
"naga-cli",
"naga",
"naga/fuzz",
Expand Down Expand Up @@ -79,12 +79,14 @@ codespan-reporting = "0.11"
ctor = "0.2"
# https://github.com/SiegeEngine/ddsfile/issues/15 (Updated dependencies)
ddsfile = { version = "0.5.2-unstable", git = "https://github.com/SiegeEngine/ddsfile.git", rev = "9b597930edc00502391cbb1a39708dadde0fd0ff" }
encase = "0.6"
env_logger = "0.10"
fern = "0.6"
flume = "0.11"
futures-lite = "1"
futures-intrusive = "0.5"
rustc-hash = "1.1.0"
getrandom = "0.2"
glam = "0.24.2"
heck = "0.4.0"
image = { version = "0.24", default-features = false, features = ["png"] }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict

### Rust

Rust examples can be found at [wgpu/examples](examples). You can run the examples on native with `cargo run --bin <name>`. See the [list of examples](examples).
Rust examples can be found at [wgpu/examples](examples). You can run the examples on native with `cargo run --bin wgpu-examples <example>`. See the [list of examples](examples).

To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin <name>`. Then connect to `http://localhost:8000` in your WebGPU enabled browser.
To run the examples on WebGPU on wasm, run `cargo xtask run-wasm --bin wgpu-example`. Then connect to `http://localhost:8000` in your WebGPU enabled browser, and you can choose an example to run.

To run the examples on WebGL on wasm, run `cargo xtask run-wasm --bin <name> --features webgl`. Then connect to `http://localhost:8000` in your WebGL enabled browser.
To run the examples on WebGL on wasm, run `cargo xtask run-wasm --bin wgpu-example --features webgl`. Then connect to `http://localhost:8000` in your WebGL enabled browser, and you can choose an example to run.

If you are looking for a wgpu tutorial, look at the following:

Expand Down
36 changes: 32 additions & 4 deletions examples/common/Cargo.toml → examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "wgpu-example"
name = "wgpu-examples"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand All @@ -10,15 +10,36 @@ keywords.workspace = true
license.workspace = true
publish = false

[lib]
path = "src/lib.rs"
harness = false

[[bin]]
name = "wgpu-examples"
path = "src/main.rs"
test = false

[dependencies]
bytemuck.workspace = true
cfg-if.workspace = true
ddsfile.workspace = true
encase = { workspace = true, features = ["glam"] }
env_logger.workspace = true
flume.workspace = true
futures-intrusive.workspace = true
getrandom.workspace = true
glam.workspace = true
log.workspace = true
pollster.workspace = true
nanorand.workspace = true
noise.workspace = true
obj.workspace = true
png.workspace = true
pollster.workspace = true
web-time.workspace = true
winit.workspace = true
wgpu.workspace = true
winit.workspace = true

[dev-dependencies]
wgpu-test.workspace = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand All @@ -27,6 +48,7 @@ console_log.workspace = true
fern.workspace = true
js-sys.workspace = true
wasm-bindgen.workspace = true
wasm-bindgen-test.workspace = true
wasm-bindgen-futures.workspace = true
hal = { workspace = true, optional = true }
# We need these features in the framework examples and tests
Expand All @@ -36,7 +58,13 @@ web-sys = { workspace = true, features = [
"RequestInit",
"RequestMode",
"Request",
"ImageData",
"Response",
"HtmlImageElement",
"WebGl2RenderingContext",
"CanvasRenderingContext2d"
"CanvasRenderingContext2d",

# Needed for example display logic
"HtmlStyleElement",
"HtmlHeadElement",
] }
25 changes: 0 additions & 25 deletions examples/boids/Cargo.toml

This file was deleted.

27 changes: 0 additions & 27 deletions examples/bunnymark/Cargo.toml

This file was deleted.

2 changes: 0 additions & 2 deletions examples/common/src/lib.rs

This file was deleted.

23 changes: 0 additions & 23 deletions examples/conservative-raster/Cargo.toml

This file was deleted.

25 changes: 0 additions & 25 deletions examples/cube/Cargo.toml

This file was deleted.

31 changes: 0 additions & 31 deletions examples/hello-compute/Cargo.toml

This file was deleted.

33 changes: 0 additions & 33 deletions examples/hello-synchronization/Cargo.toml

This file was deleted.

24 changes: 0 additions & 24 deletions examples/hello-triangle/Cargo.toml

This file was deleted.

21 changes: 0 additions & 21 deletions examples/hello-windows/Cargo.toml

This file was deleted.

26 changes: 0 additions & 26 deletions examples/hello-workgroups/Cargo.toml

This file was deleted.

27 changes: 0 additions & 27 deletions examples/hello/Cargo.toml

This file was deleted.

Loading
Loading