diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs index f88f97dc..1dedba7f 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs @@ -1,7 +1,9 @@ using System; using System.Drawing; using System.Runtime.CompilerServices; +#if NET6_0_OR_GREATER using System.Runtime.InteropServices; +#endif using ComputeSharp.D2D1.Extensions; using ComputeSharp.D2D1.Interop.Effects; using TerraFX.Interop.Windows; @@ -14,77 +16,6 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers; /// unsafe partial struct D2D1TransformMapperImpl { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(D2D1TransformMapperImpl* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(D2D1TransformMapperImpl* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int MapInputRectsToOutputRectDelegate( - D2D1TransformMapperImpl* @this, - ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext, - RECT* inputRects, - RECT* inputOpaqueSubRects, - uint inputRectCount, - RECT* outputRect, - RECT* outputOpaqueSubRect); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int MapOutputRectToInputRectsDelegate( - D2D1TransformMapperImpl* @this, - RECT* outputRect, - RECT* inputRects, - uint inputRectsCount); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int MapInvalidRectDelegate( - D2D1TransformMapperImpl* @this, - uint inputIndex, - RECT invalidInputRect, - RECT* invalidOutputRect); - - /// - /// A cached instance wrapping . - /// - private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - private static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - private static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - private static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect; - - /// - /// A cached instance wrapping . - /// - private static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects; - - /// - /// A cached instance wrapping . - /// - private static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect; -#endif - /// [UnmanagedCallersOnly] private static int QueryInterface(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs index 34ed9438..66378127 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs @@ -18,6 +18,77 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers; /// internal unsafe partial struct D2D1TransformMapperImpl { +#if !NET6_0_OR_GREATER + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int QueryInterfaceDelegate(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate uint AddRefDelegate(D2D1TransformMapperImpl* @this); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate uint ReleaseDelegate(D2D1TransformMapperImpl* @this); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int MapInputRectsToOutputRectDelegate( + D2D1TransformMapperImpl* @this, + ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext, + RECT* inputRects, + RECT* inputOpaqueSubRects, + uint inputRectCount, + RECT* outputRect, + RECT* outputOpaqueSubRect); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int MapOutputRectToInputRectsDelegate( + D2D1TransformMapperImpl* @this, + RECT* outputRect, + RECT* inputRects, + uint inputRectsCount); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate int MapInvalidRectDelegate( + D2D1TransformMapperImpl* @this, + uint inputIndex, + RECT invalidInputRect, + RECT* invalidOutputRect); + + /// + /// A cached instance wrapping . + /// + private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; + + /// + /// A cached instance wrapping . + /// + private static readonly AddRefDelegate AddRefWrapper = AddRef; + + /// + /// A cached instance wrapping . + /// + private static readonly ReleaseDelegate ReleaseWrapper = Release; + + /// + /// A cached instance wrapping . + /// + private static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect; + + /// + /// A cached instance wrapping . + /// + private static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects; + + /// + /// A cached instance wrapping . + /// + private static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect; +#endif + /// /// The shared method table pointer for all instances. ///