Skip to main content

Dx12AgilitySDK

Struct Dx12AgilitySDK 

Source
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: u32

The 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: String

Path to the directory containing the Agility SDK’s D3D12Core.dll.

§on_load_failure: Dx12AgilitySDKLoadFailure

What 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

Source

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.

Source

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

Source§

fn clone(&self) -> Dx12AgilitySDK

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dx12AgilitySDK

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more