using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using ComputeSharp.Win32; #pragma warning disable CS0649, IDE0055 namespace ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers; /// /// The resource texture manager type to use with built-in effects. /// internal unsafe struct ID2D1ResourceTextureManager : IComObject { /// static Guid* IComObject.IID { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { ReadOnlySpan data = [ 0xE4, 0xC7, 0x4F, 0x3C, 0x19, 0xA4, 0xCA, 0x46, 0xB5, 0xF6, 0x66, 0xEB, 0x4F, 0xF1, 0x8D, 0x64 ]; return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data)); } } /// /// The vtable for the current instance. /// private readonly void** lpVtbl; /// /// 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. /// /// 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. [MethodImpl(MethodImplOptions.AggressiveInlining)] public HRESULT Initialize( Guid* resourceId, D2D1_RESOURCE_TEXTURE_PROPERTIES* resourceTextureProperties, byte* data, uint* strides, uint dataSize) { return ((delegate* unmanaged[Stdcall])this.lpVtbl[3])( (ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this), resourceId, resourceTextureProperties, data, strides, dataSize); } /// /// Updates the specific resource texture inside the specific range or box using the supplied data. /// /// 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. [MethodImpl(MethodImplOptions.AggressiveInlining)] public HRESULT Update( uint* minimumExtents, uint* maximimumExtents, uint* strides, uint dimensions, byte* data, uint dataCount) { return ((delegate* unmanaged[Stdcall])this.lpVtbl[4])( (ID2D1ResourceTextureManager*)Unsafe.AsPointer(ref this), minimumExtents, maximimumExtents, strides, dimensions, data, dataCount); } }