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 `ID3D12SharingContract_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 `ID3D12SharingContract` in vtable order. The defaults forward to the wrapped object [`Sharing12Methods::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 `ID3D12SharingContract`.
pub unsafe trait Sharing12Methods: Sized {
    /// The wrapped object, an `ID3D12SharingContract`.
    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 Present(&self, a0: *mut core::ffi::c_void, a1: u32, a2: windows::Win32::Foundation::HWND) {
        unsafe { real::Present(self.inner(), a0, a1, a2) }
    }
    unsafe fn SharedFenceSignal(&self, a0: *mut core::ffi::c_void, a1: u64) {
        unsafe { real::SharedFenceSignal(self.inner(), a0, a1) }
    }
    unsafe fn BeginCapturableWork(&self, a0: *const windows::core::GUID) {
        unsafe { real::BeginCapturableWork(self.inner(), a0) }
    }
    unsafe fn EndCapturableWork(&self, a0: *const windows::core::GUID) {
        unsafe { real::EndCapturableWork(self.inner(), a0) }
    }
}

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

    /// `Present` on the real object.
    pub unsafe fn Present(
        inner: *mut c_void,
        a0: *mut core::ffi::c_void,
        a1: u32,
        a2: windows::Win32::Foundation::HWND,
    ) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl)))
                .Present)(inner, a0, a1, a2)
        }
    }
    /// `SharedFenceSignal` on the real object.
    pub unsafe fn SharedFenceSignal(inner: *mut c_void, a0: *mut core::ffi::c_void, a1: u64) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl)))
                .SharedFenceSignal)(inner, a0, a1)
        }
    }
    /// `BeginCapturableWork` on the real object.
    pub unsafe fn BeginCapturableWork(inner: *mut c_void, a0: *const windows::core::GUID) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl)))
                .BeginCapturableWork)(inner, a0)
        }
    }
    /// `EndCapturableWork` on the real object.
    pub unsafe fn EndCapturableWork(inner: *mut c_void, a0: *const windows::core::GUID) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl)))
                .EndCapturableWork)(inner, a0)
        }
    }
}

unsafe extern "system" fn QueryInterface<T: Sharing12Methods>(
    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: Sharing12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).AddRef() }
}
unsafe extern "system" fn Release<T: Sharing12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).Release() }
}
unsafe extern "system" fn Present<T: Sharing12Methods>(
    this: *mut c_void,
    a0: *mut core::ffi::c_void,
    a1: u32,
    a2: windows::Win32::Foundation::HWND,
) {
    unsafe { (*(this as *const T)).Present(a0, a1, a2) }
}
unsafe extern "system" fn SharedFenceSignal<T: Sharing12Methods>(
    this: *mut c_void,
    a0: *mut core::ffi::c_void,
    a1: u64,
) {
    unsafe { (*(this as *const T)).SharedFenceSignal(a0, a1) }
}
unsafe extern "system" fn BeginCapturableWork<T: Sharing12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
) {
    unsafe { (*(this as *const T)).BeginCapturableWork(a0) }
}
unsafe extern "system" fn EndCapturableWork<T: Sharing12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
) {
    unsafe { (*(this as *const T)).EndCapturableWork(a0) }
}

#[allow(clippy::let_and_return)] // Uniform post-call interception in generated methods.
unsafe impl Sharing12Methods 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 Present(&self, a0: *mut core::ffi::c_void, a1: u32, a2: windows::Win32::Foundation::HWND) {
        unsafe {
            real::Present(self.real(), crate::d3d12::unwrap(a0), a1, a2);
        }
    }
    unsafe fn SharedFenceSignal(&self, a0: *mut core::ffi::c_void, a1: u64) {
        unsafe {
            real::SharedFenceSignal(self.real(), crate::d3d12::unwrap(a0), a1);
        }
    }
    unsafe fn BeginCapturableWork(&self, a0: *const windows::core::GUID) {
        unsafe {
            real::BeginCapturableWork(self.real(), a0);
        }
    }
    unsafe fn EndCapturableWork(&self, a0: *const windows::core::GUID) {
        unsafe {
            real::EndCapturableWork(self.real(), a0);
        }
    }
}

/// The `ID3D12SharingContract` vtable whose entries call `T`'s methods.
pub const fn vtable<T: Sharing12Methods>() -> windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl
{
    windows::Win32::Graphics::Direct3D12::ID3D12SharingContract_Vtbl {
        base__: windows::core::IUnknown_Vtbl {
            QueryInterface: QueryInterface::<T>,
            AddRef: AddRef::<T>,
            Release: Release::<T>,
        },
        Present: Present::<T>,
        SharedFenceSignal: SharedFenceSignal::<T>,
        BeginCapturableWork: BeginCapturableWork::<T>,
        EndCapturableWork: EndCapturableWork::<T>,
    }
}