locum 0.1.4

Captures everything a Direct3D 11 game draws in a frame, to look at, query, change and replay: d3d11.dll and dxgi.dll beside the game that watch every call on its way to the real runtime.
Documentation
//! Generated by `cargo xtask gen` from the `windows` crate's `ID3D12SDKConfiguration1_Vtbl`; do not edit.

#![allow(
    non_snake_case,
    clippy::too_many_arguments,
    clippy::missing_safety_doc,
    dead_code
)]

use core::ffi::c_void;

/// Every method of `ID3D12SDKConfiguration1` in vtable order. The defaults forward to the wrapped object [`Sdk12Methods::inner`].
///
/// # Safety
/// The implementing type must be `#[repr(C)]` with a pointer to [`vtable`]'s table as its first field,
/// and `inner` must return a live `ID3D12SDKConfiguration1`.
pub unsafe trait Sdk12Methods: Sized {
    /// The wrapped object, an `ID3D12SDKConfiguration1`.
    fn inner(&self) -> *mut c_void;
    unsafe fn QueryInterface(
        &self,
        iid: *const windows::core::GUID,
        out: *mut *mut c_void,
    ) -> windows::core::HRESULT;
    unsafe fn AddRef(&self) -> u32;
    unsafe fn Release(&self) -> u32;
    unsafe fn SetSDKVersion(&self, a0: u32, a1: windows::core::PCSTR) -> windows::core::HRESULT {
        unsafe { real::SetSDKVersion(self.inner(), a0, a1) }
    }
    unsafe fn CreateDeviceFactory(
        &self,
        a0: u32,
        a1: windows::core::PCSTR,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::CreateDeviceFactory(self.inner(), a0, a1, a2, a3) }
    }
    unsafe fn FreeUnusedSDKs(&self) {
        unsafe { real::FreeUnusedSDKs(self.inner()) }
    }
}

/// Each method called on the real (wrapped) object: the trait's defaults, and overrides that still want the
/// real behaviour.
pub mod real {
    use core::ffi::c_void;

    /// `SetSDKVersion` on the real object.
    pub unsafe fn SetSDKVersion(
        inner: *mut c_void,
        a0: u32,
        a1: windows::core::PCSTR,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration1_Vtbl)))
                .base__
                .SetSDKVersion)(inner, a0, a1)
        }
    }
    /// `CreateDeviceFactory` on the real object.
    pub unsafe fn CreateDeviceFactory(
        inner: *mut c_void,
        a0: u32,
        a1: windows::core::PCSTR,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration1_Vtbl)))
                .CreateDeviceFactory)(inner, a0, a1, a2, a3)
        }
    }
    /// `FreeUnusedSDKs` on the real object.
    pub unsafe fn FreeUnusedSDKs(inner: *mut c_void) {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration1_Vtbl)))
                .FreeUnusedSDKs)(inner)
        }
    }
}

unsafe extern "system" fn QueryInterface<T: Sdk12Methods>(
    this: *mut c_void,
    iid: *const windows::core::GUID,
    out: *mut *mut c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).QueryInterface(iid, out) }
}
unsafe extern "system" fn AddRef<T: Sdk12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).AddRef() }
}
unsafe extern "system" fn Release<T: Sdk12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).Release() }
}
unsafe extern "system" fn SetSDKVersion<T: Sdk12Methods>(
    this: *mut c_void,
    a0: u32,
    a1: windows::core::PCSTR,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).SetSDKVersion(a0, a1) }
}
unsafe extern "system" fn CreateDeviceFactory<T: Sdk12Methods>(
    this: *mut c_void,
    a0: u32,
    a1: windows::core::PCSTR,
    a2: *const windows::core::GUID,
    a3: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).CreateDeviceFactory(a0, a1, a2, a3) }
}
unsafe extern "system" fn FreeUnusedSDKs<T: Sdk12Methods>(this: *mut c_void) {
    unsafe { (*(this as *const T)).FreeUnusedSDKs() }
}

#[allow(clippy::let_and_return)] // Uniform post-call interception in generated methods.
unsafe impl Sdk12Methods for crate::d3d12::Object {
    fn inner(&self) -> *mut c_void {
        self.real()
    }
    unsafe fn QueryInterface(
        &self,
        iid: *const windows::core::GUID,
        out: *mut *mut c_void,
    ) -> windows::core::HRESULT {
        unsafe { self.query(iid, out) }
    }
    unsafe fn AddRef(&self) -> u32 {
        self.add_ref()
    }
    unsafe fn Release(&self) -> u32 {
        unsafe { self.release() }
    }
    unsafe fn SetSDKVersion(&self, a0: u32, a1: windows::core::PCSTR) -> windows::core::HRESULT {
        unsafe {
            let result = real::SetSDKVersion(self.real(), a0, a1);
            result
        }
    }
    unsafe fn CreateDeviceFactory(
        &self,
        a0: u32,
        a1: windows::core::PCSTR,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::CreateDeviceFactory(self.real(), a0, a1, a2, a3);
            crate::d3d12::wrap_output(result, a2, a3);
            result
        }
    }
    unsafe fn FreeUnusedSDKs(&self) {
        unsafe {
            real::FreeUnusedSDKs(self.real());
        }
    }
}

/// The `ID3D12SDKConfiguration1` vtable whose entries call `T`'s methods.
pub const fn vtable<T: Sdk12Methods>() -> windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration1_Vtbl {
    windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration1_Vtbl {
        base__: windows::Win32::Graphics::Direct3D12::ID3D12SDKConfiguration_Vtbl {
            base__: windows::core::IUnknown_Vtbl {
                QueryInterface: QueryInterface::<T>,
                AddRef: AddRef::<T>,
                Release: Release::<T>,
            },
            SetSDKVersion: SetSDKVersion::<T>,
        },
        CreateDeviceFactory: CreateDeviceFactory::<T>,
        FreeUnusedSDKs: FreeUnusedSDKs::<T>,
    }
}