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 `ID3D12SwapChainAssistant_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 `ID3D12SwapChainAssistant` in vtable order. The defaults forward to the wrapped object [`Assistant12Methods::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 `ID3D12SwapChainAssistant`.
pub unsafe trait Assistant12Methods: Sized {
    /// The wrapped object, an `ID3D12SwapChainAssistant`.
    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 GetLUID(&self, a0: *mut windows::Win32::Foundation::LUID) {
        unsafe { real::GetLUID(self.inner(), a0) }
    }
    unsafe fn GetSwapChainObject(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetSwapChainObject(self.inner(), a0, a1) }
    }
    unsafe fn GetCurrentResourceAndCommandQueue(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetCurrentResourceAndCommandQueue(self.inner(), a0, a1, a2, a3) }
    }
    unsafe fn InsertImplicitSync(&self) -> windows::core::HRESULT {
        unsafe { real::InsertImplicitSync(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;

    /// `GetLUID` on the real object.
    pub unsafe fn GetLUID(inner: *mut c_void, a0: *mut windows::Win32::Foundation::LUID) {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl)))
                .GetLUID)(inner, a0)
        }
    }
    /// `GetSwapChainObject` on the real object.
    pub unsafe fn GetSwapChainObject(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl)))
                .GetSwapChainObject)(inner, a0, a1)
        }
    }
    /// `GetCurrentResourceAndCommandQueue` on the real object.
    pub unsafe fn GetCurrentResourceAndCommandQueue(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl)))
                .GetCurrentResourceAndCommandQueue)(inner, a0, a1, a2, a3)
        }
    }
    /// `InsertImplicitSync` on the real object.
    pub unsafe fn InsertImplicitSync(inner: *mut c_void) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner
                as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl)))
                .InsertImplicitSync)(inner)
        }
    }
}

unsafe extern "system" fn QueryInterface<T: Assistant12Methods>(
    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: Assistant12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).AddRef() }
}
unsafe extern "system" fn Release<T: Assistant12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).Release() }
}
unsafe extern "system" fn GetLUID<T: Assistant12Methods>(
    this: *mut c_void,
    a0: *mut windows::Win32::Foundation::LUID,
) {
    unsafe { (*(this as *const T)).GetLUID(a0) }
}
unsafe extern "system" fn GetSwapChainObject<T: Assistant12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetSwapChainObject(a0, a1) }
}
unsafe extern "system" fn GetCurrentResourceAndCommandQueue<T: Assistant12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut *mut core::ffi::c_void,
    a2: *const windows::core::GUID,
    a3: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetCurrentResourceAndCommandQueue(a0, a1, a2, a3) }
}
unsafe extern "system" fn InsertImplicitSync<T: Assistant12Methods>(
    this: *mut c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).InsertImplicitSync() }
}

#[allow(clippy::let_and_return)] // Uniform post-call interception in generated methods.
unsafe impl Assistant12Methods 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 GetLUID(&self, a0: *mut windows::Win32::Foundation::LUID) {
        unsafe {
            real::GetLUID(self.real(), a0);
        }
    }
    unsafe fn GetSwapChainObject(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetSwapChainObject(self.real(), a0, a1);
            crate::d3d12::wrap_output(result, a0, a1);
            result
        }
    }
    unsafe fn GetCurrentResourceAndCommandQueue(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
        a2: *const windows::core::GUID,
        a3: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetCurrentResourceAndCommandQueue(self.real(), a0, a1, a2, a3);
            crate::d3d12::wrap_output(result, a0, a1);
            crate::d3d12::wrap_output(result, a2, a3);
            result
        }
    }
    unsafe fn InsertImplicitSync(&self) -> windows::core::HRESULT {
        unsafe {
            let result = real::InsertImplicitSync(self.real());
            result
        }
    }
}

/// The `ID3D12SwapChainAssistant` vtable whose entries call `T`'s methods.
pub const fn vtable<T: Assistant12Methods>()
-> windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl {
    windows::Win32::Graphics::Direct3D12::ID3D12SwapChainAssistant_Vtbl {
        base__: windows::core::IUnknown_Vtbl {
            QueryInterface: QueryInterface::<T>,
            AddRef: AddRef::<T>,
            Release: Release::<T>,
        },
        GetLUID: GetLUID::<T>,
        GetSwapChainObject: GetSwapChainObject::<T>,
        GetCurrentResourceAndCommandQueue: GetCurrentResourceAndCommandQueue::<T>,
        InsertImplicitSync: InsertImplicitSync::<T>,
    }
}