mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Document how to run examples
This commit is contained in:
parent
f385b787a1
commit
9374d52272
27
README.md
27
README.md
@ -10,3 +10,30 @@ The implementation consists of the following parts:
|
||||
- `wgpu-bindings` - automatic generator of actual C headers
|
||||
- `wgpu-remote` - remoting layer to work with WebGPU across the process boundary
|
||||
- `wgpu-rs` - idiomatic Rust wrapper of the native library
|
||||
|
||||
## Example
|
||||
|
||||
To run an example, simply `cd` to the `examples` or `gfx-examples` directory, then use `cargo run` with `--features {backend}` to specify the backend (where `{backend}` is either `vulkan`, `dx12`, `dx11` or `metal`). For example:
|
||||
|
||||
```bash
|
||||
# Clone the wgpu repository
|
||||
git clone https://github.com/gfx-rs/wgpu
|
||||
# Change directory to `examples`
|
||||
cd wgpu/examples
|
||||
# Vulkan (Linux/Windows)
|
||||
cargo run --bin hello_triangle --features vulkan
|
||||
# Metal (macOS/iOS)
|
||||
cargo run --bin hello_triangle --features metal
|
||||
# DirectX12 (Windows)
|
||||
cargo run --bin hello_triangle --features dx12
|
||||
|
||||
cd ../gfx-examples
|
||||
# Vulkan (Linux/Windows)
|
||||
cargo run --bin cube --features vulkan
|
||||
# Metal (macOS/iOS)
|
||||
cargo run --bin cube --features metal
|
||||
# DirectX12 (Windows)
|
||||
cargo run --bin cube --features dx12
|
||||
```
|
||||
|
||||
These examples assume that necessary dependencies for the graphics backend are already installed. For more information about installation and usage, refer to the [Getting Started](https://github.com/gfx-rs/gfx/blob/master/info/getting_started.md) guide.
|
||||
|
@ -14,7 +14,6 @@ path = "hello_triangle_rust/main.rs"
|
||||
[features]
|
||||
default = []
|
||||
remote = ["wgpu-native/remote"]
|
||||
winit = ["wgpu/winit"]
|
||||
metal = ["wgpu-native/gfx-backend-metal"]
|
||||
dx11 = ["wgpu-native/gfx-backend-dx11"]
|
||||
dx12 = ["wgpu-native/gfx-backend-dx12"]
|
||||
@ -22,5 +21,5 @@ vulkan = ["wgpu-native/gfx-backend-vulkan"]
|
||||
|
||||
[dependencies]
|
||||
wgpu-native = { path = "../wgpu-native" }
|
||||
wgpu = { path = "../wgpu-rs" }
|
||||
wgpu = { path = "../wgpu-rs", features=["winit"] }
|
||||
env_logger = "0.5"
|
||||
|
@ -58,8 +58,6 @@ fn main() {
|
||||
vertex_buffers: &[],
|
||||
});
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
{
|
||||
use wgpu_native::winit::{ControlFlow, Event, ElementState, EventsLoop, KeyboardInput, Window, WindowEvent, VirtualKeyCode};
|
||||
|
||||
let mut events_loop = EventsLoop::new();
|
||||
@ -120,5 +118,4 @@ fn main() {
|
||||
|
||||
ControlFlow::Continue
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# gfx pre-ll examples
|
||||
|
||||
The original gfx-rs examples had grown over several years, but then were abandoned owhen the gfx API was changed to match Vulkan:
|
||||
The original gfx-rs examples had grown over several years, but then were abandoned when the gfx API was changed to match Vulkan:
|
||||
https://github.com/gfx-rs/gfx/tree/pre-ll/examples
|
||||
|
||||
wgpu-rs is considered to be the spiritual successor of gfx pre-ll, so this is the new home for the examples.
|
||||
|
Loading…
Reference in New Issue
Block a user