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 `ID3D12DeviceFactory_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 `ID3D12DeviceFactory` in vtable order. The defaults forward to the wrapped object [`Factory12Methods::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 `ID3D12DeviceFactory`.
pub unsafe trait Factory12Methods: Sized {
    /// The wrapped object, an `ID3D12DeviceFactory`.
    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 InitializeFromGlobalState(&self) -> windows::core::HRESULT {
        unsafe { real::InitializeFromGlobalState(self.inner()) }
    }
    unsafe fn ApplyToGlobalState(&self) -> windows::core::HRESULT {
        unsafe { real::ApplyToGlobalState(self.inner()) }
    }
    unsafe fn SetFlags(
        &self,
        a0: windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS,
    ) -> windows::core::HRESULT {
        unsafe { real::SetFlags(self.inner(), a0) }
    }
    unsafe fn GetFlags(&self) -> windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS {
        unsafe { real::GetFlags(self.inner()) }
    }
    unsafe fn GetConfigurationInterface(
        &self,
        a0: *const windows::core::GUID,
        a1: *const windows::core::GUID,
        a2: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetConfigurationInterface(self.inner(), a0, a1, a2) }
    }
    unsafe fn EnableExperimentalFeatures(
        &self,
        a0: u32,
        a1: *const windows::core::GUID,
        a2: *const core::ffi::c_void,
        a3: *const u32,
    ) -> windows::core::HRESULT {
        unsafe { real::EnableExperimentalFeatures(self.inner(), a0, a1, a2, a3) }
    }
    unsafe fn CreateDevice(
        &self,
        a0: *mut core::ffi::c_void,
        a1: windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::CreateDevice(self.inner(), a0, a1, a2, a3) }
    }
}

/// 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;

    /// `InitializeFromGlobalState` on the real object.
    pub unsafe fn InitializeFromGlobalState(inner: *mut c_void) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .InitializeFromGlobalState)(inner)
        }
    }
    /// `ApplyToGlobalState` on the real object.
    pub unsafe fn ApplyToGlobalState(inner: *mut c_void) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .ApplyToGlobalState)(inner)
        }
    }
    /// `SetFlags` on the real object.
    pub unsafe fn SetFlags(
        inner: *mut c_void,
        a0: windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .SetFlags)(inner, a0)
        }
    }
    /// `GetFlags` on the real object.
    pub unsafe fn GetFlags(
        inner: *mut c_void,
    ) -> windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .GetFlags)(inner)
        }
    }
    /// `GetConfigurationInterface` on the real object.
    pub unsafe fn GetConfigurationInterface(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *const windows::core::GUID,
        a2: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .GetConfigurationInterface)(inner, a0, a1, a2)
        }
    }
    /// `EnableExperimentalFeatures` on the real object.
    pub unsafe fn EnableExperimentalFeatures(
        inner: *mut c_void,
        a0: u32,
        a1: *const windows::core::GUID,
        a2: *const core::ffi::c_void,
        a3: *const u32,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .EnableExperimentalFeatures)(inner, a0, a1, a2, a3)
        }
    }
    /// `CreateDevice` on the real object.
    pub unsafe fn CreateDevice(
        inner: *mut c_void,
        a0: *mut core::ffi::c_void,
        a1: windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl)))
                .CreateDevice)(inner, a0, a1, a2, a3)
        }
    }
}

unsafe extern "system" fn QueryInterface<T: Factory12Methods>(
    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: Factory12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).AddRef() }
}
unsafe extern "system" fn Release<T: Factory12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).Release() }
}
unsafe extern "system" fn InitializeFromGlobalState<T: Factory12Methods>(
    this: *mut c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).InitializeFromGlobalState() }
}
unsafe extern "system" fn ApplyToGlobalState<T: Factory12Methods>(
    this: *mut c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).ApplyToGlobalState() }
}
unsafe extern "system" fn SetFlags<T: Factory12Methods>(
    this: *mut c_void,
    a0: windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).SetFlags(a0) }
}
unsafe extern "system" fn GetFlags<T: Factory12Methods>(
    this: *mut c_void,
) -> windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS {
    unsafe { (*(this as *const T)).GetFlags() }
}
unsafe extern "system" fn GetConfigurationInterface<T: Factory12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *const windows::core::GUID,
    a2: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetConfigurationInterface(a0, a1, a2) }
}
unsafe extern "system" fn EnableExperimentalFeatures<T: Factory12Methods>(
    this: *mut c_void,
    a0: u32,
    a1: *const windows::core::GUID,
    a2: *const core::ffi::c_void,
    a3: *const u32,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).EnableExperimentalFeatures(a0, a1, a2, a3) }
}
unsafe extern "system" fn CreateDevice<T: Factory12Methods>(
    this: *mut c_void,
    a0: *mut core::ffi::c_void,
    a1: windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL,
    a2: *const windows::core::GUID,
    a3: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).CreateDevice(a0, a1, a2, a3) }
}

#[allow(clippy::let_and_return)] // Uniform post-call interception in generated methods.
unsafe impl Factory12Methods 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 InitializeFromGlobalState(&self) -> windows::core::HRESULT {
        unsafe {
            let result = real::InitializeFromGlobalState(self.real());
            result
        }
    }
    unsafe fn ApplyToGlobalState(&self) -> windows::core::HRESULT {
        unsafe {
            let result = real::ApplyToGlobalState(self.real());
            result
        }
    }
    unsafe fn SetFlags(
        &self,
        a0: windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::SetFlags(self.real(), a0);
            result
        }
    }
    unsafe fn GetFlags(&self) -> windows::Win32::Graphics::Direct3D12::D3D12_DEVICE_FACTORY_FLAGS {
        unsafe {
            let result = real::GetFlags(self.real());
            result
        }
    }
    unsafe fn GetConfigurationInterface(
        &self,
        a0: *const windows::core::GUID,
        a1: *const windows::core::GUID,
        a2: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetConfigurationInterface(self.real(), a0, a1, a2);
            crate::d3d12::wrap_output(result, a1, a2);
            result
        }
    }
    unsafe fn EnableExperimentalFeatures(
        &self,
        a0: u32,
        a1: *const windows::core::GUID,
        a2: *const core::ffi::c_void,
        a3: *const u32,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::EnableExperimentalFeatures(self.real(), a0, a1, a2, a3);
            result
        }
    }
    unsafe fn CreateDevice(
        &self,
        a0: *mut core::ffi::c_void,
        a1: windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::CreateDevice(self.real(), crate::d3d12::unwrap(a0), a1, a2, a3);
            crate::d3d12::wrap_output(result, a2, a3);
            result
        }
    }
}

/// The `ID3D12DeviceFactory` vtable whose entries call `T`'s methods.
pub const fn vtable<T: Factory12Methods>() -> windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl {
    windows::Win32::Graphics::Direct3D12::ID3D12DeviceFactory_Vtbl {
        base__: windows::core::IUnknown_Vtbl {
            QueryInterface: QueryInterface::<T>,
            AddRef: AddRef::<T>,
            Release: Release::<T>,
        },
        InitializeFromGlobalState: InitializeFromGlobalState::<T>,
        ApplyToGlobalState: ApplyToGlobalState::<T>,
        SetFlags: SetFlags::<T>,
        GetFlags: GetFlags::<T>,
        GetConfigurationInterface: GetConfigurationInterface::<T>,
        EnableExperimentalFeatures: EnableExperimentalFeatures::<T>,
        CreateDevice: CreateDevice::<T>,
    }
}