From 0847e45219ff592fce71bec8084b9ca8e308625d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 30 Oct 2022 20:39:02 +0100 Subject: [PATCH] Add ID2D1DrawInfoUpdateContex binding type --- .../ID2D1DrawInfoUpdateContex.cs | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMapperManagers/ID2D1DrawInfoUpdateContex.cs diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMapperManagers/ID2D1DrawInfoUpdateContex.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMapperManagers/ID2D1DrawInfoUpdateContex.cs new file mode 100644 index 00000000..29af18af --- /dev/null +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Effects/TransformMapperManagers/ID2D1DrawInfoUpdateContex.cs @@ -0,0 +1,87 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using TerraFX.Interop.Windows; + +#pragma warning disable CS0649 + +namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMapperManagers; + +/// +/// The updater for type to use with built-in effects. +/// +[Guid("430C5B40-AE16-485F-90E6-4FA4915144B6")] +internal unsafe struct ID2D1DrawInfoUpdateContex +{ + /// + /// Gets the for (430C5B40-AE16-485F-90E6-4FA4915144B6). + /// + public static ref readonly Guid Guid + { + get + { + ReadOnlySpan data = new byte[] { + 0x43, 0x0C, 0x5B, 0x40, + 0xAE, 0x16, + 0x48, 0x5F, + 0x90, 0xE6, + 0x4F, + 0xA4, + 0x91, + 0x51, + 0x44, + 0xB6 + }; + + return ref Unsafe.As(ref MemoryMarshal.GetReference(data)); + } + } + + /// + /// The vtable for the current instance. + /// + private readonly void** lpVtbl; + + /// + /// Retrieves the size of the constant buffer for the current effect. + /// + /// The resulting size of the constant buffer. + /// An for the operation. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public HRESULT GetConstantBufferSize(uint* size) + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[3])( + (ID2D1DrawInfoUpdateContex*)Unsafe.AsPointer(ref this), + size); + } + + /// + /// Retrieves the constant buffer data for the current effect. + /// + /// A pointer to the buffer to fill with the constant buffer data. + /// The size of the buffer provided through . + /// An for the operation. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public HRESULT GetConstantBuffer(byte* buffer, uint bufferCount) + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[4])( + (ID2D1DrawInfoUpdateContex*)Unsafe.AsPointer(ref this), + buffer, + bufferCount); + } + + /// + /// Sets the constant buffer data for the current effect. + /// + /// A pointer to the constant buffer data to use to update the effect. + /// The size of the buffer provided through . + /// An for the operation. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public HRESULT SetConstantBuffer(byte* buffer, uint bufferCount) + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[5])( + (ID2D1DrawInfoUpdateContex*)Unsafe.AsPointer(ref this), + buffer, + bufferCount); + } +} \ No newline at end of file