Expand description
Collects the validation messages wgpu-hal sends only to the log crate, so tests can report
or fail on them.
wgpu-hal logs Vulkan, GL and D3D12 debug messages inside catch_unwind, so a panicking
logger is ignored and without a logger they are dropped. install makes this module the
logger; it keeps wgpu_hal records at Error and Warn and echoes them to standard error.
The D3D12 debug layer reaches wgpu-hal only with a debugger attached, but always stores
messages in the device’s ID3D12InfoQueue. Once installed, every adopted DX12 device’s queue
is read at each checkpoint and the debugger-route records are dropped to avoid duplicates.
Watched devices are kept until process exit.
Tests read their records with a Checkpoint or a TestTurn, which reports or fails per
ALPHA2_VALIDATION_LOG (ValidationMode). Intentional errors go through expect_errors.
Structs§
- Checkpoint
- Records logged between
Checkpoint::beginandCheckpoint::finish, plus earlier unclaimed records labelled with this checkpoint’s name. - Test
Turn - A test’s GPU turn: the suite’s serializing
guardplus aCheckpointnamed after the test, which reports or fails before the guard is released. - Turn
Settings - What a
TestTurndoes when its turn ends. - Validation
Record - One message a
wgpu_haltarget logged atErrororWarn.
Enums§
- Install
Error - Why
installcould not make the collector the process’s logger. - Validation
Mode - What a
TestTurndoes with the records of its turn, fromALPHA2_VALIDATION_LOG.
Functions§
- expect_
errors - Runs
test, which causes validation errors on purpose, and returns the records it logged instead of reporting them. The caller must hold the GPU turn. - install
- Makes the collector the process logger at
Warnlevel. Idempotent; a no-op on wasm. - install_
unless_ off - Installs the collector unless
modeisValidationMode::Off. Call before the first device so its D3D12 queue is watched. - mode
- The
ALPHA2_VALIDATION_LOGmode, read once:off,reportorfail, defaultreport.