Skip to main content

Module validation_log

Module validation_log 

Source
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::begin and Checkpoint::finish, plus earlier unclaimed records labelled with this checkpoint’s name.
TestTurn
A test’s GPU turn: the suite’s serializing guard plus a Checkpoint named after the test, which reports or fails before the guard is released.
TurnSettings
What a TestTurn does when its turn ends.
ValidationRecord
One message a wgpu_hal target logged at Error or Warn.

Enums§

InstallError
Why install could not make the collector the process’s logger.
ValidationMode
What a TestTurn does with the records of its turn, from ALPHA2_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 Warn level. Idempotent; a no-op on wasm.
install_unless_off
Installs the collector unless mode is ValidationMode::Off. Call before the first device so its D3D12 queue is watched.
mode
The ALPHA2_VALIDATION_LOG mode, read once: off, report or fail, default report.