diff --git a/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs b/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs index 39b1aa50..2d9cc834 100644 --- a/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs +++ b/src/ComputeSharp.D2D1/Shaders/Exceptions/FxcCompilationException.cs @@ -23,7 +23,7 @@ public sealed class FxcCompilationException : Exception /// A formatted error message for a new instance. private static string GetExceptionMessage(string error) { -#if NET6_0_OR_GREATER +#if !SOURCE_GENERATOR ReadOnlySpan message = error.AsSpan().Trim(); #else string message = error.Trim(); diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs index acfa28f2..851056b1 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Globals{T}.cs @@ -74,18 +74,10 @@ internal unsafe partial struct PixelShaderEffect /// /// Gets the factory for the current effect. /// -#if NET6_0_OR_GREATER - public delegate* unmanaged[Stdcall] Factory -#else - public void* Factory -#endif + public delegate* unmanaged Factory { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if NET6_0_OR_GREATER - get => (delegate* unmanaged[Stdcall])Marshal.GetFunctionPointerForDelegate(this.effectFactory); -#else - get => (void*)Marshal.GetFunctionPointerForDelegate(this.effectFactory); -#endif + get => (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(this.effectFactory); } } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs index 1d863751..331f4cca 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs @@ -14,68 +14,6 @@ partial struct PixelShaderEffect /// private static unsafe class ID2D1DrawTransformMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate uint GetInputCountDelegate(PixelShaderEffect* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapOutputRectToInputRectsDelegate(PixelShaderEffect* @this, RECT* outputRect, RECT* inputRects, uint inputRectsCount); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapInputRectsToOutputRectDelegate(PixelShaderEffect* @this, RECT* inputRects, RECT* inputOpaqueSubRects, uint inputRectCount, RECT* outputRect, RECT* outputOpaqueSubRect); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapInvalidRectDelegate(PixelShaderEffect* @this, uint inputIndex, RECT invalidInputRect, RECT* invalidOutputRect); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int SetDrawInfoDelegate(PixelShaderEffect* @this, ID2D1DrawInfo* drawInfo); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly GetInputCountDelegate GetInputCountWrapper = GetInputCount; - - /// - /// A cached instance wrapping . - /// - public static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects; - - /// - /// A cached instance wrapping . - /// - public static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect; - - /// - /// A cached instance wrapping . - /// - public static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect; - - /// - /// A cached instance wrapping . - /// - public static readonly SetDrawInfoDelegate SetDrawInfoWrapper = SetDrawInfo; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(PixelShaderEffect* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs index 6681b8e5..2eb6e2b5 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs @@ -17,50 +17,6 @@ internal unsafe partial struct PixelShaderEffect /// private static class ID2D1EffectImplMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int InitializeDelegate(PixelShaderEffect* @this, ID2D1EffectContext* effectContext, ID2D1TransformGraph* transformGraph); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int PrepareForRenderDelegate(PixelShaderEffect* @this, D2D1_CHANGE_TYPE changeType); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int SetGraphDelegate(PixelShaderEffect* @this, ID2D1TransformGraph* transformGraph); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly InitializeDelegate InitializeWrapper = Initialize; - - /// - /// A cached instance wrapping . - /// - public static readonly PrepareForRenderDelegate PrepareForRenderWrapper = PrepareForRender; - - /// - /// A cached instance wrapping . - /// - public static readonly SetGraphDelegate SetGraphWrapper = SetGraph; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(PixelShaderEffect* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs index 331b4142..026c9838 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.cs @@ -11,102 +11,40 @@ namespace ComputeSharp.D2D1.Interop.Effects; /// unsafe partial struct PixelShaderEffect { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int PropertyGetFunctionDelegate(IUnknown* effect, byte* data, uint dataSize, uint* actualSize); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int PropertySetFunctionDelegate(IUnknown* effect, byte* data, uint dataSize); - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetConstantBufferWrapper = GetConstantBufferImpl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetConstantBufferWrapper = SetConstantBufferImpl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetTransformMapperWrapper = GetTransformMapperImpl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetTransformMapperWrapper = SetTransformMapperImpl; -#endif - /// /// Gets the get accessor for the constant buffer. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetConstantBuffer -#else - public static void* GetConstantBuffer -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if NET6_0_OR_GREATER get => &GetConstantBufferImpl; -#else - get => (void*)Marshal.GetFunctionPointerForDelegate(GetConstantBufferWrapper); -#endif } /// /// Gets the set accessor for the constant buffer. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetConstantBuffer -#else - public static void* SetConstantBuffer -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if NET6_0_OR_GREATER get => &SetConstantBufferImpl; -#else - get => (void*)Marshal.GetFunctionPointerForDelegate(SetConstantBufferWrapper); -#endif } /// /// Gets the get accessor for the transform mapper. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetTransformMapper -#else - public static void* GetTransformMapper -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if NET6_0_OR_GREATER get => &GetTransformMapperImpl; -#else - get => (void*)Marshal.GetFunctionPointerForDelegate(GetTransformMapperWrapper); -#endif } /// /// Gets the set accessor for the transform mapper. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetTransformMapper -#else - public static void* SetTransformMapper -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if NET6_0_OR_GREATER get => &SetTransformMapperImpl; -#else - get => (void*)Marshal.GetFunctionPointerForDelegate(SetTransformMapperWrapper); -#endif } /// diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs index 6198dd5b..2f1c8cc3 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.g.cs @@ -1,7 +1,5 @@ using System.Runtime.CompilerServices; -#if !NET6_OR_GREATER using System.Runtime.InteropServices; -#endif using ComputeSharp.Win32; namespace ComputeSharp.D2D1.Interop.Effects; @@ -9,805 +7,387 @@ namespace ComputeSharp.D2D1.Interop.Effects; /// unsafe partial struct PixelShaderEffect { -#if !NET6_0_OR_GREATER - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager0Wrapper = GetResourceTextureManager0Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager0Wrapper = SetResourceTextureManager0Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager1Wrapper = GetResourceTextureManager1Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager1Wrapper = SetResourceTextureManager1Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager2Wrapper = GetResourceTextureManager2Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager2Wrapper = SetResourceTextureManager2Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager3Wrapper = GetResourceTextureManager3Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager3Wrapper = SetResourceTextureManager3Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager4Wrapper = GetResourceTextureManager4Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager4Wrapper = SetResourceTextureManager4Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager5Wrapper = GetResourceTextureManager5Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager5Wrapper = SetResourceTextureManager5Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager6Wrapper = GetResourceTextureManager6Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager6Wrapper = SetResourceTextureManager6Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager7Wrapper = GetResourceTextureManager7Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager7Wrapper = SetResourceTextureManager7Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager8Wrapper = GetResourceTextureManager8Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager8Wrapper = SetResourceTextureManager8Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager9Wrapper = GetResourceTextureManager9Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager9Wrapper = SetResourceTextureManager9Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager10Wrapper = GetResourceTextureManager10Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager10Wrapper = SetResourceTextureManager10Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager11Wrapper = GetResourceTextureManager11Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager11Wrapper = SetResourceTextureManager11Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager12Wrapper = GetResourceTextureManager12Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager12Wrapper = SetResourceTextureManager12Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager13Wrapper = GetResourceTextureManager13Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager13Wrapper = SetResourceTextureManager13Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager14Wrapper = GetResourceTextureManager14Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager14Wrapper = SetResourceTextureManager14Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager15Wrapper = GetResourceTextureManager15Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager15Wrapper = SetResourceTextureManager15Impl; -#endif - /// /// Gets the get accessor for the resource manager at index 0. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager0 -#else - public static void* GetResourceTextureManager0 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager0Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager0Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 0. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager0 -#else - public static void* SetResourceTextureManager0 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager0Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager0Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 1. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager1 -#else - public static void* GetResourceTextureManager1 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager1Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager1Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 1. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager1 -#else - public static void* SetResourceTextureManager1 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager1Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager1Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 2. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager2 -#else - public static void* GetResourceTextureManager2 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager2Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager2Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 2. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager2 -#else - public static void* SetResourceTextureManager2 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager2Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager2Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 3. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager3 -#else - public static void* GetResourceTextureManager3 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager3Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager3Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 3. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager3 -#else - public static void* SetResourceTextureManager3 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager3Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager3Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 4. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager4 -#else - public static void* GetResourceTextureManager4 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager4Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager4Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 4. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager4 -#else - public static void* SetResourceTextureManager4 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager4Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager4Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 5. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager5 -#else - public static void* GetResourceTextureManager5 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager5Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager5Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 5. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager5 -#else - public static void* SetResourceTextureManager5 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager5Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager5Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 6. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager6 -#else - public static void* GetResourceTextureManager6 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager6Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager6Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 6. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager6 -#else - public static void* SetResourceTextureManager6 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager6Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager6Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 7. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager7 -#else - public static void* GetResourceTextureManager7 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager7Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager7Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 7. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager7 -#else - public static void* SetResourceTextureManager7 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager7Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager7Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 8. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager8 -#else - public static void* GetResourceTextureManager8 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager8Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager8Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 8. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager8 -#else - public static void* SetResourceTextureManager8 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager8Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager8Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 9. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager9 -#else - public static void* GetResourceTextureManager9 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager9Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager9Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 9. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager9 -#else - public static void* SetResourceTextureManager9 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager9Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager9Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 10. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager10 -#else - public static void* GetResourceTextureManager10 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager10Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager10Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 10. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager10 -#else - public static void* SetResourceTextureManager10 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager10Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager10Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 11. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager11 -#else - public static void* GetResourceTextureManager11 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager11Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager11Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 11. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager11 -#else - public static void* SetResourceTextureManager11 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager11Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager11Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 12. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager12 -#else - public static void* GetResourceTextureManager12 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager12Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager12Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 12. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager12 -#else - public static void* SetResourceTextureManager12 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager12Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager12Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 13. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager13 -#else - public static void* GetResourceTextureManager13 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager13Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager13Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 13. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager13 -#else - public static void* SetResourceTextureManager13 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager13Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager13Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 14. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager14 -#else - public static void* GetResourceTextureManager14 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager14Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager14Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 14. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager14 -#else - public static void* SetResourceTextureManager14 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager14Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager14Wrapper); -#endif } } /// /// Gets the get accessor for the resource manager at index 15. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager15 -#else - public static void* GetResourceTextureManager15 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager15Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager15Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index 15. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager15 -#else - public static void* SetResourceTextureManager15 -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager15Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager15Wrapper); -#endif } } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt index 9502ee6a..8f9e4325 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.Properties.tt @@ -2,9 +2,7 @@ <#@ assembly name="System.Core" #> <#@ output extension=".g.cs"#> using System.Runtime.CompilerServices; -#if !NET6_OR_GREATER using System.Runtime.InteropServices; -#endif using ComputeSharp.Win32; namespace ComputeSharp.D2D1.Interop.Effects; @@ -12,26 +10,6 @@ namespace ComputeSharp.D2D1.Interop.Effects; /// unsafe partial struct PixelShaderEffect { -#if !NET6_0_OR_GREATER -<# -for (int i = 0; i < 16; i++) -{ -#> - /// - /// A cached instance wrapping . - /// - private static readonly PropertyGetFunctionDelegate GetResourceTextureManager<#=i#>Wrapper = GetResourceTextureManager<#=i#>Impl; - - /// - /// A cached instance wrapping . - /// - private static readonly PropertySetFunctionDelegate SetResourceTextureManager<#=i#>Wrapper = SetResourceTextureManager<#=i#>Impl; -<# - if (i < 15) WriteLine(""); -} -#> -#endif - <# for (int i = 0; i < 16; i++) { @@ -39,40 +17,24 @@ for (int i = 0; i < 16; i++) /// /// Gets the get accessor for the resource manager at index <#=i#>. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] GetResourceTextureManager<#=i#> -#else - public static void* GetResourceTextureManager<#=i#> -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &GetResourceTextureManager<#=i#>Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(GetResourceTextureManager<#=i#>Wrapper); -#endif } } /// /// Gets the set accessor for the resource manager at index <#=i#>. /// -#if NET6_0_OR_GREATER public static delegate* unmanaged[Stdcall] SetResourceTextureManager<#=i#> -#else - public static void* SetResourceTextureManager<#=i#> -#endif { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { -#if NET6_0_OR_GREATER return &SetResourceTextureManager<#=i#>Impl; -#else - return (void*)Marshal.GetFunctionPointerForDelegate(SetResourceTextureManager<#=i#>Wrapper); -#endif } } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs index eba06e98..3c411ee8 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/PixelShaderEffect.cs @@ -12,20 +12,6 @@ namespace ComputeSharp.D2D1.Interop.Effects; /// internal unsafe partial struct PixelShaderEffect { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(PixelShaderEffect* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(PixelShaderEffect* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(PixelShaderEffect* @this); -#endif - /// /// The shared vtable pointer for instance, for . /// @@ -45,24 +31,14 @@ internal unsafe partial struct PixelShaderEffect void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 14); // ID2D1EffectImpl -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&ID2D1EffectImplMethods.QueryInterface; lpVtbl[1] = (delegate* unmanaged)&ID2D1EffectImplMethods.AddRef; lpVtbl[2] = (delegate* unmanaged)&ID2D1EffectImplMethods.Release; lpVtbl[3] = (delegate* unmanaged)&ID2D1EffectImplMethods.Initialize; lpVtbl[4] = (delegate* unmanaged)&ID2D1EffectImplMethods.PrepareForRender; lpVtbl[5] = (delegate* unmanaged)&ID2D1EffectImplMethods.SetGraph; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.InitializeWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.PrepareForRenderWrapper); - lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1EffectImplMethods.SetGraphWrapper); -#endif // ID2D1DrawTransform -#if NET6_0_OR_GREATER lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1DrawTransformMethods.QueryInterface; lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1DrawTransformMethods.AddRef; lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1DrawTransformMethods.Release; @@ -71,16 +47,6 @@ internal unsafe partial struct PixelShaderEffect lpVtbl[6 + 5] = (delegate* unmanaged)&ID2D1DrawTransformMethods.MapInputRectsToOutputRect; lpVtbl[6 + 6] = (delegate* unmanaged)&ID2D1DrawTransformMethods.MapInvalidRect; lpVtbl[6 + 7] = (delegate* unmanaged)&ID2D1DrawTransformMethods.SetDrawInfo; -#else - lpVtbl[6 + 0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.QueryInterfaceWrapper); - lpVtbl[6 + 1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.AddRefWrapper); - lpVtbl[6 + 2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.ReleaseWrapper); - lpVtbl[6 + 3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.GetInputCountWrapper); - lpVtbl[6 + 4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.MapOutputRectToInputRectsWrapper); - lpVtbl[6 + 5] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.MapInputRectsToOutputRectWrapper); - lpVtbl[6 + 6] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.MapInvalidRectWrapper); - lpVtbl[6 + 7] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.SetDrawInfoWrapper); -#endif return lpVtbl; } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs index dd6ed705..b71c856a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManager.cs @@ -124,54 +124,6 @@ unsafe partial struct D2D1ResourceTextureManagerImpl /// private static class ID2D1ResourceTextureManagerMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int InitializeDelegate( - D2D1ResourceTextureManagerImpl* @this, - Guid* resourceId, - D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, - byte* data, - uint* strides, - uint dataSize); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int UpdateDelegate( - D2D1ResourceTextureManagerImpl* @this, - uint* minimumExtents, - uint* maximimumExtents, - uint* strides, - uint dimensions, - byte* data, - uint dataCount); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly InitializeDelegate InitializeWrapper = Initialize; - - /// - /// A cached instance wrapping . - /// - public static readonly UpdateDelegate UpdateWrapper = Update; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(D2D1ResourceTextureManagerImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs index 0255ea8a..4e31ccc5 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.ID2D1ResourceTextureManagerInternal.cs @@ -13,41 +13,6 @@ partial struct D2D1ResourceTextureManagerImpl /// private static unsafe class ID2D1ResourceTextureManagerInternalMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int InitializeDelegate(D2D1ResourceTextureManagerImpl* @this, ID2D1EffectContext* effectContext, uint* dimensions); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int GetResourceTextureDelegate(D2D1ResourceTextureManagerImpl* @this, ID2D1ResourceTexture** resourceTexture); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly InitializeDelegate InitializeWrapper = Initialize; - - /// - /// A cached instance wrapping . - /// - public static readonly GetResourceTextureDelegate GetResourceTextureWrapper = GetResourceTexture; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(D2D1ResourceTextureManagerImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs index 735978aa..83482269 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/D2D1ResourceTextureManagerImpl.cs @@ -12,20 +12,6 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; /// internal unsafe partial struct D2D1ResourceTextureManagerImpl { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(D2D1ResourceTextureManagerImpl* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(D2D1ResourceTextureManagerImpl* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(D2D1ResourceTextureManagerImpl* @this); -#endif - /// /// The shared vtable pointer for instance, for . /// @@ -45,34 +31,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.QueryInterface; lpVtbl[1] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.AddRef; lpVtbl[2] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Release; lpVtbl[3] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Initialize; lpVtbl[4] = (delegate* unmanaged)&ID2D1ResourceTextureManagerMethods.Update; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerMethods.QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerMethods.AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerMethods.ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerMethods.InitializeWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerMethods.UpdateWrapper); -#endif // ID2D1ResourceTextureManagerInternal -#if NET6_0_OR_GREATER lpVtbl[5 + 0] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.QueryInterface; lpVtbl[5 + 1] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.AddRef; lpVtbl[5 + 2] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.Release; lpVtbl[5 + 3] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.Initialize; lpVtbl[5 + 4] = (delegate* unmanaged)&ID2D1ResourceTextureManagerInternalMethods.GetResourceTexture; -#else - lpVtbl[5 + 0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.QueryInterfaceWrapper); - lpVtbl[5 + 1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.AddRefWrapper); - lpVtbl[5 + 2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.ReleaseWrapper); - lpVtbl[5 + 3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.InitializeWrapper); - lpVtbl[5 + 4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.GetResourceTextureWrapper); -#endif return lpVtbl; } diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs index 49bf8974..afceb039 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContex.cs @@ -12,50 +12,6 @@ partial struct D2D1DrawInfoUpdateContextImpl /// private static unsafe class ID2D1DrawInfoUpdateContextMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int GetConstantBufferSizeDelegate(D2D1DrawInfoUpdateContextImpl* @this, uint* size); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int GetConstantBufferDelegate(D2D1DrawInfoUpdateContextImpl* @this, byte* buffer, uint bufferCount); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int SetConstantBufferDelegate(D2D1DrawInfoUpdateContextImpl* @this, byte* buffer, uint bufferCount); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly GetConstantBufferSizeDelegate GetConstantBufferSizeWrapper = GetConstantBufferSize; - - /// - /// A cached instance wrapping . - /// - public static readonly GetConstantBufferDelegate GetConstantBufferWrapper = GetConstantBuffer; - - /// - /// A cached instance wrapping . - /// - public static readonly SetConstantBufferDelegate SetConstantBufferWrapper = SetConstantBuffer; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(D2D1DrawInfoUpdateContextImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs index 13e11c6c..9063310e 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.ID2D1DrawInfoUpdateContexInternal.cs @@ -20,32 +20,6 @@ unsafe partial struct D2D1DrawInfoUpdateContextImpl /// private static class ID2D1DrawInfoUpdateContextInternalMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int CloseDelegate(D2D1DrawInfoUpdateContextImpl* @this); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly CloseDelegate CloseWrapper = Close; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(D2D1DrawInfoUpdateContextImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs index 55ee583f..b9a7272a 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1DrawInfoUpdateContextImpl.cs @@ -12,20 +12,6 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers; /// internal unsafe partial struct D2D1DrawInfoUpdateContextImpl { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(D2D1DrawInfoUpdateContextImpl* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(D2D1DrawInfoUpdateContextImpl* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(D2D1DrawInfoUpdateContextImpl* @this); -#endif - /// /// The shared vtable pointer for instance, for . /// @@ -45,34 +31,18 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.QueryInterface; lpVtbl[1] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.AddRef; lpVtbl[2] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.Release; lpVtbl[3] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.GetConstantBufferSize; lpVtbl[4] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.GetConstantBuffer; lpVtbl[5] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextMethods.SetConstantBuffer; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.GetConstantBufferSizeWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.GetConstantBufferWrapper); - lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextMethods.SetConstantBufferWrapper); -#endif // ID2D1ResourceTextureManagerInternal -#if NET6_0_OR_GREATER lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.QueryInterface; lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.AddRef; lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.Release; lpVtbl[6 + 3] = (delegate* unmanaged)&ID2D1DrawInfoUpdateContextInternalMethods.Close; -#else - lpVtbl[6 + 0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextInternalMethods.QueryInterfaceWrapper); - lpVtbl[6 + 1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextInternalMethods.AddRefWrapper); - lpVtbl[6 + 2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextInternalMethods.ReleaseWrapper); - lpVtbl[6 + 3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawInfoUpdateContextInternalMethods.CloseWrapper); -#endif return lpVtbl; } 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 f1c2652a..d86241e0 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapper.cs @@ -16,65 +16,6 @@ unsafe partial struct D2D1TransformMapperImpl /// private static class ID2D1TransformMapperMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapInputRectsToOutputRectDelegate( - D2D1TransformMapperImpl* @this, - ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext, - RECT* inputRects, - RECT* inputOpaqueSubRects, - uint inputRectCount, - RECT* outputRect, - RECT* outputOpaqueSubRect); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapOutputRectToInputRectsDelegate( - D2D1TransformMapperImpl* @this, - RECT* outputRect, - RECT* inputRects, - uint inputRectsCount); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int MapInvalidRectDelegate( - D2D1TransformMapperImpl* @this, - uint inputIndex, - RECT invalidInputRect, - RECT* invalidOutputRect); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect; - - /// - /// A cached instance wrapping . - /// - public static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects; - - /// - /// A cached instance wrapping . - /// - public static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect; -#endif - /// [UnmanagedCallersOnly] public static int QueryInterface(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs index 8d5d355e..0eb493bb 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.ID2D1TransformMapperInternal.cs @@ -12,32 +12,6 @@ unsafe partial struct D2D1TransformMapperImpl /// private static class ID2D1TransformMapperInternalMethods { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int GetManagedWrapperHandleDelegate(D2D1TransformMapperImpl* @this, void** ppvHandle); - - /// - /// A cached instance wrapping . - /// - public static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - public static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - public static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - public static readonly GetManagedWrapperHandleDelegate GetManagedWrapperHandleWrapper = GetManagedWrapperHandle; -#endif - /// [UnmanagedCallersOnly] public 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 e146cc65..d6177ae8 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMappers/D2D1TransformMapperImpl.cs @@ -14,20 +14,6 @@ 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); -#endif - /// /// The shared vtable pointer for instance, for . /// @@ -47,34 +33,18 @@ internal unsafe partial struct D2D1TransformMapperImpl void** lpVtbl = (void**)D2D1AssemblyAssociatedMemory.Allocate(sizeof(void*) * 10); // ID2D1ResourceTextureManager -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&ID2D1TransformMapperMethods.QueryInterface; lpVtbl[1] = (delegate* unmanaged)&ID2D1TransformMapperMethods.AddRef; lpVtbl[2] = (delegate* unmanaged)&ID2D1TransformMapperMethods.Release; lpVtbl[3] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapInputRectsToOutputRect; lpVtbl[4] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapOutputRectToInputRects; lpVtbl[5] = (delegate* unmanaged)&ID2D1TransformMapperMethods.MapInvalidRect; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.MapInputRectsToOutputRectWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.MapOutputRectToInputRectsWrapper); - lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperMethods.MapInvalidRectWrapper); -#endif // ID2D1TransformMapperInternal -#if NET6_0_OR_GREATER lpVtbl[6 + 0] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.QueryInterface; lpVtbl[6 + 1] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.AddRef; lpVtbl[6 + 2] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.Release; lpVtbl[6 + 3] = (delegate* unmanaged)&ID2D1TransformMapperInternalMethods.GetManagedWrapperHandle; -#else - lpVtbl[6 + 0] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperInternalMethods.QueryInterfaceWrapper); - lpVtbl[6 + 1] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperInternalMethods.AddRefWrapper); - lpVtbl[6 + 2] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperInternalMethods.ReleaseWrapper); - lpVtbl[6 + 3] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1TransformMapperInternalMethods.GetManagedWrapperHandleWrapper); -#endif return lpVtbl; } 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 13eaef7a..d53395cd 100644 --- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs +++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1_1/ID2D1Factory1.cs @@ -20,15 +20,8 @@ internal unsafe partial struct ID2D1Factory1 [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(23)] -#if NET6_0_OR_GREATER - public HRESULT RegisterEffectFromString([NativeTypeName("const IID &")] Guid* classId, [NativeTypeName("PCWSTR")] ushort* propertyXml, [NativeTypeName("const D2D1_PROPERTY_BINDING *")] D2D1_PROPERTY_BINDING* bindings, [NativeTypeName("UINT32")] uint bindingsCount, [NativeTypeName("const PD2D1_EFFECT_FACTORY")] delegate* unmanaged[Stdcall] effectFactory) + public HRESULT RegisterEffectFromString([NativeTypeName("const IID &")] Guid* classId, [NativeTypeName("PCWSTR")] ushort* propertyXml, [NativeTypeName("const D2D1_PROPERTY_BINDING *")] D2D1_PROPERTY_BINDING* bindings, [NativeTypeName("UINT32")] uint bindingsCount, [NativeTypeName("const PD2D1_EFFECT_FACTORY")] delegate* unmanaged effectFactory) { - return ((delegate* unmanaged[Stdcall], int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory); + return ((delegate* unmanaged, int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory); } -#else - public HRESULT RegisterEffectFromString([NativeTypeName("const IID &")] Guid* classId, [NativeTypeName("PCWSTR")] ushort* propertyXml, [NativeTypeName("const D2D1_PROPERTY_BINDING *")] D2D1_PROPERTY_BINDING* bindings, [NativeTypeName("UINT32")] uint bindingsCount, [NativeTypeName("const PD2D1_EFFECT_FACTORY")] void* effectFactory) - { - return ((delegate* unmanaged[Stdcall])(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory); - } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs index a799799c..cfb91870 100644 --- a/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs +++ b/src/ComputeSharp.Win32.D2D1/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs @@ -13,16 +13,8 @@ internal unsafe partial struct D2D1_PROPERTY_BINDING public ushort* propertyName; [NativeTypeName("PD2D1_PROPERTY_SET_FUNCTION")] -#if NET6_0_OR_GREATER public delegate* unmanaged[Stdcall] setFunction; -#else - public void* setFunction; -#endif [NativeTypeName("PD2D1_PROPERTY_GET_FUNCTION")] -#if NET6_0_OR_GREATER public delegate* unmanaged[Stdcall] getFunction; -#else - public void* getFunction; -#endif } \ No newline at end of file