using TerraFX.Interop;
using static TerraFX.Interop.DXGI_ADAPTER_FLAG;
namespace ComputeSharp.Graphics
{
///
/// A type containing info on a given DX12.0 device that can be used.
///
public readonly struct GraphicsDeviceInfo
{
///
/// Creates a new instance with the specified parameters.
///
/// The available info for the associate device.
internal unsafe GraphicsDeviceInfo(DXGI_ADAPTER_DESC1* dxgiDescription1)
{
Luid = Luid.FromLUID(dxgiDescription1->AdapterLuid);
Name = new string((char*)dxgiDescription1->Description);
DedicatedMemorySize = dxgiDescription1->DedicatedVideoMemory;
SharedMemorySize = dxgiDescription1->SharedSystemMemory;
IsHardwareAccelerated = (dxgiDescription1->Flags & (uint)DXGI_ADAPTER_FLAG_SOFTWARE) == 0;
}
///
/// Gets the locally unique identifier for the current device.
///
public Luid Luid { get; }
///
/// Gets the name of the associated device.
///
public string Name { get; }
///
/// Gets the size of the dedicated memory for the associated device.
///
public nuint DedicatedMemorySize { get; }
///
/// Gets the size of the shared system memory for the associated device.
///
public nuint SharedMemorySize { get; }
///
/// Gets whether or not the associated device is hardware accelerated.
/// This value is for software fallback devices.
///
public bool IsHardwareAccelerated { get; }
}
}