Study examples for WebGPU using the wgpu crate in Rust
This repo uses Cargo's examples/ convention. Each example lives in its own folder as a mini-crate with a main.rs (and optional assets/shaders).
01-clear-display:examples/01-clear-display/main.rs– clears the window to BLUE
Shows the minimal setup to acquire a surface, configure it, and clear the window every frame.
- Run:
cargo run --example 01-clear-display
- Expected result: a blue window like below
- Create a new folder under
examples/<your-example>/. - Add a
main.rsinside that folder. - Use an existing example as a template and change what you need (e.g., clear color, pipeline, etc.).
- Run it via:
cargo run --example <your-example>
cargo build --examplesThese examples use env_logger. To adjust verbosity:
RUST_LOG=info cargo run --example 01-clear-display