forked from Sergio0694/ComputeSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphicsDeviceInfo.cs
More file actions
50 lines (44 loc) · 1.84 KB
/
GraphicsDeviceInfo.cs
File metadata and controls
50 lines (44 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using TerraFX.Interop;
using static TerraFX.Interop.DXGI_ADAPTER_FLAG;
namespace ComputeSharp
{
/// <summary>
/// A type containing info on a given DX12.0 device that can be used.
/// </summary>
public readonly struct GraphicsDeviceInfo
{
/// <summary>
/// Creates a new <see cref="GraphicsDeviceInfo"/> instance with the specified parameters.
/// </summary>
/// <param name="dxgiDescription1">The available info for the associated device.</param>
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;
}
/// <summary>
/// Gets the locally unique identifier for the current device.
/// </summary>
public Luid Luid { get; }
/// <summary>
/// Gets the name of the associated device.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the size of the dedicated memory for the associated device.
/// </summary>
public nuint DedicatedMemorySize { get; }
/// <summary>
/// Gets the size of the shared system memory for the associated device.
/// </summary>
public nuint SharedMemorySize { get; }
/// <summary>
/// Gets whether or not the associated device is hardware accelerated.
/// This value is <see langword="false"/> for software fallback devices.
/// </summary>
public bool IsHardwareAccelerated { get; }
}
}