/// <summary> /// Try to create new instance of <see cref="IDXGIFactory1"/>. /// </summary> /// <param name="factory">The <see cref="IDXGIFactory1"/> being created.</param> /// <returns>Return the <see cref="Result"/>.</returns> public static Result CreateDXGIFactory1 <T>(out T factory) where T : IDXGIFactory1 { var result = DXGIInternal.CreateDXGIFactory1(typeof(T).GUID, out var nativePtr); if (result.Success) { factory = CppObject.FromPointer <T>(nativePtr); return(result); } factory = null; return(result); }
/// <summary> /// Try to create new instance of <see cref="IDXGIFactory2"/>. /// </summary> /// <param name="debug">Whether to enable debug callback.</param> /// <param name="factory">The <see cref="IDXGIFactory2"/> being created.</param> /// <returns>Return the <see cref="Result"/>.</returns> public static Result CreateDXGIFactory2 <T>(bool debug, out T factory) where T : IDXGIFactory2 { int flags = debug ? DXGIInternal.CreateFactoryDebug : 0x00; var result = DXGIInternal.CreateDXGIFactory2(flags, typeof(T).GUID, out var nativePtr); if (result.Success) { factory = CppObject.FromPointer <T>(nativePtr); return(result); } factory = null; return(result); }
/// <summary> /// Gets debug interface for given type. /// </summary> /// <typeparam name="T">The <see cref="ComObject"/> to get.</typeparam> /// <param name="debugInterface">Instance of T.</param> /// <returns>The result code.</returns> public static Result DXGIGetDebugInterface <T>(out T debugInterface) where T : ComObject { try { var result = DXGIInternal.DXGIGetDebugInterface(typeof(T).GUID, out var nativePtr); if (result.Failure) { debugInterface = null; return(result); } debugInterface = CppObject.FromPointer <T>(nativePtr); return(result); } catch { debugInterface = default; return(ResultCode.NotFound); } }
/// <summary> /// Allows a process to indicate that it's resilient to any of its graphics devices being removed. /// </summary> /// <remarks>Maps to DXGIDeclareAdapterRemovalSupport native call.</remarks> /// <returns></returns> public static Result DXGIDeclareAdapterRemovalSupport() { return(DXGIInternal.DXGIDeclareAdapterRemovalSupport()); }