Skip to main content

Crate alpha2_gpu

Crate alpha2_gpu 

Source
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-hal sends only to the log crate, so tests can report or fail on them.

Structs§

AcquisitionGuard
While alive, keeps other threads out of acquisitions guarded by serialize_acquisition. The holding thread may re-enter.
AdapterChoiceReport
What a host’s adapter choice was, as its capabilities and failure reports state it.
AdapterOrder
The adapters a policy takes, best first, and why the first one leads.
AdapterRecord
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.
GpuDiagnosticLog
The most recent GpuDiagnostics in arrival order, bounded to capacity events of at most MAX_DIAGNOSTIC_MESSAGE_BYTES each.
GpuDiagnosticSnapshot
What a GpuDiagnosticLog held 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.
InstanceSettings
The settings every instance of the process is made with.
ProductRequest
What a product request may open.

Enums§

AdapterPolicy
How the renderer’s adapter is chosen (ALPHA2_GPU_ADAPTER).
CapabilityTier
The capability class exposed to renderer code.
ChoiceReason
Why the chosen adapter was taken.
Dx12Compiler
The DX12 shader compiler the process’s instances use.
GpuAcquisitionStep
The step of acquiring a GPU context that failed.
GpuDiagnostic
A device-level GPU event that no call return value reports.
GpuErrorKind
What class of error the driver reported.
InstanceSettingsError
Why configure_instances refused new settings.
IntermediateFormat
Internal compositing texture format.
ShaderCompiler
The DX12 shader compiler a descriptor asks for, as reports name it.
SoftwareAdapters
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 GpuDiagnosticLog keeps, 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§

ExternalQueueLock
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 chosen cannot 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 chosen does not encode on the GPU, another hardware adapter that does and the ALPHA2_GPU_ADAPTER setting that selects it.
explain_choice
One sentence explaining why chosen was taken, naming the runner-up next where relevant.
gl_version_supported
Whether a GL adapter’s GL_VERSION meets 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_BACKEND replaces them when set.
product_order
Enumeration positions of kinds sorted by high_performance_rank.
rank_adapters
The adapters policy accepts among records (in high-performance order), best first. decode_allowed says whether the decode policy allows GPU decoding. Software adapters always rank after hardware ones.
serialize_acquisition
Waits until no other thread holds an AcquisitionGuard and 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 descriptor asks for, read after its environment overrides.
software_adapter
Whether info is a software adapter: DeviceType::Cpu or a name matched by software_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 positive ALPHA2_GPU_WATCHDOG_MS (native only), else WATCHDOG_MS.

Type Aliases§

GpuDiagnosticHandler
Shared handler invoked for every GpuDiagnostic.