pub struct Dx12AgilitySDK {
pub sdk_version: u32,
pub sdk_path: String,
pub on_load_failure: Dx12AgilitySDKLoadFailure,
}Expand description
Configuration for loading a specific DirectX 12 Agility SDK runtime.
The Agility SDK allows applications to ship a newer version of the D3D12 runtime
(D3D12Core.dll) alongside the application, enabling access to the latest D3D12
features without waiting for the OS to update its built-in runtime. This is the
standard way for games and applications to adopt new D3D12 functionality on older
Windows versions.
Downloads and release notes are available at the DirectX 12 Agility SDK page.
wgpu loads the Agility SDK via the Independent Devices API, which allows
specifying the SDK path and version at runtime without requiring exported constants
or developer mode. The sdk_version must match the version of
the D3D12Core.dll in the provided path exactly, or loading will fail, irrespective of
the OS’s built-in runtime version.
If the shipped SDK is older than the system runtime, the system runtime will be used. This allows applications to ship a minimum SDK version while still benefiting from SDK updates on the user’s system.
If the Agility SDK fails to load (version mismatch, missing DLL, unsupported OS,
etc.), the behavior is controlled by on_load_failure.
By default, wgpu logs a warning and falls back to the system-installed D3D12 runtime.
Set it to Error to fail instance creation instead
(useful in CI/testing).
§OS requirements
The Independent Devices API requires a Windows update from August/September 2023 or newer:
On older OS builds the Agility SDK will not load and wgpu will log a warning and
fall back to the system runtime (or error, per on_load_failure).
Fields§
§sdk_version: u32The Agility SDK version number (e.g., 614 for SDK version 1.614.0).
This must match the version of the D3D12Core.dll at sdk_path
exactly, or the runtime will fail to load.
sdk_path: StringPath to the directory containing the Agility SDK’s D3D12Core.dll.
on_load_failure: Dx12AgilitySDKLoadFailureWhat to do if the Agility SDK fails to load.
Defaults to Fallback.
Can also be set via the WGPU_DX12_AGILITY_SDK_REQUIRE environment variable
(1 for Error,
0 for Fallback).
Implementations§
Source§impl Dx12AgilitySDK
impl Dx12AgilitySDK
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Read Agility SDK configuration from environment variables.
Reads WGPU_DX12_AGILITY_SDK_PATH, WGPU_DX12_AGILITY_SDK_VERSION,
and WGPU_DX12_AGILITY_SDK_REQUIRE.
Both path and version must be set for this to return Some.
Sourcepub fn with_env(self) -> Self
pub fn with_env(self) -> Self
Takes the given configuration, overrides fields with environment variables if present, and returns the result.
Reads WGPU_DX12_AGILITY_SDK_PATH, WGPU_DX12_AGILITY_SDK_VERSION,
and WGPU_DX12_AGILITY_SDK_REQUIRE.
Each variable overrides the corresponding field independently.
Trait Implementations§
Source§impl Clone for Dx12AgilitySDK
impl Clone for Dx12AgilitySDK
Source§fn clone(&self) -> Dx12AgilitySDK
fn clone(&self) -> Dx12AgilitySDK
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more