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 8f28b281..28d04e3f 100644
--- a/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs
+++ b/src/ComputeSharp.D2D1.WinUI/ABI.Microsoft.Graphics.Canvas/ICanvasEffectFactoryNative.cs
@@ -8,105 +8,124 @@ using IInspectable = ComputeSharp.Win32.IInspectable;
#pragma warning disable CS0649, IDE0055, IDE1006
-namespace ABI.Microsoft.Graphics.Canvas;
-
-///
-/// The interop Win2D interface for factories of external effects.
-///
-[NativeTypeName("class ICanvasEffectFactoryNative : IUnknown")]
-[NativeInheritance("IUnknown")]
-internal unsafe struct ICanvasEffectFactoryNative : IComObject
+namespace ABI.Microsoft.Graphics.Canvas
{
- ///
- static Guid* IComObject.IID
+ ///
+ /// The interop Win2D interface for factories of external effects.
+ ///
+ [NativeTypeName("class ICanvasEffectFactoryNative : IUnknown")]
+ [NativeInheritance("IUnknown")]
+ internal unsafe struct ICanvasEffectFactoryNative : IComObject
{
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
+ ///
+ public static Guid* IID
{
- ReadOnlySpan data =
- [
- 0x1F, 0x1A, 0xBA, 0x29,
- 0xFE, 0x1C,
- 0xC3, 0x44,
- 0x98, 0x4D,
- 0x42,
- 0x6D,
- 0x61,
- 0xB5,
- 0x14,
- 0x27
- ];
+ [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));
+ return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
+ }
+ }
+
+ public void** lpVtbl;
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(0)]
+ public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
+ {
+ return ((delegate* unmanaged[MemberFunction])this.lpVtbl[0])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this), riid, ppvObject);
+ }
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(1)]
+ [return: NativeTypeName("ULONG")]
+ public uint AddRef()
+ {
+ return ((delegate* unmanaged[MemberFunction])this.lpVtbl[1])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this));
+ }
+
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(2)]
+ [return: NativeTypeName("ULONG")]
+ public uint Release()
+ {
+ return ((delegate* unmanaged[MemberFunction])this.lpVtbl[2])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this));
+ }
+
+ ///
+ /// Creates a new inspectable wrapper for an input D2D effect previosly registered through .
+ ///
+ /// The input canvas device.
+ /// The input native effect to create a wrapper for.
+ /// The realization DPIs for .
+ /// The resulting wrapper for .
+ /// The for the operation.
+ ///
+ /// All parameters are directly forwarded from the ones the caller passed to . The returned
+ /// wrapper should implement to be returned correctly from Win2D after this call.
+ ///
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(3)]
+ public HRESULT CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
+ {
+ return ((delegate* unmanaged[MemberFunction])this.lpVtbl[3])(
+ (ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this),
+ device,
+ resource,
+ dpi,
+ wrapper);
}
}
- public void** lpVtbl;
-
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- [VtblIndex(0)]
- public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
- {
- return ((delegate* unmanaged[MemberFunction])this.lpVtbl[0])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this), riid, ppvObject);
- }
-
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- [VtblIndex(1)]
- [return: NativeTypeName("ULONG")]
- public uint AddRef()
- {
- return ((delegate* unmanaged[MemberFunction])this.lpVtbl[1])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this));
- }
-
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- [VtblIndex(2)]
- [return: NativeTypeName("ULONG")]
- public uint Release()
- {
- return ((delegate* unmanaged[MemberFunction])this.lpVtbl[2])((ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this));
- }
-
///
- /// Creates a new inspectable wrapper for an input D2D effect previosly registered through .
+ /// The ABI methods for .
///
- /// The input canvas device.
- /// The input native effect to create a wrapper for.
- /// The realization DPIs for .
- /// The resulting wrapper for .
- /// The for the operation.
- ///
- /// All parameters are directly forwarded from the ones the caller passed to . The returned
- /// wrapper should implement to be returned correctly from Win2D after this call.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- [VtblIndex(3)]
- public HRESULT CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
+ [Guid("E042D1F7-F9AD-4479-A713-67627EA31863")]
+ internal static unsafe class ICanvasEffectFactoryNativeMethods
{
- return ((delegate* unmanaged[MemberFunction])this.lpVtbl[3])(
- (ICanvasEffectFactoryNative*)Unsafe.AsPointer(ref this),
- device,
- resource,
- dpi,
- wrapper);
+ ///
+ public static Guid IID => *ICanvasEffectFactoryNative.IID;
+
+ ///
+ public static IntPtr AbiToProjectionVftablePtr => global::Microsoft.Graphics.Canvas.ICanvasEffectFactoryNative.Vftbl.AbiToProjectionVftablePtr;
}
+}
+
+namespace Microsoft.Graphics.Canvas
+{
+ using ABI.Microsoft.Graphics.Canvas;
///
- /// The managed implementation of .
+ /// The managed implementation of .
///
[Guid("29BA1A1F-1CFE-44C3-984D-426D61B51427")]
[WindowsRuntimeType]
- [WindowsRuntimeHelperType(typeof(Interface))]
- public interface Interface
+ [WindowsRuntimeHelperType(typeof(ICanvasEffectFactoryNative))]
+ internal unsafe interface ICanvasEffectFactoryNative
{
- ///
+ ///
[return: NativeTypeName("HRESULT")]
int CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper);
///
- /// The vtable type for .
+ /// The vtable type for .
///
[Guid("29BA1A1F-1CFE-44C3-984D-426D61B51427")]
public struct Vftbl
@@ -117,9 +136,9 @@ internal unsafe struct ICanvasEffectFactoryNative : IComObject
public static readonly IntPtr AbiToProjectionVftablePtr = InitVtbl();
///
- /// Builds the custom method table pointer for .
+ /// Builds the custom method table pointer for .
///
- /// The method table pointer for .
+ /// The method table pointer for .
private static IntPtr InitVtbl()
{
Vftbl* lpVtbl = (Vftbl*)ComWrappersSupport.AllocateVtableMemory(typeof(Vftbl), sizeof(Vftbl));
@@ -140,14 +159,14 @@ internal unsafe struct ICanvasEffectFactoryNative : IComObject
///
private delegate* unmanaged[MemberFunction] CreateWrapper;
- ///
+ ///
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvMemberFunction)])]
[return: NativeTypeName("HRESULT")]
private static int CreateWrapperFromAbi(IntPtr thisPtr, ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
{
try
{
- return ComWrappersSupport.FindObject(thisPtr).CreateWrapper(device, resource, dpi, wrapper);
+ return ComWrappersSupport.FindObject(thisPtr).CreateWrapper(device, resource, dpi, wrapper);
}
catch (Exception e)
{
diff --git a/src/ComputeSharp.D2D1.WinUI/Helpers/ResourceManager.cs b/src/ComputeSharp.D2D1.WinUI/Helpers/ResourceManager.cs
index 6a81f448..d2701fac 100644
--- a/src/ComputeSharp.D2D1.WinUI/Helpers/ResourceManager.cs
+++ b/src/ComputeSharp.D2D1.WinUI/Helpers/ResourceManager.cs
@@ -9,6 +9,7 @@ using WinRT;
namespace ComputeSharp.D2D1.WinUI.Helpers;
using CanvasDevice = Microsoft.Graphics.Canvas.CanvasDevice;
+using ICanvasEffectFactoryNative = Microsoft.Graphics.Canvas.ICanvasEffectFactoryNative;
using IInspectable = Win32.IInspectable;
///
@@ -86,13 +87,13 @@ internal static unsafe class ResourceManager
///
/// The id of the effects to register a factory for.
/// The input factory to create wrappers of native effects.
- public static void RegisterEffectFactory(Guid effectId, ICanvasEffectFactoryNative.Interface factory)
+ public static void RegisterEffectFactory(Guid effectId, ICanvasEffectFactoryNative factory)
{
using ComPtr canvasFactoryNative = default;
GetActivationFactory(canvasFactoryNative.GetAddressOf());
- using ComPtr canvasEffectFactoryNative = default;
+ using ComPtr canvasEffectFactoryNative = default;
RcwMarshaller.GetNativeInterface(factory, canvasEffectFactoryNative.GetAddressOf()).Assert();
diff --git a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs
index d1b23d9a..8d11efed 100644
--- a/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs
+++ b/src/ComputeSharp.D2D1.WinUI/PixelShaderEffect{T}.ICanvasEffectFactoryNative.cs
@@ -5,6 +5,7 @@ using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.WinUI.Extensions;
using ComputeSharp.D2D1.WinUI.Helpers;
using ComputeSharp.Win32;
+using ICanvasEffectFactoryNative = Microsoft.Graphics.Canvas.ICanvasEffectFactoryNative;
namespace ComputeSharp.D2D1.WinUI;
@@ -74,10 +75,10 @@ unsafe partial class PixelShaderEffect
///
/// A managed implementation of for .
///
- private sealed class EffectFactory : ICanvasEffectFactoryNative.Interface
+ private sealed class EffectFactory : ICanvasEffectFactoryNative
{
///
- int ICanvasEffectFactoryNative.Interface.CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
+ int ICanvasEffectFactoryNative.CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
{
PixelShaderEffect @this;