diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManager.cs new file mode 100644 index 00000000..a7a63b0a --- /dev/null +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManager.cs @@ -0,0 +1,138 @@ +using System; +using System.Runtime.InteropServices; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +#if !NET6_0_OR_GREATER +using UnmanagedCallersOnlyAttribute = ComputeSharp.NetStandard.System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute; +#endif + +namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; + +/// +partial struct ResourceTextureManager +{ + /// + /// The implementation for ID2D1ResourceTextureManager. + /// + private static unsafe class ID2D1ResourceTextureManagerMethods + { +#if !NET6_0_OR_GREATER + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate int CreateResourceTextureDelegate( + ResourceTextureManager* @this, + Guid* resourceId, + D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, + byte* data, + uint* strides, + uint dataSize); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate int UpdateDelegate( + ResourceTextureManager* @this, + uint* minimumExtents, + uint* maximumExtents, + 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 CreateResourceTextureDelegate CreateResourceTextureWrapper = CreateResourceTexture; + + /// + /// A cached instance wrapping . + /// + public static readonly UpdateDelegate UpdateWrapper = Update; +#endif + + /// + [UnmanagedCallersOnly] + public static int QueryInterface(ResourceTextureManager* @this, Guid* riid, void** ppvObject) + { + return @this->QueryInterface(riid, ppvObject); + } + + /// + [UnmanagedCallersOnly] + public static uint AddRef(ResourceTextureManager* @this) + { + return @this->AddRef(); + } + + /// + [UnmanagedCallersOnly] + public static uint Release(ResourceTextureManager* @this) + { + return @this->Release(); + } + + /// + /// Creates or finds the given resource texture, depending on whether a resource id is specified. + /// It also optionally initializes the texture with the specified data. + /// + /// The current ID2D1ResourceTextureManager instance. + /// An optional pointer to the unique id that identifies the resource texture. + /// The properties used to create the resource texture. + /// The optional data to be loaded into the resource texture. + /// An optional pointer to the stride to advance through the resource texture, according to dimension. + /// The size, in bytes, of the data. + /// An for the operation. + private static int CreateResourceTexture( + ResourceTextureManager* @this, + Guid* resourceId, + D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, + byte* data, + uint* strides, + uint dataSize) + { + @this = (ResourceTextureManager*)&((void**)@this)[-1]; + + return 0; + } + + /// + /// Updates the specific resource texture inside the specific range or box using the supplied data. + /// + /// The current ID2D1ResourceTextureManager instance. + /// The "left" extent of the updates if specified. If , the entire texture is updated. + /// The "right" extent of the updates if specified. If , the entire texture is updated. + /// The stride to advance through the input data, according to dimension. + /// The number of dimensions in the resource texture. This must match the number used to load the texture. + /// The data to be placed into the resource texture. + /// The size of the data buffer to be used to update the resource texture. + /// An for the operation. + [UnmanagedCallersOnly] + private static int Update( + ResourceTextureManager* @this, + uint* minimumExtents, + uint* maximumExtents, + uint* strides, + uint dimensions, + byte* data, + uint dataCount) + { + @this = (ResourceTextureManager*)&((void**)@this)[-1]; + + return 0; + } + } +} diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManagerInternal.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManagerInternal.cs new file mode 100644 index 00000000..00c1307a --- /dev/null +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.ID2D1ResourceTextureManagerInternal.cs @@ -0,0 +1,105 @@ +using System; +using System.Runtime.InteropServices; +using TerraFX.Interop.DirectX; +using TerraFX.Interop.Windows; +#if !NET6_0_OR_GREATER +using UnmanagedCallersOnlyAttribute = ComputeSharp.NetStandard.System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute; +#endif + +namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; + +/// +partial struct ResourceTextureManager +{ + /// + /// The implementation for ID2D1ResourceTextureManagerInternal. + /// + private unsafe static class ID2D1ResourceTextureManagerInternalMethods + { +#if !NET6_0_OR_GREATER + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate int InitializeDelegate(ResourceTextureManager* @this, ID2D1EffectContext* effectContext); + + /// + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate int GetResourceTextureDelegate(ResourceTextureManager* @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(ResourceTextureManager* @this, Guid* riid, void** ppvObject) + { + @this = (ResourceTextureManager*)&((void**)@this)[-1]; + + return @this->QueryInterface(riid, ppvObject); + } + + /// + [UnmanagedCallersOnly] + public static uint AddRef(ResourceTextureManager* @this) + { + @this = (ResourceTextureManager*)&((void**)@this)[-1]; + + return @this->AddRef(); + } + + /// + [UnmanagedCallersOnly] + public static uint Release(ResourceTextureManager* @this) + { + @this = (ResourceTextureManager*)&((void**)@this)[-1]; + + return @this->Release(); + } + + /// + /// Initializes the current ID2D1ResourceTextureManagerInternal instance. + /// + /// The current ID2D1ResourceTextureManagerInternal instance. + /// The input for the manager. + /// An for the operation. + [UnmanagedCallersOnly] + private static int Initialize(ResourceTextureManager* @this, ID2D1EffectContext* effectContext) + { + return 0; + } + + /// + /// Gets the instance held by the manager. + /// + /// The current ID2D1ResourceTextureManagerInternal instance. + /// The resulting instance. + /// An for the operation. + [UnmanagedCallersOnly] + private static int GetResourceTexture(ResourceTextureManager* @this, ID2D1ResourceTexture** resourceTexture) + { + return 0; + } + } +} diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.cs index 73a20114..08c3d06b 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/ResourceManagers/ResourceTextureManager.cs @@ -2,13 +2,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; -using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; #if NET6_0_OR_GREATER using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers; #else using RuntimeHelpers = ComputeSharp.D2D1.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers; -using UnmanagedCallersOnlyAttribute = ComputeSharp.NetStandard.System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute; #endif namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; @@ -16,7 +14,7 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; /// /// An implementation of the ID2D1ResourceTextureManager and ID2D1ResourceTextureManagerInternal interfaces. /// -internal unsafe struct ResourceTextureManager +internal unsafe partial struct ResourceTextureManager { /// /// Gets the for ID2D1ResourceTextureManager (3C4FC7E4-A419-46CA-B5F6-66EB4FF18D64). @@ -187,221 +185,4 @@ internal unsafe struct ResourceTextureManager return referenceCount; } - - /// - /// The implementation for ID2D1ResourceTextureManager. - /// - private static class ID2D1ResourceTextureManagerMethods - { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int CreateResourceTextureDelegate( - ResourceTextureManager* @this, - Guid* resourceId, - D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, - byte* data, - uint* strides, - uint dataSize); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int UpdateDelegate( - ResourceTextureManager* @this, - uint* minimumExtents, - uint* maximumExtents, - 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 CreateResourceTextureDelegate CreateResourceTextureWrapper = CreateResourceTexture; - - /// - /// A cached instance wrapping . - /// - public static readonly UpdateDelegate UpdateWrapper = Update; -#endif - - /// - [UnmanagedCallersOnly] - public static int QueryInterface(ResourceTextureManager* @this, Guid* riid, void** ppvObject) - { - return @this->QueryInterface(riid, ppvObject); - } - - /// - [UnmanagedCallersOnly] - public static uint AddRef(ResourceTextureManager* @this) - { - return @this->AddRef(); - } - - /// - [UnmanagedCallersOnly] - public static uint Release(ResourceTextureManager* @this) - { - return @this->Release(); - } - - /// - /// Creates or finds the given resource texture, depending on whether a resource id is specified. - /// It also optionally initializes the texture with the specified data. - /// - /// The current ID2D1ResourceTextureManager instance. - /// An optional pointer to the unique id that identifies the resource texture. - /// The properties used to create the resource texture. - /// The optional data to be loaded into the resource texture. - /// An optional pointer to the stride to advance through the resource texture, according to dimension. - /// The size, in bytes, of the data. - /// An for the operation. - private static int CreateResourceTexture( - ResourceTextureManager* @this, - Guid* resourceId, - D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, - byte* data, - uint* strides, - uint dataSize) - { - @this = (ResourceTextureManager*)&((void**)@this)[-1]; - - return 0; - } - - /// - /// Updates the specific resource texture inside the specific range or box using the supplied data. - /// - /// The current ID2D1ResourceTextureManager instance. - /// The "left" extent of the updates if specified. If , the entire texture is updated. - /// The "right" extent of the updates if specified. If , the entire texture is updated. - /// The stride to advance through the input data, according to dimension. - /// The number of dimensions in the resource texture. This must match the number used to load the texture. - /// The data to be placed into the resource texture. - /// The size of the data buffer to be used to update the resource texture. - /// An for the operation. - [UnmanagedCallersOnly] - private static int Update( - ResourceTextureManager* @this, - uint* minimumExtents, - uint* maximumExtents, - uint* strides, - uint dimensions, - byte* data, - uint dataCount) - { - @this = (ResourceTextureManager*)&((void**)@this)[-1]; - - return 0; - } - } - - /// - /// The implementation for ID2D1ResourceTextureManagerInternal. - /// - private unsafe static class ID2D1ResourceTextureManagerInternalMethods - { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int InitializeDelegate(ResourceTextureManager* @this, ID2D1EffectContext* effectContext); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate int GetResourceTextureDelegate(ResourceTextureManager* @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(ResourceTextureManager* @this, Guid* riid, void** ppvObject) - { - @this = (ResourceTextureManager*)&((void**)@this)[-1]; - - return @this->QueryInterface(riid, ppvObject); - } - - /// - [UnmanagedCallersOnly] - public static uint AddRef(ResourceTextureManager* @this) - { - @this = (ResourceTextureManager*)&((void**)@this)[-1]; - - return @this->AddRef(); - } - - /// - [UnmanagedCallersOnly] - public static uint Release(ResourceTextureManager* @this) - { - @this = (ResourceTextureManager*)&((void**)@this)[-1]; - - return @this->Release(); - } - - /// - /// Initializes the current ID2D1ResourceTextureManagerInternal instance. - /// - /// The current ID2D1ResourceTextureManagerInternal instance. - /// The input for the manager. - /// An for the operation. - [UnmanagedCallersOnly] - private static int Initialize(ResourceTextureManager* @this, ID2D1EffectContext* effectContext) - { - return 0; - } - - /// - /// Gets the instance held by the manager. - /// - /// The current ID2D1ResourceTextureManagerInternal instance. - /// The resulting instance. - /// An for the operation. - [UnmanagedCallersOnly] - private static int GetResourceTexture(ResourceTextureManager* @this, ID2D1ResourceTexture** resourceTexture) - { - return 0; - } - } }