Open-Source Wikis

/

wgpu

/

Crates

/

Noop backend

gfx-rs/wgpu

Noop backend

The Noop backend (wgpu-hal/src/noop/) is a stub HAL implementation that does no work and talks to no driver. It exists for testing and validation paths that don't need (or shouldn't depend on) a real GPU.

Purpose

  • Run validation tests and trace round-trip tests without requiring graphics hardware.
  • Provide a deterministic, fast baseline for CI on machines where drivers aren't reliably available.
  • Let the validation tests in tests/tests/wgpu-validation/ and the trace tests in tests/tests/wgpu_trace.rs exercise wgpu-core's logic without reproducible-on-this-driver caveats.

Directory layout

wgpu-hal/src/noop/
├── mod.rs        Api impl + all the no-op resource types
└── ...           tiny, single-file backend

How it works

The backend implements every method of every HAL trait by returning a successful "default" value, performing no allocations beyond what's needed to satisfy lifetimes, and recording nothing. Resource creation returns opaque handles that don't reference real GPU memory; queue submissions are immediately considered complete.

InstanceFlags::NOOP is implied — the backend ignores debug/validation flags. Selecting it via WGPU_BACKEND=noop makes wgpu-core treat the noop adapter as a real device.

When to use

  • Writing or running tests/tests/wgpu-validation/ — to test wgpu-core's validator without needing a GPU.
  • Writing or running tests/tests/wgpu_trace.rs — to record a trace of API calls and assert on its contents.
  • Reproducing a wgpu-core bug that doesn't depend on driver behavior.

When not to use

  • Anything that requires GPU output (image diff tests, anything that submits a real workload).
  • Any test that exercises driver-specific behavior (which is most tests/tests/wgpu-gpu/ content).

Integration points

  • Above: wgpu-core (selected when Features::NOOP or env var WGPU_BACKEND=noop).
  • Below: nothing.

Entry points for modification

There's not much to modify. If a new HAL trait method is added to wgpu-hal/src/lib.rs, give it a no-op implementation here. Most new methods just become Ok(...) returns.

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

Noop backend – wgpu wiki | Factory