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. [UnmanagedCallersOnly] public 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] public static int Update( ResourceTextureManager* @this, uint* minimumExtents, uint* maximumExtents, uint* strides, uint dimensions, byte* data, uint dataCount) { @this = (ResourceTextureManager*)&((void**)@this)[-1]; return 0; } } }