diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 7ec74a5ba..026d17bb0 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -231,13 +231,12 @@ jobs:
path: samples\ComputeSharp.SwapChain.Cli\bin\Release\net8.0\win-x64\publish\computesharp.cli.exe
if-no-files-found: error
- # Publish the NativeAOT CLI sample (optimized for size, and reflection-free).
- # Temporarily skip COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION unti code is
- # refactored to replace typeof(T).GUID with hardcoded IIDs, or it won't work.
+ # Publish the NativeAOT CLI sample (optimized for size, and reflection-free)
- name: Publish ComputeSharp.SwapChain.Cli with NativeAOT (size)
run: >
$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
$env:COMPUTESHARP_SWAPCHAIN_CLI_SIZE_OPTIMIZED='true';
+ $env:COMPUTESHARP_SWAPCHAIN_CLI_DISABLE_REFLECTION='true';
git clean -fdx;
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -r win-${{matrix.platform}} -v n
diff --git a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
index c5bd740fa..c6ea0c582 100644
--- a/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
+++ b/samples/ComputeSharp.SwapChain.D2D1.Cli/Backend/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
@@ -6,14 +6,13 @@
using WinRT;
using WinRT.Interop;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// Raw bindings for the interop interface for the activation factory.
///
-[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
internal unsafe struct ICanvasFactoryNative : IUnknown.Interface
{
public void** lpVtbl;
@@ -23,7 +22,8 @@ static Guid* INativeGuid.NativeGuid
{
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x0D, 0x44, 0x5C, 0x69,
0xB3, 0x04,
0xDD, 0x4E,
@@ -34,7 +34,7 @@ static Guid* INativeGuid.NativeGuid
0x9F,
0x72,
0x02
- };
+ ];
return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
diff --git a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs
index 7f32bdd20..412f3ad56 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs
@@ -1,6 +1,5 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using ComputeSharp.Win32;
#pragma warning disable CS0649, IDE1006
@@ -10,7 +9,6 @@ namespace ABI.Microsoft.Graphics.Canvas;
///
/// The native WinRT interface for objects.
///
-[Guid("A27F0B5D-EC2C-4D4F-948F-0AA1E95E33E6")]
[NativeTypeName("class ICanvasDevice : IInspectable")]
[NativeInheritance("IInspectable")]
internal unsafe struct ICanvasDevice
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 f51b8fbf1..a8426f46d 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffect.cs
@@ -3,18 +3,42 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas.Effects;
///
/// The native WinRT interface for objects.
///
-[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 881ee7650..9a2279d75 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs
@@ -6,18 +6,41 @@
using WinRT.Interop;
using IInspectable = ComputeSharp.Win32.IInspectable;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// The interop Win2D interface for factories of external effects.
///
-[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/ICanvasFactoryNative.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
index 4a17c0ec0..d1e832603 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasFactoryNative.cs
@@ -13,7 +13,6 @@ namespace ABI.Microsoft.Graphics.Canvas;
///
/// The activation factory for .
///
-[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
[NativeTypeName("class ICanvasFactoryNative : public IInspectable")]
[NativeInheritance("IInspectable")]
internal unsafe struct ICanvasFactoryNative
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 2fe62f4d7..a6e439e22 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasImageInterop.cs
@@ -5,18 +5,41 @@
using WinRT;
using WinRT.Interop;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// An interop Win2D interface for all images and effects that can be drawn.
///
-[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 a379d9ce1..1cdc2f597 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreator.cs
@@ -3,18 +3,42 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// The native WinRT interface for objects.
///
-[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 f46e34c52..ea1c7688d 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceCreatorWithDpi.cs
@@ -3,18 +3,42 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// The native WinRT interface for objects.
///
-[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 6bf8a784a..2dd03c47b 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasResourceWrapperNative.cs
@@ -3,18 +3,42 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// An interop wrapper type for Win2D objects (see ).
///
-[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/ID2D1DeviceContextLease.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextLease.cs
index a1e20505f..b1ee1a22b 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextLease.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextLease.cs
@@ -1,6 +1,5 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using ComputeSharp.Win32;
#pragma warning disable CS0649, IDE1006
@@ -10,7 +9,6 @@ namespace ABI.Microsoft.Graphics.Canvas;
///
/// An interface for a COM object that provides access to a pooled object.
///
-[Guid("A0928F38-F7D5-44DD-A5C9-E23D94734BBB")]
[NativeTypeName("class ID2D1DeviceContextLease : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe struct ID2D1DeviceContextLease
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 8651549ba..557137390 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs
@@ -3,18 +3,42 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649, IDE1006
+#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
///
/// An interface for an object that provides access to pooled objects.
///
-[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/ABI.Microsoft.Graphics.Canvas/Inspectable/IInspectable.cs b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/Inspectable/IInspectable.cs
index 05dc11466..58cd000e1 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/Inspectable/IInspectable.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/Inspectable/IInspectable.cs
@@ -5,7 +5,6 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
#pragma warning disable CS0649, IDE1006
@@ -14,7 +13,6 @@ namespace ComputeSharp.Win32;
///
/// The native WinRT interface for IInspectable objects.
///
-[Guid("AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90")]
[NativeTypeName("struct IInspectable : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe struct IInspectable
diff --git a/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs b/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs
index ffee01813..70bd6f6c4 100644
--- a/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs
+++ b/src/ComputeSharp.D2D1.WinUI/Extensions/IUnknownExtensions.cs
@@ -71,7 +71,7 @@ public static HRESULT CopyTo(this ref T source, ref ComPtr destination)
/// 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 00ce1b707..e92e16c4d 100644
--- a/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs
+++ b/src/ComputeSharp.D2D1.WinUI/Helpers/RcwMarshaller.cs
@@ -48,7 +48,7 @@ public static T GetOrCreateManagedInterface(IUnknown* nativeObject)
/// 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.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs
index 3700fd5a6..583b41757 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs
@@ -167,7 +167,7 @@ public int QueryInterface(Guid* riid, void** ppvObject)
// ID2D1ResourceTextureManager
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID2D1ResourceTextureManager.Guid))
+ riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref this.referenceCount);
@@ -177,7 +177,7 @@ public int QueryInterface(Guid* riid, void** ppvObject)
}
// ID2D1ResourceTextureManagerInternal
- if (riid->Equals(ID2D1ResourceTextureManagerInternal.Guid))
+ if (riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref this.referenceCount);
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs
index e72b788f0..799ab648f 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManager.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers;
///
/// The resource texture manager type to use with built-in effects.
///
-[Guid("3C4FC7E4-A419-46CA-B5F6-66EB4FF18D64")]
-internal unsafe struct ID2D1ResourceTextureManager
+internal unsafe struct ID2D1ResourceTextureManager : IComObject
{
- ///
- /// Gets the for (3C4FC7E4-A419-46CA-B5F6-66EB4FF18D64).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xE4, 0xC7, 0x4F, 0x3C,
0x19, 0xA4,
0xCA, 0x46,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0xF1,
0x8D,
0x64
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs
index b9929c7e4..60dec2ac0 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ID2D1ResourceTextureManagerInternal.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers;
///
/// The internal resource texture manager type to use with built-in effects.
///
-[Guid("5CBB1024-8EA1-4689-81BF-8AD190B5EF5D")]
-internal unsafe struct ID2D1ResourceTextureManagerInternal
+internal unsafe struct ID2D1ResourceTextureManagerInternal : IComObject
{
- ///
- /// Gets the for (5CBB1024-8EA1-4689-81BF-8AD190B5EF5D).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0x10, 0xBB, 0x5C,
0xA1, 0x8E,
0x89, 0x46,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0xB5,
0xEF,
0x5D
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs
index 7d4c4f3f0..8560794f6 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs
@@ -132,7 +132,7 @@ public int QueryInterface(Guid* riid, void** ppvObject)
// ID2D1DrawInfoUpdateContext
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID2D1DrawInfoUpdateContext.Guid))
+ riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref this.referenceCount);
@@ -142,7 +142,7 @@ public int QueryInterface(Guid* riid, void** ppvObject)
}
// ID2D1DrawInfoUpdateContextInternal
- if (riid->Equals(ID2D1DrawInfoUpdateContextInternal.Guid))
+ if (riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref this.referenceCount);
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs
index d6177ae8e..217974da5 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs
@@ -139,7 +139,7 @@ public int QueryInterfaceWithNoLock(Guid* riid, void** ppvObject)
// ID2D1TransformMapper
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID2D1TransformMapper.Guid))
+ riid->Equals(Windows.__uuidof()))
{
this.referenceCount++;
@@ -149,7 +149,7 @@ public int QueryInterfaceWithNoLock(Guid* riid, void** ppvObject)
}
// ID2D1TransformMapperInternal
- if (riid->Equals(ID2D1TransformMapperInternal.Guid))
+ if (riid->Equals(Windows.__uuidof()))
{
this.referenceCount++;
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContext.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContext.cs
index b5c2e7f02..efe8517a1 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContext.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContext.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
///
/// The updater for type to use with built-in effects.
///
-[Guid("430C5B40-AE16-485F-90E6-4FA4915144B6")]
-internal unsafe struct ID2D1DrawInfoUpdateContext
+internal unsafe struct ID2D1DrawInfoUpdateContext : IComObject
{
- ///
- /// Gets the for (430C5B40-AE16-485F-90E6-4FA4915144B6).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x40, 0x5B, 0x0C, 0x43,
0x16, 0xAE,
0x5F, 0x48,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0x51,
0x44,
0xB6
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContextInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContextInternal.cs
index 7a359d845..b5910f7e3 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContextInternal.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1DrawInfoUpdateContextInternal.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
///
/// An internal version of that supports being closed, to manage lifetime scopes.
///
-[Guid("CF2F5BB0-3F5E-4D6E-8FF1-D9A7EB6C0250")]
-internal unsafe struct ID2D1DrawInfoUpdateContextInternal
+internal unsafe struct ID2D1DrawInfoUpdateContextInternal : IComObject
{
- ///
- /// Gets the for (CF2F5BB0-3F5E-4D6E-8FF1-D9A7EB6C0250).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xB0, 0x5B, 0x2F, 0xCF,
0x5E, 0x3F,
0x6E, 0x4D,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0x6C,
0x02,
0x50
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapper.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapper.cs
index 027e22ba5..5d6cda8eb 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapper.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapper.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
///
/// The transform mapper manager type to use with built-in effects.
///
-[Guid("02E6D48D-B892-4FBC-AA54-119203BAB802")]
-internal unsafe struct ID2D1TransformMapper
+internal unsafe struct ID2D1TransformMapper : IComObject
{
- ///
- /// Gets the for (02E6D48D-B892-4FBC-AA54-119203BAB802).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x8D, 0xD4, 0xE6, 0x02,
0x92, 0xB8,
0xBC, 0x4F,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0xBA,
0xB8,
0x02
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapperInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapperInternal.cs
index f6cf1cc09..23e85681f 100644
--- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapperInternal.cs
+++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/ID2D1TransformMapperInternal.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
///
/// The internal transform mapper manager interface.
///
-[Guid("C5D8FC65-FB86-4C2D-9EF5-95AEC639C952")]
-internal unsafe struct ID2D1TransformMapperInternal
+internal unsafe struct ID2D1TransformMapperInternal : IComObject
{
- ///
- /// Gets the for (C5D8FC65-FB86-4C2D-9EF5-95AEC639C952).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x65, 0xFC, 0xD8, 0xC5,
0x86, 0xFB,
0x2D, 0x4C,
@@ -31,9 +30,9 @@ public static ref readonly Guid Guid
0x39,
0xC9,
0x52
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs
index 685dba115..653e3881c 100644
--- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs
+++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12AllocationImpl.cs
@@ -108,7 +108,7 @@ private static int QueryInterface(ID3D12AllocationImpl* @this, Guid* riid, void*
}
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID3D12Allocation.Guid))
+ riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref @this->referenceCount);
diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs
index 39c35a285..df852d450 100644
--- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs
+++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorFactoryImpl.cs
@@ -86,7 +86,7 @@ public int QueryInterface(Guid* riid, void** ppvObject)
}
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID3D12MemoryAllocatorFactory.Guid))
+ riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref this.referenceCount);
diff --git a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs
index b8a379f2f..906636301 100644
--- a/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs
+++ b/src/ComputeSharp.D3D12MemoryAllocator/Interop/ID3D12MemoryAllocatorImpl.cs
@@ -132,7 +132,7 @@ private static int QueryInterface(ID3D12MemoryAllocatorImpl* @this, Guid* riid,
}
if (riid->Equals(Windows.__uuidof()) ||
- riid->Equals(ID3D12MemoryAllocator.Guid))
+ riid->Equals(Windows.__uuidof()))
{
_ = Interlocked.Increment(ref @this->referenceCount);
diff --git a/src/ComputeSharp.Win32.D2D1/.editorconfig b/src/ComputeSharp.Win32.D2D1/.editorconfig
index e66e478f4..e87be3e4d 100644
--- a/src/ComputeSharp.Win32.D2D1/.editorconfig
+++ b/src/ComputeSharp.Win32.D2D1/.editorconfig
@@ -34,6 +34,7 @@ dotnet_diagnostic.IDE0032.severity = none
dotnet_diagnostic.IDE0045.severity = none
dotnet_diagnostic.IDE0046.severity = none
dotnet_diagnostic.IDE0047.severity = none
+dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0060.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0160.severity = none
diff --git a/src/ComputeSharp.Win32.D2D1/ComputeSharp.Win32.D2D1.projitems b/src/ComputeSharp.Win32.D2D1/ComputeSharp.Win32.D2D1.projitems
index 0a1d313a8..11abcfc63 100644
--- a/src/ComputeSharp.Win32.D2D1/ComputeSharp.Win32.D2D1.projitems
+++ b/src/ComputeSharp.Win32.D2D1/ComputeSharp.Win32.D2D1.projitems
@@ -57,6 +57,7 @@
+
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Factory.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Factory.cs
index 22811f17d..e974ed927 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Factory.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Factory.cs
@@ -3,12 +3,8 @@
// Ported from um/d2d1.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
-using System;
-using System.Runtime.InteropServices;
-
namespace ComputeSharp.Win32;
-[Guid("06152247-6F50-465A-9245-118BFD3B6007")]
[NativeTypeName("struct ID2D1Factory : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID2D1Factory
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Image.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Image.cs
index 4dde8f278..403ef737a 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Image.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1/ID2D1Image.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("65019F75-8DA2-497C-B32C-DFA34E48EDE6")]
[NativeTypeName("struct ID2D1Image : ID2D1Resource")]
[NativeInheritance("ID2D1Resource")]
-internal unsafe partial struct ID2D1Image
+internal unsafe partial struct ID2D1Image : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x75, 0x9F, 0x01, 0x65,
+ 0xA2, 0x8D,
+ 0x7C, 0x49,
+ 0xB3,
+ 0x2C,
+ 0xDF,
+ 0xA3,
+ 0x4E,
+ 0x48,
+ 0xED,
+ 0xE6
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
///
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 b5f7ac8b5..77932eeff 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,39 @@
// Original source is Copyright © Microsoft. All rights reserved.
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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/ID2D1DeviceContext.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs
index 0d1c2252e..27f0f2369 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1DeviceContext.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("E8F7FE7A-191C-466D-AD95-975678BDA998")]
[NativeTypeName("struct ID2D1DeviceContext : ID2D1RenderTarget")]
[NativeInheritance("ID2D1RenderTarget")]
internal unsafe partial struct ID2D1DeviceContext
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs
index 38959e2f5..5f589ebe3 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Effect.cs
@@ -3,13 +3,10 @@
// Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
-using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("28211A43-7D89-476F-8181-2D6159B220AD")]
[NativeTypeName("struct ID2D1Effect : ID2D1Properties")]
[NativeInheritance("ID2D1Properties")]
internal unsafe partial struct ID2D1Effect
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 5a09e6462..8cb737339 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs
@@ -9,11 +9,35 @@
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_1/ID2D1Multithread.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs
index 604ef0421..1823978fe 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Multithread.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("31E6E7BC-E0FF-4D46-8C64-A0A8C41C15D3")]
[NativeTypeName("struct ID2D1Multithread : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID2D1Multithread
+internal unsafe partial struct ID2D1Multithread : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xBC, 0xE7, 0xE6, 0x31,
+ 0xFF, 0xE0,
+ 0x46, 0x4D,
+ 0x8C,
+ 0x64,
+ 0xA0,
+ 0xA8,
+ 0xC4,
+ 0x1C,
+ 0x15,
+ 0xD3
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
///
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 b55937449..44084a36a 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_2/ID2D1Device1.cs
@@ -9,11 +9,35 @@
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;
///
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
index c2d478ab0..fe0096e3a 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
@@ -5,12 +5,10 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using static ComputeSharp.Win32.D2D1_PIXEL_OPTIONS;
namespace ComputeSharp.Win32;
-[Guid("693CE632-7F2F-45DE-93FE-18D88B37AA21")]
[NativeTypeName("struct ID2D1DrawInfo : ID2D1RenderInfo")]
[NativeInheritance("ID2D1RenderInfo")]
internal unsafe partial struct ID2D1DrawInfo
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs
index e1ce0a55f..049f86428 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("36BFDCB6-9739-435D-A30D-A653BEFF6A6F")]
[NativeTypeName("struct ID2D1DrawTransform : ID2D1Transform")]
[NativeInheritance("ID2D1Transform")]
-internal unsafe partial struct ID2D1DrawTransform
+internal unsafe partial struct ID2D1DrawTransform : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xB6, 0xDC, 0xBF, 0x36,
+ 0x39, 0x97,
+ 0x5D, 0x43,
+ 0xA3,
+ 0x0D,
+ 0xA6,
+ 0x53,
+ 0xBE,
+ 0xFF,
+ 0x6A,
+ 0x6F
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs
index 86420bf61..6c68b9ea9 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("3D9F916B-27DC-4AD7-B4F1-64945340F563")]
[NativeTypeName("struct ID2D1EffectContext : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID2D1EffectContext
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs
index e88ec7a69..ce390ac7b 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("A248FD3F-3E6C-4E63-9F03-7F68ECC91DB9")]
[NativeTypeName("struct ID2D1EffectImpl : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID2D1EffectImpl
+internal unsafe partial struct ID2D1EffectImpl : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x3F, 0xFD, 0x48, 0xA2,
+ 0x6C, 0x3E,
+ 0x63, 0x4E,
+ 0x9F,
+ 0x03,
+ 0x7F,
+ 0x68,
+ 0xEC,
+ 0xC9,
+ 0x1D,
+ 0xB9
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs
index 863abed5a..6c1f49268 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1ResourceTexture.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("688D15C3-02B0-438D-B13A-D1B44C32C39A")]
[NativeTypeName("struct ID2D1ResourceTexture : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID2D1ResourceTexture
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs
index 954fe1f95..991fb7b1a 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1Transform.cs
@@ -4,14 +4,39 @@
// Original source is Copyright © Microsoft. All rights reserved.
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("EF1A287D-342A-4F76-8FDB-DA0D6EA9F92B")]
[NativeTypeName("struct ID2D1Transform : ID2D1TransformNode")]
[NativeInheritance("ID2D1TransformNode")]
-internal unsafe partial struct ID2D1Transform
+internal unsafe partial struct ID2D1Transform : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x7D, 0x28, 0x1A, 0xEF,
+ 0x2A, 0x34,
+ 0x76, 0x4F,
+ 0x8F,
+ 0xDB,
+ 0xDA,
+ 0x0D,
+ 0x6E,
+ 0xA9,
+ 0xF9,
+ 0x2B
+ ];
+
+ 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/d2d1effectauthor/ID2D1TransformGraph.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs
index 6d37f945c..0e8b98953 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs
@@ -3,13 +3,10 @@
// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
-using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("13D29038-C3E6-4034-9081-13B53A417992")]
[NativeTypeName("struct ID2D1TransformGraph : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID2D1TransformGraph
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs
index c9588777a..fc7ce8870 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs
@@ -4,14 +4,39 @@
// Original source is Copyright © Microsoft. All rights reserved.
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("B2EFE1E7-729F-4102-949F-505FA21BF666")]
[NativeTypeName("struct ID2D1TransformNode : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID2D1TransformNode
+internal unsafe partial struct ID2D1TransformNode : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xE7, 0xE1, 0xEF, 0xB2,
+ 0x9F, 0x72,
+ 0x02, 0x41,
+ 0x94,
+ 0x9F,
+ 0x50,
+ 0x5F,
+ 0xA2,
+ 0x1B,
+ 0xF6,
+ 0x66
+ ];
+
+ 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/d2d1effects/CLSID.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effects/CLSID.cs
index 233ee71e0..dad2dca8e 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effects/CLSID.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effects/CLSID.cs
@@ -17,7 +17,8 @@ public static ref readonly Guid CLSID_D2D1Flood
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x20, 0x3C, 0xC2, 0x61,
0x69, 0xAE,
0x8E, 0x4D,
@@ -29,7 +30,7 @@ public static ref readonly Guid CLSID_D2D1Flood
0xF6,
0x38,
0xF2
- };
+ ];
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
}
@@ -41,7 +42,8 @@ public static ref readonly Guid CLSID_D2D1DpiCompensation
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xC7, 0xC5, 0x26, 0x6C,
0xE0, 0x34,
0xFC, 0x46,
@@ -53,7 +55,7 @@ public static ref readonly Guid CLSID_D2D1DpiCompensation
0x06,
0xE2,
0x28
- };
+ ];
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
}
diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
index 01f24542a..4e574e371 100644
--- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
+++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d3d11shader/ID3D11ShaderReflection.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("8D536CA1-0CCA-4956-A837-786963755584")]
[NativeTypeName("struct ID3D11ShaderReflection : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID3D11ShaderReflection
+internal unsafe partial struct ID3D11ShaderReflection : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xA1, 0x6C, 0x53, 0x8D,
+ 0xCA, 0x0C,
+ 0x56, 0x49,
+ 0xA8,
+ 0x37,
+ 0x78,
+ 0x69,
+ 0x63,
+ 0x75,
+ 0x55,
+ 0x84
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
///
diff --git a/src/ComputeSharp.Win32.D3D12/.editorconfig b/src/ComputeSharp.Win32.D3D12/.editorconfig
index e66e478f4..e87be3e4d 100644
--- a/src/ComputeSharp.Win32.D3D12/.editorconfig
+++ b/src/ComputeSharp.Win32.D3D12/.editorconfig
@@ -34,6 +34,7 @@ dotnet_diagnostic.IDE0032.severity = none
dotnet_diagnostic.IDE0045.severity = none
dotnet_diagnostic.IDE0046.severity = none
dotnet_diagnostic.IDE0047.severity = none
+dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0060.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0160.severity = none
diff --git a/src/ComputeSharp.Win32.D3D12/ComPtr`1.cs b/src/ComputeSharp.Win32.D3D12/ComPtr`1.cs
index 319b21e00..d169d4558 100644
--- a/src/ComputeSharp.Win32.D3D12/ComPtr`1.cs
+++ b/src/ComputeSharp.Win32.D3D12/ComPtr`1.cs
@@ -87,7 +87,7 @@ public readonly HRESULT CopyTo(ref ComPtr other)
/// The target raw pointer to copy the address of the current COM object to.
/// The result of for the target type .
public readonly HRESULT CopyTo(U** ptr)
- where U : unmanaged
+ where U : unmanaged, IComObject
{
return ((IUnknown*)ptr_)->QueryInterface(__uuidof(), (void**)ptr);
}
@@ -96,7 +96,7 @@ public readonly HRESULT CopyTo(U** ptr)
/// The target raw pointer to copy the address of the current COM object to.
/// The result of for the target type .
public readonly HRESULT CopyTo(ComPtr* p)
- where U : unmanaged
+ where U : unmanaged, IComObject
{
return ((IUnknown*)ptr_)->QueryInterface(__uuidof(), (void**)p->ReleaseAndGetAddressOf());
}
@@ -105,7 +105,7 @@ public readonly HRESULT CopyTo(ComPtr* p)
/// The target reference to copy the address of the current COM object to.
/// The result of for the target type .
public readonly HRESULT CopyTo(ref ComPtr other)
- where U : unmanaged
+ where U : unmanaged, IComObject
{
U* ptr;
HRESULT result = ((IUnknown*)ptr_)->QueryInterface(__uuidof(), (void**)&ptr);
diff --git a/src/ComputeSharp.Win32.D3D12/ComputeSharp.Win32.D3D12.projitems b/src/ComputeSharp.Win32.D3D12/ComputeSharp.Win32.D3D12.projitems
index 193d17bc1..bd551902f 100644
--- a/src/ComputeSharp.Win32.D3D12/ComputeSharp.Win32.D3D12.projitems
+++ b/src/ComputeSharp.Win32.D3D12/ComputeSharp.Win32.D3D12.projitems
@@ -215,6 +215,7 @@
+
@@ -237,7 +238,6 @@
-
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs
index e4017ac6e..8c1e9bc43 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("2411E7E1-12AC-4CCF-BD14-9798E8534DC0")]
[NativeTypeName("struct IDXGIAdapter : IDXGIObject")]
[NativeInheritance("IDXGIObject")]
-internal unsafe partial struct IDXGIAdapter
+internal unsafe partial struct IDXGIAdapter : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xE1, 0xE7, 0x11, 0x24,
+ 0xAC, 0x12,
+ 0xCF, 0x4C,
+ 0xBD,
+ 0x14,
+ 0x97,
+ 0x98,
+ 0xE8,
+ 0x53,
+ 0x4D,
+ 0xC0
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs
index 2c1fcc3cb..d9760d2ce 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIAdapter1.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("29038F61-3839-4626-91FD-086879011A05")]
[NativeTypeName("struct IDXGIAdapter1 : IDXGIAdapter")]
[NativeInheritance("IDXGIAdapter")]
-internal unsafe partial struct IDXGIAdapter1
+internal unsafe partial struct IDXGIAdapter1 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x61, 0x8F, 0x03, 0x29,
+ 0x39, 0x38,
+ 0x26, 0x46,
+ 0x91,
+ 0xFD,
+ 0x08,
+ 0x68,
+ 0x79,
+ 0x01,
+ 0x1A,
+ 0x05
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIFactory.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIFactory.cs
index abcb139e7..46f5fb8dc 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIFactory.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIFactory.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("7B7166EC-21C7-44AE-B21A-C9AE321AE369")]
[NativeTypeName("struct IDXGIFactory : IDXGIObject")]
[NativeInheritance("IDXGIObject")]
internal unsafe partial struct IDXGIFactory
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIOutput.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIOutput.cs
index a91f3d659..5d6f307d3 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIOutput.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGIOutput.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("AE02EEDB-C735-4690-8D52-5A8DC20213AA")]
[NativeTypeName("struct IDXGIOutput : IDXGIObject")]
[NativeInheritance("IDXGIObject")]
internal unsafe partial struct IDXGIOutput
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGISwapChain.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGISwapChain.cs
index 953f1e383..971ed936e 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGISwapChain.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi/IDXGISwapChain.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("310D36A0-D2E7-4C0A-AA04-6A9D23B8886A")]
[NativeTypeName("struct IDXGISwapChain : IDXGIDeviceSubObject")]
[NativeInheritance("IDXGIDeviceSubObject")]
-internal unsafe partial struct IDXGISwapChain
+internal unsafe partial struct IDXGISwapChain : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xA0, 0x36, 0x0D, 0x31,
+ 0xE7, 0xD2,
+ 0x0A, 0x4C,
+ 0xAA,
+ 0x04,
+ 0x6A,
+ 0x9D,
+ 0x23,
+ 0xB8,
+ 0x88,
+ 0x6A
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/DXGIOutput1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/DXGIOutput1.cs
index 0dd44e7cd..6084cf722 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/DXGIOutput1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/DXGIOutput1.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("00CDDEA8-939B-4B83-A340-A685226666CC")]
[NativeTypeName("struct IDXGIOutput1 : IDXGIOutput")]
[NativeInheritance("IDXGIOutput")]
-internal unsafe partial struct IDXGIOutput1
+internal unsafe partial struct IDXGIOutput1 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xA8, 0xDE, 0xCD, 0x00,
+ 0x9B, 0x93,
+ 0x83, 0x4B,
+ 0xA3,
+ 0x40,
+ 0xA6,
+ 0x85,
+ 0x22,
+ 0x66,
+ 0x66,
+ 0xCC
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGIFactory2.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGIFactory2.cs
index 76a9eae5e..d99c13224 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGIFactory2.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGIFactory2.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("50C83A1C-E072-4C48-87B0-3630FA36A6D0")]
[NativeTypeName("struct IDXGIFactory2 : IDXGIFactory1")]
[NativeInheritance("IDXGIFactory1")]
internal unsafe partial struct IDXGIFactory2
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs
index a76fb9069..aa81b6b2d 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_2/IDXGISwapChain1.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("790A45F7-0D42-4876-983A-0A55CFE6F4AA")]
[NativeTypeName("struct IDXGISwapChain1 : IDXGISwapChain")]
[NativeInheritance("IDXGISwapChain")]
internal unsafe partial struct IDXGISwapChain1
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs
index 05c8980c0..e085046b5 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGIFactory4.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("1BC6EA02-EF36-464F-BF0C-21CA39E5168A")]
[NativeTypeName("struct IDXGIFactory4 : IDXGIFactory3")]
[NativeInheritance("IDXGIFactory3")]
-internal unsafe partial struct IDXGIFactory4
+internal unsafe partial struct IDXGIFactory4 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x02, 0xEA, 0xC6, 0x1B,
+ 0x36, 0xEF,
+ 0x4F, 0x46,
+ 0xBF,
+ 0x0C,
+ 0x21,
+ 0xCA,
+ 0x39,
+ 0xE5,
+ 0x16,
+ 0x8A
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs
index 4084deb89..43c1227bf 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_4/IDXGISwapChain3.cs
@@ -11,11 +11,35 @@
namespace ComputeSharp.Win32;
[SupportedOSPlatform("windows10.0")]
-[Guid("94D99BDB-F1F8-4AB0-B236-7DA0170EDAB1")]
[NativeTypeName("struct IDXGISwapChain3 : IDXGISwapChain2")]
[NativeInheritance("IDXGISwapChain2")]
-internal unsafe partial struct IDXGISwapChain3
+internal unsafe partial struct IDXGISwapChain3 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xDB, 0x9B, 0xD9, 0x94,
+ 0xF8, 0xF1,
+ 0xB0, 0x4A,
+ 0xB2,
+ 0x36,
+ 0x7D,
+ 0xA0,
+ 0x17,
+ 0x0E,
+ 0xDA,
+ 0xB1
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs
index a38db8df5..ad2f06ac9 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/shared/dxgi1_6/IDXGIFactory6.cs
@@ -11,11 +11,35 @@
namespace ComputeSharp.Win32;
[SupportedOSPlatform("windows10.0.17134.0")]
-[Guid("C1B6694F-FF09-44A9-B03C-77900A0A1D17")]
[NativeTypeName("struct IDXGIFactory6 : IDXGIFactory5")]
[NativeInheritance("IDXGIFactory5")]
-internal unsafe partial struct IDXGIFactory6
+internal unsafe partial struct IDXGIFactory6 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x4F, 0x69, 0xB6, 0xC1,
+ 0x09, 0xFF,
+ 0xA9, 0x44,
+ 0xB0,
+ 0x3C,
+ 0x77,
+ 0x90,
+ 0x0A,
+ 0x0A,
+ 0x1D,
+ 0x17
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs
index 18d51aff6..50b02a1ff 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandAllocator.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("6102DEE4-AF59-4B09-B999-B44D73F09B24")]
[NativeTypeName("struct ID3D12CommandAllocator : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12CommandAllocator
+internal unsafe partial struct ID3D12CommandAllocator : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xE4, 0xDE, 0x02, 0x61,
+ 0x59, 0xAF,
+ 0x09, 0x4B,
+ 0xB9,
+ 0x99,
+ 0xB4,
+ 0x4D,
+ 0x73,
+ 0xF0,
+ 0x9B,
+ 0x24
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandList.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandList.cs
index 560e4b064..c80c39420 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandList.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandList.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("7116D91C-E7E4-47CE-B8C6-EC8168F437E5")]
[NativeTypeName("struct ID3D12CommandList : ID3D12DeviceChild")]
[NativeInheritance("ID3D12DeviceChild")]
internal unsafe partial struct ID3D12CommandList
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs
index 7be750947..6a87018de 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12CommandQueue.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("0EC870A6-5D7E-4C22-8CFC-5BAAE07616ED")]
[NativeTypeName("struct ID3D12CommandQueue : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12CommandQueue
+internal unsafe partial struct ID3D12CommandQueue : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xA6, 0x70, 0xC8, 0x0E,
+ 0x7E, 0x5D,
+ 0x22, 0x4C,
+ 0x8C,
+ 0xFC,
+ 0x5B,
+ 0xAA,
+ 0xE0,
+ 0x76,
+ 0x16,
+ 0xED
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs
index 632a9e4e9..c4e01964b 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DescriptorHeap.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("8EFB471D-616C-4F49-90F7-127BB763FA51")]
[NativeTypeName("struct ID3D12DescriptorHeap : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12DescriptorHeap
+internal unsafe partial struct ID3D12DescriptorHeap : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x1D, 0x47, 0xFB, 0x8E,
+ 0x6C, 0x61,
+ 0x49, 0x4F,
+ 0x90,
+ 0xF7,
+ 0x12,
+ 0x7B,
+ 0xB7,
+ 0x63,
+ 0xFA,
+ 0x51
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs
index 76bf8e55c..5a2c174ec 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Device.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("189819F1-1DB6-4B57-BE54-1821339B85F7")]
[NativeTypeName("struct ID3D12Device : ID3D12Object")]
[NativeInheritance("ID3D12Object")]
-internal unsafe partial struct ID3D12Device
+internal unsafe partial struct ID3D12Device : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xF1, 0x19, 0x98, 0x18,
+ 0xB6, 0x1D,
+ 0x57, 0x4B,
+ 0xBE,
+ 0x54,
+ 0x18,
+ 0x21,
+ 0x33,
+ 0x9B,
+ 0x85,
+ 0xF7
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs
index 4948f45c5..72f0d406e 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedData1.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("9727A022-CF1D-4DDA-9EBA-EFFA653FC506")]
[NativeTypeName("struct ID3D12DeviceRemovedExtendedData1 : ID3D12DeviceRemovedExtendedData")]
[NativeInheritance("ID3D12DeviceRemovedExtendedData")]
-internal unsafe partial struct ID3D12DeviceRemovedExtendedData1
+internal unsafe partial struct ID3D12DeviceRemovedExtendedData1 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x22, 0xA0, 0x27, 0x97,
+ 0x1D, 0xCF,
+ 0xDA, 0x4D,
+ 0x9E,
+ 0xBA,
+ 0xEF,
+ 0xFA,
+ 0x65,
+ 0x3F,
+ 0xC5,
+ 0x06
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs
index 34db62bbb..bd9854f43 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12DeviceRemovedExtendedDataSettings1.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("DBD5AE51-3317-4F0A-ADF9-1D7CEDCAAE0B")]
[NativeTypeName("struct ID3D12DeviceRemovedExtendedDataSettings1 : ID3D12DeviceRemovedExtendedDataSettings")]
[NativeInheritance("ID3D12DeviceRemovedExtendedDataSettings")]
-internal unsafe partial struct ID3D12DeviceRemovedExtendedDataSettings1
+internal unsafe partial struct ID3D12DeviceRemovedExtendedDataSettings1 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x51, 0xAE, 0xD5, 0xDB,
+ 0x17, 0x33,
+ 0x0A, 0x4F,
+ 0xAD,
+ 0xF9,
+ 0x1D,
+ 0x7C,
+ 0xED,
+ 0xCA,
+ 0xAE,
+ 0x0B
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs
index ccac1cc3c..3438cd5d9 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Fence.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("0A753DCF-C4D8-4B91-ADF6-BE5A60D95A76")]
[NativeTypeName("struct ID3D12Fence : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12Fence
+internal unsafe partial struct ID3D12Fence : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xCF, 0x3D, 0x75, 0x0A,
+ 0xD8, 0xC4,
+ 0x91, 0x4B,
+ 0xAD,
+ 0xF6,
+ 0xBE,
+ 0x5A,
+ 0x60,
+ 0xD9,
+ 0x5A,
+ 0x76
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs
index bbfe072c0..828329c1f 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12GraphicsCommandList.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("5B160D0F-AC1B-4185-8BA8-B3AE42A5A455")]
[NativeTypeName("struct ID3D12GraphicsCommandList : ID3D12CommandList")]
[NativeInheritance("ID3D12CommandList")]
-internal unsafe partial struct ID3D12GraphicsCommandList
+internal unsafe partial struct ID3D12GraphicsCommandList : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x0F, 0x0D, 0x16, 0x5B,
+ 0x1B, 0xAC,
+ 0x85, 0x41,
+ 0x8B,
+ 0xA8,
+ 0xB3,
+ 0xAE,
+ 0x42,
+ 0xA5,
+ 0xA4,
+ 0x55
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Heap.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Heap.cs
index d3d3d541d..579088b35 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Heap.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Heap.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("6B3B2502-6E51-45B3-90EE-9884265E8DF3")]
[NativeTypeName("struct ID3D12Heap : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
internal unsafe partial struct ID3D12Heap
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs
index b7befbc59..657cbcf04 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12PipelineState.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("765A30F3-F624-4C6F-A828-ACE948622445")]
[NativeTypeName("struct ID3D12PipelineState : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12PipelineState
+internal unsafe partial struct ID3D12PipelineState : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xF3, 0x30, 0x5A, 0x76,
+ 0x24, 0xF6,
+ 0x6F, 0x4C,
+ 0xA8,
+ 0x28,
+ 0xAC,
+ 0xE9,
+ 0x48,
+ 0x62,
+ 0x24,
+ 0x45
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs
index 459b0ae41..97bd52f10 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12Resource.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("696442BE-A72E-4059-BC79-5B5C98040FAD")]
[NativeTypeName("struct ID3D12Resource : ID3D12Pageable")]
[NativeInheritance("ID3D12Pageable")]
-internal unsafe partial struct ID3D12Resource
+internal unsafe partial struct ID3D12Resource : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xBE, 0x42, 0x64, 0x69,
+ 0x2E, 0xA7,
+ 0x59, 0x40,
+ 0xBC,
+ 0x79,
+ 0x5B,
+ 0x5C,
+ 0x98,
+ 0x04,
+ 0x0F,
+ 0xAD
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs
index efdda7160..48dbfc374 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12/ID3D12RootSignature.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("C54A6B66-72DF-4EE8-8BE5-A946A1429214")]
[NativeTypeName("struct ID3D12RootSignature : ID3D12DeviceChild")]
[NativeInheritance("ID3D12DeviceChild")]
-internal unsafe partial struct ID3D12RootSignature
+internal unsafe partial struct ID3D12RootSignature : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x66, 0x6B, 0x4A, 0xC5,
+ 0xDF, 0x72,
+ 0xE8, 0x4E,
+ 0x8B,
+ 0xE5,
+ 0xA9,
+ 0x46,
+ 0xA1,
+ 0x42,
+ 0x92,
+ 0x14
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs
index f47b361b5..d35b5a168 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("344488B7-6846-474B-B989-F027448245E0")]
[NativeTypeName("struct ID3D12Debug : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID3D12Debug
+internal unsafe partial struct ID3D12Debug : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xB7, 0x88, 0x44, 0x34,
+ 0x46, 0x68,
+ 0x4B, 0x47,
+ 0xB9,
+ 0x89,
+ 0xF0,
+ 0x27,
+ 0x44,
+ 0x82,
+ 0x45,
+ 0xE0
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs
index 547e396c3..37f4cd8b6 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12Debug1.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("AFFAA4CA-63FE-4D8E-B8AD-159000AF4304")]
[NativeTypeName("struct ID3D12Debug1 : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID3D12Debug1
+internal unsafe partial struct ID3D12Debug1 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xCA, 0xA4, 0xFA, 0xAF,
+ 0xFE, 0x63,
+ 0x8E, 0x4D,
+ 0xB8,
+ 0xAD,
+ 0x15,
+ 0x90,
+ 0x00,
+ 0xAF,
+ 0x43,
+ 0x04
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs
index 7073b416b..1c0b35d71 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12sdklayers/ID3D12InfoQueue.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("0742A90B-C387-483F-B946-30A7E4E61458")]
[NativeTypeName("struct ID3D12InfoQueue : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID3D12InfoQueue
+internal unsafe partial struct ID3D12InfoQueue : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x0B, 0xA9, 0x42, 0x07,
+ 0x87, 0xC3,
+ 0x3F, 0x48,
+ 0xB9,
+ 0x46,
+ 0x30,
+ 0xA7,
+ 0xE4,
+ 0xE6,
+ 0x14,
+ 0x58
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs
index 8bad32c58..9be08551b 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3d12shader/ID3D12ShaderReflection.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E")]
[NativeTypeName("struct ID3D12ShaderReflection : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct ID3D12ShaderReflection
+internal unsafe partial struct ID3D12ShaderReflection : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x7D, 0x79, 0x58, 0x5A,
+ 0x2C, 0xA7,
+ 0x8D, 0x47,
+ 0x8B,
+ 0xA2,
+ 0xEF,
+ 0xC6,
+ 0xB0,
+ 0xEF,
+ 0xE8,
+ 0x8E
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3dcommon/ID3DBlob.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3dcommon/ID3DBlob.cs
index a3bbe6ff4..4ecbee315 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/d3dcommon/ID3DBlob.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/d3dcommon/ID3DBlob.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("8BA5FB08-5195-40E2-AC58-0D989C3A0102")]
[NativeTypeName("struct ID3D10Blob : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID3DBlob
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/CLSID.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/CLSID.cs
index 326cda204..e2db07965 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/CLSID.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/CLSID.cs
@@ -18,7 +18,8 @@ public static ref readonly Guid CLSID_DxcLibrary
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xAF, 0xD6, 0x45, 0x62,
0xE0, 0x66,
0xFD, 0x48,
@@ -30,7 +31,7 @@ public static ref readonly Guid CLSID_DxcLibrary
0x96,
0x74,
0x8C
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
diff --git a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs
index 158ccffad..08173d19a 100644
--- a/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs
+++ b/src/ComputeSharp.Win32.D3D12/DirectX/um/dxcapi/IDxcUtils.cs
@@ -9,11 +9,35 @@
namespace ComputeSharp.Win32;
-[Guid("4605C4CB-2019-492A-ADA4-65F20BB7D67F")]
[NativeTypeName("struct IDxcUtils : IUnknown")]
[NativeInheritance("IUnknown")]
-internal unsafe partial struct IDxcUtils
+internal unsafe partial struct IDxcUtils : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0xCB, 0xC4, 0x05, 0x46,
+ 0x19, 0x20,
+ 0x2A, 0x49,
+ 0xAD,
+ 0xA4,
+ 0x65,
+ 0xF2,
+ 0x0B,
+ 0xB7,
+ 0xD6,
+ 0x7F
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs b/src/ComputeSharp.Win32.D3D12/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs
index 2a933de37..cd888e04e 100644
--- a/src/ComputeSharp.Win32.D3D12/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs
+++ b/src/ComputeSharp.Win32.D3D12/WinRT/um/windows.ui.xaml.media.dxinterop/ISwapChainPanelNative.cs
@@ -5,13 +5,11 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using System.Runtime.Versioning;
namespace ComputeSharp.Win32;
[SupportedOSPlatform("windows8.1")]
-[Guid("F92F19D2-3ADE-45A6-A20C-F6F1EA90554B")]
[NativeTypeName("struct ISwapChainPanelNative : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ISwapChainPanelNative
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/other/helper-types/IComObject.cs b/src/ComputeSharp.Win32.D3D12/Windows/other/helper-types/IComObject.cs
new file mode 100644
index 000000000..cc0adfd4e
--- /dev/null
+++ b/src/ComputeSharp.Win32.D3D12/Windows/other/helper-types/IComObject.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace ComputeSharp.Win32;
+
+///
+/// An interface for a COM object, with a specific IID.
+///
+internal unsafe interface IComObject
+{
+ ///
+ /// Gets a pointer to the IID for the object type.
+ ///
+ static abstract Guid* IID { get; }
+}
\ No newline at end of file
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/shared/uuids/Windows.Manual.cs b/src/ComputeSharp.Win32.D3D12/Windows/shared/uuids/Windows.Manual.cs
index 42b890d55..94eebd83d 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/shared/uuids/Windows.Manual.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/shared/uuids/Windows.Manual.cs
@@ -7,50 +7,28 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
-#pragma warning disable IDE1006
-
namespace ComputeSharp.Win32;
internal static partial class Windows
{
- /// Retrieves the GUID of of a specified type.
- /// A value of type .
- /// The type to retrieve the GUID for.
- /// A value wrapping a pointer to the GUID data for the input type. This value can be either converted to a pointer, or implicitly assigned to a value.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe UuidOfType __uuidof(T value) // for type inference similar to C++'s __uuidof
- where T : unmanaged
- {
- return new UuidOfType(UUID.RIID);
- }
-
- /// Retrieves the GUID of of a specified type.
- /// A pointer to a value of type .
- /// The type to retrieve the GUID for.
- /// A value wrapping a pointer to the GUID data for the input type. This value can be either converted to a pointer, or implicitly assigned to a value.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe UuidOfType __uuidof(T* value) // for type inference similar to C++'s __uuidof
- where T : unmanaged
- {
- return new UuidOfType(UUID.RIID);
- }
-
/// Retrieves the GUID of of a specified type.
/// The type to retrieve the GUID for.
/// A value wrapping a pointer to the GUID data for the input type. This value can be either converted to a pointer, or implicitly assigned to a value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe UuidOfType __uuidof()
- where T : unmanaged
+ where T : unmanaged, IComObject
{
- return new UuidOfType(UUID.RIID);
+ return new UuidOfType(T.IID);
}
/// A proxy type that wraps a pointer to GUID data. Values of this type can be implicitly converted to and assigned to * or parameters.
[EditorBrowsable(EditorBrowsableState.Never)]
+
public readonly unsafe ref struct UuidOfType
{
private readonly Guid* riid;
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal UuidOfType(Guid* riid)
{
this.riid = riid;
@@ -58,29 +36,12 @@ internal UuidOfType(Guid* riid)
/// Reads a value from the GUID buffer for a given instance.
/// The input instance to read data for.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Guid(UuidOfType guid) => *guid.riid;
/// Returns the * pointer to the GUID buffer for a given instance.
/// The input instance to read data for.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator Guid*(UuidOfType guid) => guid.riid;
}
-
- /// A helper type to provide static GUID buffers for specific types.
- /// The type to allocate a GUID buffer for.
- private static unsafe class UUID
- where T : unmanaged
- {
- /// The pointer to the value for the current type.
- /// The target memory area should never be written to.
- public static readonly Guid* RIID = CreateRIID();
-
- /// Allocates memory for a value and initializes it.
- /// A pointer to memory holding the value for the current type.
- private static Guid* CreateRIID()
- {
- var p = (Guid*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(T), sizeof(Guid));
- *p = typeof(T).GUID;
- return p;
- }
- }
}
\ No newline at end of file
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IID.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IID.cs
deleted file mode 100644
index f3f05efaf..000000000
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IID.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
-
-// Ported from um/Unknwnbase.h in the Windows SDK for Windows 10.0.20348.0
-// Original source is Copyright © Microsoft. All rights reserved.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace ComputeSharp.Win32;
-
-internal static partial class IID
-{
- public static ref readonly Guid IID_IUnknown
- {
- get
- {
- ReadOnlySpan data = new byte[] {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0xC0,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x46
- };
-
- Debug.Assert(data.Length == Unsafe.SizeOf());
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
- }
- }
-}
\ No newline at end of file
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IUnknown.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IUnknown.cs
index cbdb1a64c..ae86a8be7 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IUnknown.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/Unknwnbase/IUnknown.cs
@@ -9,9 +9,33 @@
namespace ComputeSharp.Win32;
-[Guid("00000000-0000-0000-C000-000000000046")]
-internal unsafe partial struct IUnknown
+internal unsafe partial struct IUnknown : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0xC0,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x46
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IID.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IID.cs
index 72e17ac5e..d43ecba3b 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IID.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IID.cs
@@ -14,9 +14,11 @@ internal static partial class IID
{
public static ref readonly Guid IID_ISequentialStream
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x30, 0x3A, 0x73, 0x0C,
0x1C, 0x2A,
0xCE, 0x11,
@@ -28,7 +30,7 @@ public static ref readonly Guid IID_ISequentialStream
0x44,
0x77,
0x3D
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -37,9 +39,11 @@ public static ref readonly Guid IID_ISequentialStream
public static ref readonly Guid IID_IStream
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x0C, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
@@ -51,7 +55,7 @@ public static ref readonly Guid IID_IStream
0x00,
0x00,
0x46
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IStream.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IStream.cs
index a5837eaff..292f217e7 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IStream.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/objidlbase/IStream.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("0000000C-0000-0000-C000-000000000046")]
[NativeTypeName("struct IStream : ISequentialStream")]
[NativeInheritance("ISequentialStream")]
internal unsafe partial struct IStream
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/GUID.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/GUID.cs
index ff2cfdcfd..59ed46dea 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/GUID.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/GUID.cs
@@ -18,7 +18,8 @@ public static ref readonly Guid GUID_ContainerFormatBmp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x7E, 0xD8, 0xF1, 0x0A,
0xFE, 0xFC,
0x88, 0x41,
@@ -30,7 +31,7 @@ public static ref readonly Guid GUID_ContainerFormatBmp
0x71,
0xCB,
0xE3
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -43,7 +44,8 @@ public static ref readonly Guid GUID_ContainerFormatPng
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xF4, 0xFA, 0x7C, 0x1B,
0x3F, 0x71,
0x3C, 0x47,
@@ -55,7 +57,7 @@ public static ref readonly Guid GUID_ContainerFormatPng
0x5F,
0xAE,
0xAF
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -68,7 +70,8 @@ public static ref readonly Guid GUID_ContainerFormatJpeg
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xAA, 0xA5, 0xE4, 0x19,
0x62, 0x56,
0xC5, 0x4F,
@@ -80,7 +83,7 @@ public static ref readonly Guid GUID_ContainerFormatJpeg
0x8E,
0x10,
0x57
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -93,7 +96,8 @@ public static ref readonly Guid GUID_ContainerFormatTiff
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x30, 0xCC, 0x3B, 0x16,
0xE9, 0xE2,
0x0B, 0x4F,
@@ -105,7 +109,7 @@ public static ref readonly Guid GUID_ContainerFormatTiff
0xB7,
0x88,
0xA3
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -118,7 +122,8 @@ public static ref readonly Guid GUID_ContainerFormatWmp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xAA, 0x7C, 0xA3, 0x57,
0x7A, 0x36,
0x40, 0x45,
@@ -130,7 +135,7 @@ public static ref readonly Guid GUID_ContainerFormatWmp
0x09,
0x3A,
0x4B
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -143,7 +148,8 @@ public static ref readonly Guid GUID_ContainerFormatDds
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x95, 0xCB, 0x67, 0x99,
0x85, 0x2E,
0xC8, 0x4A,
@@ -155,7 +161,7 @@ public static ref readonly Guid GUID_ContainerFormatDds
0xD4,
0x25,
0xC9
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -168,7 +174,8 @@ public static ref readonly Guid GUID_WICPixelFormat8bppGray
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -180,7 +187,7 @@ public static ref readonly Guid GUID_WICPixelFormat8bppGray
0x8D,
0xC9,
0x08
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -193,7 +200,8 @@ public static ref readonly Guid GUID_WICPixelFormat16bppGray
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -205,7 +213,7 @@ public static ref readonly Guid GUID_WICPixelFormat16bppGray
0x8D,
0xC9,
0x0B
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -218,7 +226,8 @@ public static ref readonly Guid GUID_WICPixelFormat24bppBGR
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -230,7 +239,7 @@ public static ref readonly Guid GUID_WICPixelFormat24bppBGR
0x8D,
0xC9,
0x0C
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -243,7 +252,8 @@ public static ref readonly Guid GUID_WICPixelFormat32bppBGRA
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -255,7 +265,7 @@ public static ref readonly Guid GUID_WICPixelFormat32bppBGRA
0x8D,
0xC9,
0x0F
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -268,7 +278,8 @@ public static ref readonly Guid GUID_WICPixelFormat32bppRGBA
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x2D, 0xAD, 0xC7, 0xF5,
0x8D, 0x6A,
0xDD, 0x43,
@@ -280,7 +291,7 @@ public static ref readonly Guid GUID_WICPixelFormat32bppRGBA
0x26,
0x1A,
0xE9
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
@@ -293,7 +304,8 @@ public static ref readonly Guid GUID_WICPixelFormat64bppRGBA
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -305,7 +317,7 @@ public static ref readonly Guid GUID_WICPixelFormat64bppRGBA
0x8D,
0xC9,
0x16
- };
+ ];
Debug.Assert(data.Length == Unsafe.SizeOf());
return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmap.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmap.cs
index eb9cc87bc..dee67031e 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmap.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmap.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000121-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICBitmap : IWICBitmapSource")]
[NativeInheritance("IWICBitmapSource")]
internal unsafe partial struct IWICBitmap
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapDecoder.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapDecoder.cs
index 795ab4424..c9f41fc71 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapDecoder.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapDecoder.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("9EDDE9E7-8DEE-47EA-99DF-E6FAF2ED44BF")]
[NativeTypeName("struct IWICBitmapDecoder : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct IWICBitmapDecoder
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapEncoder.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapEncoder.cs
index ae4e785e8..7078d7c6a 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapEncoder.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapEncoder.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000103-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICBitmapEncoder : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct IWICBitmapEncoder
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameDecode.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameDecode.cs
index dba203998..fff0c31d3 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameDecode.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameDecode.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("3B16811B-6A43-4EC9-A813-3D930C13B940")]
[NativeTypeName("struct IWICBitmapFrameDecode : IWICBitmapSource")]
[NativeInheritance("IWICBitmapSource")]
internal unsafe partial struct IWICBitmapFrameDecode
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameEncode.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameEncode.cs
index cf8de1bbd..0ff4ad202 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameEncode.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapFrameEncode.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000105-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICBitmapFrameEncode : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct IWICBitmapFrameEncode
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapSource.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapSource.cs
index 4ee3654a5..cc03242aa 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapSource.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICBitmapSource.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000120-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICBitmapSource : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct IWICBitmapSource
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICFormatConverter.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICFormatConverter.cs
index 00ffced57..d18271b22 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICFormatConverter.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICFormatConverter.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000301-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICFormatConverter : IWICBitmapSource")]
[NativeInheritance("IWICBitmapSource")]
internal unsafe partial struct IWICFormatConverter
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs
index 5c6451f93..198194aa0 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICImagingFactory2.cs
@@ -11,11 +11,35 @@
namespace ComputeSharp.Win32;
[SupportedOSPlatform("windows8.0")]
-[Guid("7B816B45-1996-4476-B132-DE9E247C8AF0")]
[NativeTypeName("struct IWICImagingFactory2 : IWICImagingFactory")]
[NativeInheritance("IWICImagingFactory")]
-internal unsafe partial struct IWICImagingFactory2
+internal unsafe partial struct IWICImagingFactory2 : IComObject
{
+ ///
+ static Guid* IComObject.IID
+ {
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ ReadOnlySpan data =
+ [
+ 0x45, 0x6B, 0x81, 0x7B,
+ 0x96, 0x19,
+ 0x76, 0x44,
+ 0xB1,
+ 0x32,
+ 0xDE,
+ 0x9E,
+ 0x24,
+ 0x7C,
+ 0x8A,
+ 0xF0
+ ];
+
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICPalette.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICPalette.cs
index 39dc8bcb0..3dd59ab4f 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICPalette.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICPalette.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("00000040-A8F2-4877-BA0A-FD2B6645FB94")]
[NativeTypeName("struct IWICPalette : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct IWICPalette
diff --git a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICStream.cs b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICStream.cs
index dffbc1f99..64e1676c1 100644
--- a/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICStream.cs
+++ b/src/ComputeSharp.Win32.D3D12/Windows/um/wincodec/IWICStream.cs
@@ -5,11 +5,9 @@
using System;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
namespace ComputeSharp.Win32;
-[Guid("135FF860-22B7-4DDF-B0F6-218F4F299A43")]
[NativeTypeName("struct IWICStream : IStream")]
[NativeInheritance("IStream")]
internal unsafe partial struct IWICStream
diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs
index ba509cb37..2304c1b5c 100644
--- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs
@@ -35,11 +35,8 @@ public static HRESULT InitializeFromBufferWriter(this ref IWICStream stream, IBu
///
/// A manual CCW implementation for an object wrapping an instance.
///
- private unsafe partial struct IBufferWriterWrapper //: IUnknown.Interface
+ private unsafe partial struct IBufferWriterWrapper
{
- /////
- //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw();
-
///
/// The shared vtable pointer for instances.
///
@@ -139,7 +136,7 @@ private static int QueryInterface(IBufferWriterWrapper* @this, Guid* riid, void*
return E_POINTER;
}
- if (riid->Equals(IID_IUnknown) ||
+ if (riid->Equals(Windows.__uuidof()) ||
riid->Equals(IID_ISequentialStream) ||
riid->Equals(IID_IStream))
{
diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs
index 926e6948e..48455f8cc 100644
--- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs
+++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs
@@ -37,11 +37,8 @@ public static HRESULT InitializeFromStream(this ref IWICStream stream, Stream so
///
/// A manual CCW implementation for an object wrapping a instance.
///
- private unsafe partial struct IStreamWrapper //: IUnknown.Interface
+ private unsafe partial struct IStreamWrapper
{
- /////
- //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw();
-
///
/// The shared vtable pointer for instances.
///
@@ -141,7 +138,7 @@ private static int QueryInterface(IStreamWrapper* @this, Guid* riid, void** ppvO
return E_POINTER;
}
- if (riid->Equals(IID_IUnknown) ||
+ if (riid->Equals(Windows.__uuidof()) ||
riid->Equals(IID_ISequentialStream) ||
riid->Equals(IID_IStream))
{
diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs
index ee15a951f..548f70351 100644
--- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs
+++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.Interop.Allocation;
///
/// An allocation wrapper for a native object.
///
-[Guid("D42D5782-2DE7-4539-A817-482E3AA01E2E")]
-internal unsafe struct ID3D12Allocation //: IUnknown.Interface
+internal unsafe struct ID3D12Allocation : IComObject
{
- ///
- /// Gets the for (D42D5782-2DE7-4539-A817-482E3AA01E2E).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0x82, 0x57, 0x2D, 0xD4,
0xE7, 0x2D,
0x39, 0x45,
@@ -31,15 +30,12 @@ public static ref readonly Guid Guid
0xA0,
0x1E,
0x2E
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
- /////
- //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
-
///
/// The vtable for the current instance.
///
diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs
index 840732aad..a7c9bfa6c 100644
--- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs
+++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.Interop.Allocation;
///
/// An object that can allocate resources for a given instance.
///
-[Guid("2D5E55D2-9244-431F-868E-0D90AAB6E575")]
-internal unsafe struct ID3D12MemoryAllocator //: IUnknown.Interface
+internal unsafe struct ID3D12MemoryAllocator : IComObject
{
- ///
- /// Gets the for (2D5E55D2-9244-431F-868E-0D90AAB6E575).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xD2, 0x55, 0x5E, 0x2D,
0x44, 0x92,
0x1F, 0x43,
@@ -31,15 +30,12 @@ public static ref readonly Guid Guid
0xB6,
0xE5,
0x75
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
- /////
- //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
-
///
/// The vtable for the current instance.
///
diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs
index bb41a71e4..e67a82f6b 100644
--- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs
+++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs
@@ -3,24 +3,23 @@
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
-#pragma warning disable CS0649
+#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.Interop.Allocation;
///
/// A factory type for objects.
///
-[Guid("CC1E74A7-786D-40F4-8AE2-F8B7A255587E")]
-internal unsafe struct ID3D12MemoryAllocatorFactory //: IUnknown.Interface
+internal unsafe struct ID3D12MemoryAllocatorFactory : IComObject
{
- ///
- /// Gets the for (CC1E74A7-786D-40F4-8AE2-F8B7A255587E).
- ///
- public static ref readonly Guid Guid
+ ///
+ static Guid* IComObject.IID
{
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- ReadOnlySpan data = new byte[] {
+ ReadOnlySpan data =
+ [
0xA7, 0x74, 0x1E, 0xCC,
0x6D, 0x78,
0xF4, 0x40,
@@ -31,15 +30,12 @@ public static ref readonly Guid Guid
0x55,
0x58,
0x7E
- };
+ ];
- return ref Unsafe.As(ref MemoryMarshal.GetReference(data));
+ return (Guid*) Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
- /////
- //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
-
///
/// The vtable for the current instance.
///