Open-Source Wikis

/

wgpu

/

Crates

/

xtask

gfx-rs/wgpu

xtask

xtask (xtask/) is the workspace's automation crate. The pattern is the standard "cargo xtask" idiom: a binary inside the workspace that contributors invoke as cargo xtask <subcommand> for repo-wide tasks that don't fit neatly into cargo itself.

A second xtask crate exists at naga/xtask/ for naga-specific automation, mainly the validate <backend> command.

Purpose

  • Centralize cargo nextest invocations with the right flags and feature combinations (xtask test).
  • Drive WebGPU CTS runs (xtask cts).
  • Build / serve the wasm examples (xtask run-wasm).
  • Audit CHANGELOG.md (xtask changelog).
  • Handle Windows-only setup like installing WARP and the D3D12 Agility SDK.
  • Re-vendor web-sys WebGPU bindings.
  • Drive the miri test runs.

Directory layout

xtask/
├── Cargo.toml
└── src/
    ├── main.rs                 dispatch + help text
    ├── changelog.rs            ~18 KB
    ├── cts.rs                  ~16 KB
    ├── install_agility_sdk.rs
    ├── install_warp.rs
    ├── miri.rs
    ├── run_wasm.rs
    ├── test.rs
    ├── util.rs
    └── vendor_web_sys.rs       ~11 KB

Subcommands

cargo xtask --help prints the full list; xtask/src/main.rs is the source. Summary:

Subcommand What it does
cts Build, check out the pinned CTS, and run it via Deno.
test Run nextest with the right feature combos and platform shims.
run-wasm Build wasm examples and serve them locally.
changelog Audit CHANGELOG.md. Used in CI on PRs.
miri Run miri-compatible tests under miri.
vendor-web-sys Regenerate the web-sys WebGPU bindings vendored under wgpu/src/backend/webgpu/web-sys-vendored/.
install-warp Download Microsoft WARP DLL for software DX12 testing.
install-agility-sdk Install the D3D12 Agility SDK for an up-to-date runtime.

Each subcommand has a help block in xtask/src/main.rs::HELP.

naga's xtask

naga/xtask/ is invoked from the naga/ directory:

cd naga
cargo xtask validate spv      # SPIRV-Tools required
cargo xtask validate msl      # XCode CLI tools (macOS)
cargo xtask validate glsl     # glslang
cargo xtask validate hlsl dxc # DXC
cargo xtask validate hlsl fxc # FXC (Windows)
cargo xtask validate dot      # GraphViz
cargo xtask validate wgsl

It runs the corresponding external tool against every checked-in snapshot output for that backend and reports failures. naga/README.md describes when each tool is required.

Integration points

  • Above: contributors and CI workflows.
  • Below: every other crate in the workspace, plus external tools (cargo nextest, Deno, SPIRV-Tools, glslang, DXC, FXC, GraphViz, miri).

Entry points for modification

  • Add a subcommand — add a module under xtask/src/, route to it from main.rs, and document it in HELP. Try to make the command printable as --help's text matches the implementation.
  • Add a workflow shim — for repo-wide tasks. Don't add a shim for one-off scripts — keep those in docs/ or the relevant crate.
  • A naga-specific toolnaga/xtask/.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

xtask – wgpu wiki | Factory