Expand description
GPU device acquisition, adapter classification (Capabilities), queue access shared with
native code (ExternalQueueLock), and collection of uncaptured errors and device losses
(GpuDiagnosticLog).
§wgpu interop
The default API names no wgpu type. Items that hand out or adopt wgpu handles are
documented only with the wgpu-interop feature, which also re-exports wgpu and follows its
major version. Without the feature they are hidden and not part of the public API.
Re-exports§
pub use context::ExternalQueueLock;pub use context::GpuContext;pub use context::ProductRequest;pub use context::SoftwareAdapters;pub use context::product_backends;pub use instance::Dx12Compiler;pub use instance::InstanceSettings;pub use instance::InstanceSettingsError;pub use instance::ShaderCompiler;pub use instance::configure_instances;pub use instance::dx12_shader_compiler;pub use instance::instance_settings;pub use instance::shader_compiler_of;
Modules§
- validation_
log - Collects the validation messages
wgpu-halsends only to thelogcrate, so tests can report or fail on them.
Structs§
- Acquisition
Guard - While alive, keeps other threads out of acquisitions guarded by
serialize_acquisition. The holding thread may re-enter. - Adapter
Choice Report - What a host’s adapter choice was, as its capabilities and failure reports state it.
- Adapter
Order - The adapters a policy takes, best first, and why the first one leads.
- Adapter
Record - What one adapter was found to do. Checks that were not made are
Err, so the choice never assumes a capability. - Capabilities
- Adapter facts relevant to rendering decisions.
- GpuContext
- A GPU device and queue owned by one render host.
- GpuDiagnostic
Log - The most recent
GpuDiagnostics in arrival order, bounded tocapacityevents of at mostMAX_DIAGNOSTIC_MESSAGE_BYTESeach. - GpuDiagnostic
Snapshot - What a
GpuDiagnosticLogheld when it was read. - GpuError
- Failure while acquiring a GPU context, with the platform reason as its
source. - GpuRate
- One device’s rate, shared by every context clone and renderer on it.
- Instance
Settings - The settings every instance of the process is made with.
- Product
Request - What a product request may open.
Enums§
- Adapter
Policy - How the renderer’s adapter is chosen (
ALPHA2_GPU_ADAPTER). - Capability
Tier - The capability class exposed to renderer code.
- Choice
Reason - Why the chosen adapter was taken.
- Dx12
Compiler - The DX12 shader compiler the process’s instances use.
- GpuAcquisition
Step - The step of acquiring a GPU context that failed.
- GpuDiagnostic
- A device-level GPU event that no call return value reports.
- GpuError
Kind - What class of error the driver reported.
- Instance
Settings Error - Why
configure_instancesrefused new settings. - Intermediate
Format - Internal compositing texture format.
- Shader
Compiler - The DX12 shader compiler a descriptor asks for, as reports name it.
- Software
Adapters - Whether a product request may open a device on a software adapter
(lavapipe, llvmpipe, WARP,
SwiftShader).
Constants§
- GPU_
ENCODE_ CODECS - The codecs a GPU encoder is asked about, in the order a report lists them.
- MAX_
DIAGNOSTIC_ MESSAGE_ BYTES - Longest message a
GpuDiagnosticLogkeeps, in bytes; validation errors can quote whole shaders. - UNCALIBRATED_
MS_ PER_ UNIT_ PIXEL - The rate assumed before calibration, in milliseconds per unit pixel: twice the slowest measured rate (integrated GPUs), so early frames are split too finely rather than too coarsely.
- WATCHDOG_
MS - The assumed watchdog in milliseconds: Windows’ default TDR, the shortest of the platforms.
Traits§
- External
Queue Lock - Serializes queue access with another API that shares the same queue.
Functions§
- configure_
instances - Sets the settings every instance of this process is made with.
- decode_
refusals - Why
chosencannot decode, from the records of every hardware adapter considered. - dx12_
shader_ compiler - The DX12 shader compiler this process’s DX12 instances use.
- encode_
elsewhere - For each codec
chosendoes not encode on the GPU, another hardware adapter that does and theALPHA2_GPU_ADAPTERsetting that selects it. - explain_
choice - One sentence explaining why
chosenwas taken, naming the runner-upnextwhere relevant. - gl_
version_ supported - Whether a GL adapter’s
GL_VERSIONmeets desktop GL 4.3 or GLES 3.1. Unparseable versions are accepted and left to the device request. - high_
performance_ rank - Rank in wgpu-core’s high-performance order: discrete, integrated, other, virtual, CPU.
- hung_
threshold_ ms - Half the watchdog. A submission this long before a device loss is taken as its cause.
- instance_
settings - The process’s instance settings, taken from the environment if none were configured.
- product_
backends - Product backend groups in order: DX12 on Windows, Metal on macOS, Vulkan then GL elsewhere,
any in the browser.
WGPU_BACKENDreplaces them when set. - product_
order - Enumeration positions of
kindssorted byhigh_performance_rank. - rank_
adapters - The adapters
policyaccepts amongrecords(in high-performance order), best first.decode_allowedsays whether the decode policy allows GPU decoding. Software adapters always rank after hardware ones. - serialize_
acquisition - Waits until no other thread holds an
AcquisitionGuardand returns one. - set_
watchdog_ ms - Overrides the watchdog for this process; zero restores the default. Lets browser tests, which have no environment variables, shorten it.
- shader_
compiler_ of - The DX12 shader compiler
descriptorasks for, read after its environment overrides. - software_
adapter - Whether
infois a software adapter:DeviceType::Cpuor a name matched bysoftware_renderer_name. - software_
renderer_ name - Whether a renderer or adapter name (including a browser’s unmasked WebGL renderer string) is a software rasterizer’s, ignoring case.
- submission_
budget_ ms - An eighth of the watchdog per submission, leaving room for other work on the GPU.
- watchdog_
ms - The watchdog in milliseconds:
set_watchdog_ms, else a positiveALPHA2_GPU_WATCHDOG_MS(native only), elseWATCHDOG_MS.
Type Aliases§
- GpuDiagnostic
Handler - Shared handler invoked for every
GpuDiagnostic.