// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

namespace Win32.Graphics.Direct2D;

/// <include file='../Direct2D.xml' path='doc/member[@name="ID2D1Device"]/*' />
/// <unmanaged>ID2D1Device</unmanaged>
[Guid("47dd575d-ac05-4cdd-8049-9b02cd16f44c")]
[NativeTypeName("struct ID2D1Device : ID2D1Resource")]
[NativeInheritance("ID2D1Resource")]
public unsafe partial struct ID2D1Device : ID2D1Device.Interface, INativeGuid
{
	public static ref readonly Guid IID_ID2D1Device
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		get
		{
			ReadOnlySpan<byte> data = new byte[] {
				0x5D, 0x57, 0xDD, 0x47,
				0x05, 0xAC,
				0xDD, 0x4C,
				0x80,
				0x49,
				0x9B,
				0x02,
				0xCD,
				0x16,
				0xF4,
				0x4C
			};

			Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
			return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
		}
	}

#if NET6_0_OR_GREATER
	static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_ID2D1Device));
#else
	public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_ID2D1Device));
#endif

	public void** lpVtbl;

	/// <inheritdoc cref="IUnknown.QueryInterface" />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(0)]
	public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
	{
		return ((delegate* unmanaged[Stdcall]<ID2D1Device*, Guid*, void**, int>)(lpVtbl[0]))((ID2D1Device*)Unsafe.AsPointer(ref this), riid, ppvObject);
	}

	/// <inheritdoc cref="IUnknown.AddRef" />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(1)]
	[return: NativeTypeName("ULONG")]
	public uint AddRef()
	{
		return ((delegate* unmanaged[Stdcall]<ID2D1Device*, uint>)(lpVtbl[1]))((ID2D1Device*)Unsafe.AsPointer(ref this));
	}

	/// <inheritdoc cref="IUnknown.Release" />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(2)]
	[return: NativeTypeName("ULONG")]
	public uint Release()
	{
		return ((delegate* unmanaged[Stdcall]<ID2D1Device*, uint>)(lpVtbl[2]))((ID2D1Device*)Unsafe.AsPointer(ref this));
	}

	/// <inheritdoc cref="ID2D1Resource.GetFactory" />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(3)]
	public void GetFactory(ID2D1Factory** factory)
	{
		((delegate* unmanaged[Stdcall]<ID2D1Device*, ID2D1Factory**, void>)(lpVtbl[3]))((ID2D1Device*)Unsafe.AsPointer(ref this), factory);
	}

	/// <include file='../Direct2D.xml' path='doc/member[@name="ID2D1Device::CreateDeviceContext"]/*' />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(4)]
	public HResult CreateDeviceContext(DeviceContextOptions options, ID2D1DeviceContext** deviceContext)
	{
		return ((delegate* unmanaged[Stdcall]<ID2D1Device*, DeviceContextOptions, ID2D1DeviceContext**, int>)(lpVtbl[4]))((ID2D1Device*)Unsafe.AsPointer(ref this), options, deviceContext);
	}

	/// <include file='../Direct2D.xml' path='doc/member[@name="ID2D1Device::SetMaximumTextureMemory"]/*' />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(5)]
	public void SetMaximumTextureMemory(ulong maximumInBytes)
	{
		((delegate* unmanaged[Stdcall]<ID2D1Device*, ulong, void>)(lpVtbl[5]))((ID2D1Device*)Unsafe.AsPointer(ref this), maximumInBytes);
	}

	/// <include file='../Direct2D.xml' path='doc/member[@name="ID2D1Device::GetMaximumTextureMemory"]/*' />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(6)]
	public ulong GetMaximumTextureMemory()
	{
		return ((delegate* unmanaged[Stdcall]<ID2D1Device*, ulong>)(lpVtbl[6]))((ID2D1Device*)Unsafe.AsPointer(ref this));
	}

	/// <include file='../Direct2D.xml' path='doc/member[@name="ID2D1Device::ClearResources"]/*' />
	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	[VtblIndex(7)]
	public void ClearResources(uint millisecondsSinceUse)
	{
		((delegate* unmanaged[Stdcall]<ID2D1Device*, uint, void>)(lpVtbl[7]))((ID2D1Device*)Unsafe.AsPointer(ref this), millisecondsSinceUse);
	}
	public interface Interface : ID2D1Resource.Interface
	{
		[VtblIndex(4)]
		HResult CreateDeviceContext(DeviceContextOptions options, ID2D1DeviceContext** deviceContext);

		[VtblIndex(5)]
		void SetMaximumTextureMemory(ulong maximumInBytes);

		[VtblIndex(6)]
		ulong GetMaximumTextureMemory();

		[VtblIndex(7)]
		void ClearResources(uint millisecondsSinceUse);
	}
}

