diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs index f51b8fbf..c704ae77 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas.Effects; @@ -13,8 +13,33 @@ namespace ABI.Microsoft.Graphics.Canvas.Effects; [Guid("0EF96F8C-9B5E-4BF0-A399-AAD8CE53DB55")] [NativeTypeName("class ICanvasEffect : IInspectable")] [NativeInheritance("IInspectable")] -internal unsafe struct ICanvasEffect +internal unsafe struct ICanvasEffect : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x8C, 0x6F, 0xF9, 0x0E, + 0x5E, 0x9B, + 0xF0, 0x4B, + 0x99, + 0xA3, + 0xAA, + 0xD8, + 0xCE, + 0x53, + 0xDB, + 0x55 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs index 881ee765..e115ded9 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs @@ -6,7 +6,7 @@ using WinRT; using WinRT.Interop; using IInspectable = ComputeSharp.Win32.IInspectable; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -16,8 +16,32 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("29BA1A1F-1CFE-44C3-984D-426D61B51427")] [NativeTypeName("class ICanvasEffectFactoryNative : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe struct ICanvasEffectFactoryNative +internal unsafe struct ICanvasEffectFactoryNative : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x1F, 0x1A, 0xBA, 0x29, + 0xFE, 0x1C, + 0xC3, 0x44, + 0x98, 0x4D, + 0x42, + 0x6D, + 0x61, + 0xB5, + 0x14, + 0x27 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs index 2fe62f4d..1732c066 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs @@ -5,7 +5,7 @@ using ComputeSharp.Win32; using WinRT; using WinRT.Interop; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -15,8 +15,32 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("E042D1F7-F9AD-4479-A713-67627EA31863")] [NativeTypeName("class ICanvasImageInterop : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe struct ICanvasImageInterop +internal unsafe struct ICanvasImageInterop : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xF7, 0xD1, 0x42, 0xE0, + 0xAD, 0xF9, + 0x79, 0x44, + 0xA7, 0x13, + 0x67, + 0x62, + 0x7E, + 0xA3, + 0x18, + 0x63 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs index a379d9ce..2c307da2 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -13,8 +13,33 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("8F6D8AA8-492F-4BC6-B3D0-E7F5EAE84B11")] [NativeTypeName("class ICanvasResourceCreator : IInspectable")] [NativeInheritance("IInspectable")] -internal unsafe struct ICanvasResourceCreator +internal unsafe struct ICanvasResourceCreator : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xA8, 0x8A, 0x6D, 0x8F, + 0x2F, 0x49, + 0xC6, 0x4B, + 0xB3, + 0xD0, + 0xE7, + 0xF5, + 0xEA, + 0xE8, + 0x4B, + 0x11 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs index f46e34c5..77a4f5ae 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -13,8 +13,33 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("1A75B512-E9FA-49E6-A876-38CAE194013E")] [NativeTypeName("class ICanvasResourceCreatorWithDpi : IInspectable")] [NativeInheritance("IInspectable")] -internal unsafe struct ICanvasResourceCreatorWithDpi +internal unsafe struct ICanvasResourceCreatorWithDpi : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x12, 0xB5, 0x75, 0x1A, + 0xFA, 0xE9, + 0xE6, 0x49, + 0xA8, + 0x76, + 0x38, + 0xCA, + 0xE1, + 0x94, + 0x01, + 0x3E + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs index 6bf8a784..25785b29 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -13,8 +13,33 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("5F10688D-EA55-4D55-A3B0-4DDB55C0C20A")] [NativeTypeName("class ICanvasResourceWrapperNative : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe struct ICanvasResourceWrapperNative +internal unsafe struct ICanvasResourceWrapperNative : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x8D, 0x68, 0x10, 0x5F, + 0x55, 0xEA, + 0x55, 0x4D, + 0xA3, + 0xB0, + 0x4D, + 0xDB, + 0x55, + 0xC0, + 0xC2, + 0x0A + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs index 8651549b..954df7ba 100644 --- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs +++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs @@ -3,7 +3,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; -#pragma warning disable CS0649, IDE1006 +#pragma warning disable CS0649, IDE0055, IDE1006 namespace ABI.Microsoft.Graphics.Canvas; @@ -13,8 +13,33 @@ namespace ABI.Microsoft.Graphics.Canvas; [Guid("454A82A1-F024-40DB-BD5B-8F527FD58AD0")] [NativeTypeName("class ID2D1DeviceContextPool : IUnknown")] [NativeInheritance("IUnknown")] -internal unsafe struct ID2D1DeviceContextPool +internal unsafe struct ID2D1DeviceContextPool : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xA1, 0x82, 0x4A, 0x45, + 0x24, 0xF0, + 0xDB, 0x40, + 0xBD, + 0x5B, + 0x8F, + 0x52, + 0x7F, + 0xD5, + 0x8A, + 0xD0 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; /// diff --git a/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs b/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs index ffee0181..70bd6f6c 100644 --- a/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs +++ b/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs @@ -71,7 +71,7 @@ internal static unsafe class IUnknownExtensions /// The for the operation. public static HRESULT CopyTo(this ref T source, U** destination) where T : unmanaged // IUnknown - where U : unmanaged // IUnknown + where U : unmanaged, IComObject { using ComPtr temporary = new((T*)Unsafe.AsPointer(ref source)); diff --git a/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs b/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs index 00ce1b70..e92e16c4 100644 --- a/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs +++ b/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs @@ -48,7 +48,7 @@ internal static unsafe class RcwMarshaller /// This method should only be called with being a projected interface type. public static HRESULT GetNativeInterface(TFrom managedObject, TTo** nativeObject) where TFrom : class - where TTo : unmanaged // IUnknown + where TTo : unmanaged, IComObject { using ComPtr unknownObject = default; diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1CommandList.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1CommandList.cs index b5f7ac8b..a131bfc7 100644 --- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1CommandList.cs +++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1CommandList.cs @@ -4,14 +4,42 @@ // Original source is Copyright © Microsoft. All rights reserved. using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("B4F34A19-2383-4D76-94F6-EC343657C3DC")] [NativeTypeName("struct ID2D1CommandList : ID2D1Image")] [NativeInheritance("ID2D1Image")] -internal unsafe partial struct ID2D1CommandList +internal unsafe partial struct ID2D1CommandList : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x19, 0x4A, 0xF3, 0xB4, + 0x83, 0x23, + 0x76, 0x4D, + 0x94, + 0xF6, + 0xEC, + 0x34, + 0x36, + 0x57, + 0xC3, + 0xDC + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; } \ No newline at end of file diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs index 5a09e646..a439f16a 100644 --- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs +++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("BB12D362-DAEE-4B9A-AA1D-14BA401CFA1F")] [NativeTypeName("struct ID2D1Factory1 : ID2D1Factory")] [NativeInheritance("ID2D1Factory")] -internal unsafe partial struct ID2D1Factory1 +internal unsafe partial struct ID2D1Factory1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0x62, 0xD3, 0x12, 0xBB, + 0xEE, 0xDA, + 0x9A, 0x4B, + 0xAA, + 0x1D, + 0x14, + 0xBA, + 0x40, + 0x1C, + 0xFA, + 0x1F + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs index b5593744..752e7fd7 100644 --- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs +++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs @@ -7,13 +7,40 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +#pragma warning disable IDE0055 + namespace ComputeSharp.Win32; [Guid("D21768E1-23A4-4823-A14B-7C3EBA85D658")] [NativeTypeName("struct ID2D1Device1 : ID2D1Device")] [NativeInheritance("ID2D1Device")] -internal unsafe partial struct ID2D1Device1 +internal unsafe partial struct ID2D1Device1 : IComObject { + /// + static Guid* IComObject.IID + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ReadOnlySpan data = + [ + 0xE1, 0x68, 0x17, 0xD2, + 0xA4, 0x23, + 0x23, 0x48, + 0xA1, + 0x4B, + 0x7C, + 0x3E, + 0xBA, + 0x85, + 0xD6, + 0x58 + ]; + + return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); + } + } + public void** lpVtbl; ///