Experimental GPU overclock

This commit is contained in:
Serge
2023-05-06 14:40:52 +02:00
parent 8e1099545a
commit c61f4d1608
497 changed files with 46937 additions and 232 deletions

View File

@@ -0,0 +1,15 @@
using System;
namespace NvAPIWrapper.Native.Attributes
{
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Delegate)]
internal class AcceptsAttribute : Attribute
{
public AcceptsAttribute(params Type[] types)
{
Types = types;
}
public Type[] Types { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Attributes
{
[AttributeUsage(AttributeTargets.Delegate)]
internal class FunctionIdAttribute : Attribute
{
public FunctionIdAttribute(FunctionId functionId)
{
FunctionId = functionId;
}
public FunctionId FunctionId { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
namespace NvAPIWrapper.Native.Attributes
{
[AttributeUsage(AttributeTargets.Struct)]
internal class StructureVersionAttribute : Attribute
{
public StructureVersionAttribute()
{
}
public StructureVersionAttribute(int versionNumber)
{
VersionNumber = versionNumber;
}
public int VersionNumber { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace NvAPIWrapper.Native.Constants
{
internal static class Display
{
public const int AdvancedDisplayHeads = 4;
public const int MaxDisplayHeads = 2;
}
}

View File

@@ -0,0 +1,8 @@
namespace NvAPIWrapper.Native.Constants
{
internal static class General
{
public const int BinaryDataMax = 4096;
public const int UnicodeStringLength = 2048;
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.DRS
{
/// <summary>
/// Holds possible values for the setting location
/// </summary>
public enum DRSSettingLocation : uint
{
/// <summary>
/// Setting is part of the current profile
/// </summary>
CurrentProfile = 0,
/// <summary>
/// Setting is part of the global profile
/// </summary>
GlobalProfile,
/// <summary>
/// Setting is part of the base profile
/// </summary>
BaseProfile,
/// <summary>
/// Setting is part of the default profile
/// </summary>
DefaultProfile
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.DRS
{
/// <summary>
/// Holds a list of possible setting value types
/// </summary>
public enum DRSSettingType : uint
{
/// <summary>
/// Integer value type
/// </summary>
Integer = 0,
/// <summary>
/// Binary value type
/// </summary>
Binary,
/// <summary>
/// ASCII string value type
/// </summary>
String,
/// <summary>
/// Unicode string value type
/// </summary>
UnicodeString
}
}

View File

@@ -0,0 +1,77 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <inheritdoc cref="IDRSApplication" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct DRSApplicationV1 : IInitializable, IDRSApplication
{
internal StructureVersion _Version;
internal uint _IsPredefined;
internal UnicodeString _ApplicationName;
internal UnicodeString _FriendlyName;
internal UnicodeString _LauncherName;
/// <summary>
/// Creates a new instance of <see cref="DRSApplicationV1" />
/// </summary>
/// <param name="applicationName">The application file name.</param>
/// <param name="friendlyName">The application friendly name.</param>
/// <param name="launcherName">The application launcher name.</param>
public DRSApplicationV1(
string applicationName,
string friendlyName = null,
string launcherName = null
)
{
this = typeof(DRSApplicationV1).Instantiate<DRSApplicationV1>();
IsPredefined = false;
ApplicationName = applicationName;
FriendlyName = friendlyName ?? string.Empty;
LauncherName = launcherName ?? string.Empty;
}
/// <inheritdoc />
public bool IsPredefined
{
get => _IsPredefined > 0;
private set => _IsPredefined = value ? 1u : 0u;
}
/// <inheritdoc />
public string ApplicationName
{
get => _ApplicationName.Value;
private set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Name can not be empty or null.");
}
_ApplicationName = new UnicodeString(value);
}
}
/// <inheritdoc />
public string FriendlyName
{
get => _FriendlyName.Value;
private set => _FriendlyName = new UnicodeString(value);
}
/// <inheritdoc />
public string LauncherName
{
get => _LauncherName.Value;
private set => _LauncherName = new UnicodeString(value);
}
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <inheritdoc cref="IDRSApplication" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(2)]
public struct DRSApplicationV2 : IInitializable, IDRSApplication
{
internal const char FileInFolderSeparator = ':';
internal StructureVersion _Version;
internal uint _IsPredefined;
internal UnicodeString _ApplicationName;
internal UnicodeString _FriendlyName;
internal UnicodeString _LauncherName;
internal UnicodeString _FileInFolder;
/// <summary>
/// Creates a new instance of <see cref="DRSApplicationV2" />
/// </summary>
/// <param name="applicationName">The application file name.</param>
/// <param name="friendlyName">The application friendly name.</param>
/// <param name="launcherName">The application launcher name.</param>
/// <param name="fileInFolders">The list of files that are necessary to be present in the application parent directory.</param>
// ReSharper disable once TooManyDependencies
public DRSApplicationV2(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null
)
{
this = typeof(DRSApplicationV2).Instantiate<DRSApplicationV2>();
IsPredefined = false;
ApplicationName = applicationName;
FriendlyName = friendlyName ?? string.Empty;
LauncherName = launcherName ?? string.Empty;
FilesInFolder = fileInFolders ?? new string[0];
}
/// <inheritdoc />
public bool IsPredefined
{
get => _IsPredefined > 0;
private set => _IsPredefined = value ? 1u : 0u;
}
/// <inheritdoc />
public string ApplicationName
{
get => _ApplicationName.Value;
private set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Name can not be empty or null.");
}
_ApplicationName = new UnicodeString(value);
}
}
/// <inheritdoc />
public string FriendlyName
{
get => _FriendlyName.Value;
private set => _FriendlyName = new UnicodeString(value);
}
/// <inheritdoc />
public string LauncherName
{
get => _LauncherName.Value;
private set => _LauncherName = new UnicodeString(value);
}
/// <summary>
/// Gets the list of files that are necessary to be present in the application parent directory.
/// </summary>
public string[] FilesInFolder
{
get => _FileInFolder.Value?.Split(new[] {FileInFolderSeparator}, StringSplitOptions.RemoveEmptyEntries) ??
new string[0];
private set => _FileInFolder = new UnicodeString(string.Join(FileInFolderSeparator.ToString(), value));
}
}
}

View File

@@ -0,0 +1,114 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <inheritdoc cref="IDRSApplication" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(3)]
public struct DRSApplicationV3 : IInitializable, IDRSApplication
{
internal const char FileInFolderSeparator = DRSApplicationV2.FileInFolderSeparator;
internal StructureVersion _Version;
internal uint _IsPredefined;
internal UnicodeString _ApplicationName;
internal UnicodeString _FriendlyName;
internal UnicodeString _LauncherName;
internal UnicodeString _FileInFolder;
internal uint _Flags;
/// <summary>
/// Creates a new instance of <see cref="DRSApplicationV3" />
/// </summary>
/// <param name="applicationName">The application file name.</param>
/// <param name="friendlyName">The application friendly name.</param>
/// <param name="launcherName">The application launcher name.</param>
/// <param name="fileInFolders">The list of files that are necessary to be present in the application parent directory.</param>
/// <param name="isMetro">A boolean value indicating if this application is a metro application.</param>
// ReSharper disable once TooManyDependencies
public DRSApplicationV3(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false
)
{
this = typeof(DRSApplicationV3).Instantiate<DRSApplicationV3>();
IsPredefined = false;
ApplicationName = applicationName;
FriendlyName = friendlyName ?? string.Empty;
LauncherName = launcherName ?? string.Empty;
FilesInFolder = fileInFolders ?? new string[0];
IsMetroApplication = isMetro;
}
/// <inheritdoc />
public bool IsPredefined
{
get => _IsPredefined > 0;
private set => _IsPredefined = value ? 1u : 0u;
}
/// <summary>
/// Gets a boolean value indicating if this application is a metro application
/// </summary>
public bool IsMetroApplication
{
get => _Flags.GetBit(0);
private set => _Flags = _Flags.SetBit(0, value);
}
/// <summary>
/// Gets a boolean value indicating if this application has command line arguments
/// </summary>
public bool HasCommandLine
{
get => _Flags.GetBit(1);
}
/// <inheritdoc />
public string ApplicationName
{
get => _ApplicationName.Value;
private set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Name can not be empty or null.");
}
_ApplicationName = new UnicodeString(value);
}
}
/// <inheritdoc />
public string FriendlyName
{
get => _FriendlyName.Value;
private set => _FriendlyName = new UnicodeString(value);
}
/// <inheritdoc />
public string LauncherName
{
get => _LauncherName.Value;
private set => _LauncherName = new UnicodeString(value);
}
/// <summary>
/// Gets the list of files that are necessary to be present in the application parent directory.
/// </summary>
public string[] FilesInFolder
{
get => _FileInFolder.Value?.Split(new[] {FileInFolderSeparator}, StringSplitOptions.RemoveEmptyEntries) ??
new string[0];
private set => _FileInFolder = new UnicodeString(string.Join(FileInFolderSeparator.ToString(), value));
}
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <inheritdoc cref="IDRSApplication" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(4)]
public struct DRSApplicationV4 : IInitializable, IDRSApplication
{
internal const char FileInFolderSeparator = DRSApplicationV3.FileInFolderSeparator;
internal StructureVersion _Version;
internal uint _IsPredefined;
internal UnicodeString _ApplicationName;
internal UnicodeString _FriendlyName;
internal UnicodeString _LauncherName;
internal UnicodeString _FileInFolder;
internal uint _Flags;
internal UnicodeString _CommandLine;
/// <summary>
/// Creates a new instance of <see cref="DRSApplicationV4" />
/// </summary>
/// <param name="applicationName">The application file name.</param>
/// <param name="friendlyName">The application friendly name.</param>
/// <param name="launcherName">The application launcher name.</param>
/// <param name="fileInFolders">The list of files that are necessary to be present in the application parent directory.</param>
/// <param name="isMetro">A boolean value indicating if this application is a metro application.</param>
/// <param name="commandLine">The application's command line arguments.</param>
// ReSharper disable once TooManyDependencies
public DRSApplicationV4(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
this = typeof(DRSApplicationV4).Instantiate<DRSApplicationV4>();
IsPredefined = false;
ApplicationName = applicationName;
FriendlyName = friendlyName ?? string.Empty;
LauncherName = launcherName ?? string.Empty;
FilesInFolder = fileInFolders ?? new string[0];
IsMetroApplication = isMetro;
ApplicationCommandLine = commandLine ?? string.Empty;
}
/// <inheritdoc />
public bool IsPredefined
{
get => _IsPredefined > 0;
private set => _IsPredefined = value ? 1u : 0u;
}
/// <summary>
/// Gets a boolean value indicating if this application is a metro application
/// </summary>
public bool IsMetroApplication
{
get => _Flags.GetBit(0);
private set => _Flags = _Flags.SetBit(0, value);
}
/// <summary>
/// Gets a boolean value indicating if this application has command line arguments
/// </summary>
public bool HasCommandLine
{
get => _Flags.GetBit(1);
private set => _Flags = _Flags.SetBit(1, value);
}
/// <inheritdoc />
public string ApplicationName
{
get => _ApplicationName.Value;
private set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Name can not be empty or null.");
}
_ApplicationName = new UnicodeString(value);
}
}
/// <summary>
/// Gets the application command line arguments
/// </summary>
public string ApplicationCommandLine
{
get => (HasCommandLine ? _CommandLine.Value : null) ?? string.Empty;
private set
{
if (string.IsNullOrEmpty(value))
{
_CommandLine = new UnicodeString(null);
if (HasCommandLine)
{
HasCommandLine = false;
}
}
else
{
_CommandLine = new UnicodeString(value);
if (!HasCommandLine)
{
HasCommandLine = true;
}
}
}
}
/// <inheritdoc />
public string FriendlyName
{
get => _FriendlyName.Value;
private set => _FriendlyName = new UnicodeString(value);
}
/// <inheritdoc />
public string LauncherName
{
get => _LauncherName.Value;
private set => _LauncherName = new UnicodeString(value);
}
/// <summary>
/// Gets the list of files that are necessary to be present in the application parent directory.
/// </summary>
public string[] FilesInFolder
{
get => _FileInFolder.Value?.Split(new[] {FileInFolderSeparator}, StringSplitOptions.RemoveEmptyEntries) ??
new string[0];
private set => _FileInFolder = new UnicodeString(string.Join(FileInFolderSeparator.ToString(), value));
}
}
}

View File

@@ -0,0 +1,71 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// Contains a list of supported GPU series by a NVIDIA driver setting profile
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct DRSGPUSupport
{
internal uint _Flags;
/// <summary>
/// Gets or sets a value indicating if the GeForce line of products are supported
/// </summary>
public bool IsGeForceSupported
{
get => _Flags.GetBit(0);
set => _Flags = _Flags.SetBit(0, value);
}
/// <summary>
/// Gets or sets a value indicating if the Quadro line of products are supported
/// </summary>
public bool IsQuadroSupported
{
get => _Flags.GetBit(1);
set => _Flags = _Flags.SetBit(1, value);
}
/// <summary>
/// Gets or sets a value indicating if the NVS line of products are supported
/// </summary>
public bool IsNVSSupported
{
get => _Flags.GetBit(2);
set => _Flags = _Flags.SetBit(2, value);
}
/// <inheritdoc />
public override string ToString()
{
var supportedGPUs = new List<string>();
if (IsGeForceSupported)
{
supportedGPUs.Add("GeForce");
}
if (IsQuadroSupported)
{
supportedGPUs.Add("Quadro");
}
if (IsNVSSupported)
{
supportedGPUs.Add("NVS");
}
if (supportedGPUs.Any())
{
return $"[{_Flags}] = {string.Join(", ", supportedGPUs)}";
}
return $"[{_Flags}]";
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// DRSProfileHandle is a reference to a DRS profile.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct DRSProfileHandle : IHandle, IEquatable<DRSProfileHandle>
{
internal readonly IntPtr _MemoryAddress;
private DRSProfileHandle(IntPtr memoryAddress)
{
_MemoryAddress = memoryAddress;
}
/// <inheritdoc />
public bool Equals(DRSProfileHandle other)
{
return _MemoryAddress.Equals(other._MemoryAddress);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is DRSProfileHandle handle && Equals(handle);
}
/// <inheritdoc />
public override int GetHashCode()
{
return _MemoryAddress.GetHashCode();
}
/// <inheritdoc />
public override string ToString()
{
return $"DRSProfileHandle #{MemoryAddress.ToInt64()}";
}
/// <inheritdoc />
public IntPtr MemoryAddress
{
get => _MemoryAddress;
}
/// <inheritdoc />
public bool IsNull
{
get => _MemoryAddress == IntPtr.Zero;
}
/// <summary>
/// Checks for equality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are equal, otherwise false</returns>
public static bool operator ==(DRSProfileHandle left, DRSProfileHandle right)
{
return left.Equals(right);
}
/// <summary>
/// Checks for inequality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are not equal, otherwise false</returns>
public static bool operator !=(DRSProfileHandle left, DRSProfileHandle right)
{
return !left.Equals(right);
}
/// <summary>
/// Gets default DRSProfileHandle with a null pointer
/// </summary>
public static DRSProfileHandle DefaultHandle
{
get => default(DRSProfileHandle);
}
/// <summary>
/// Gets the default global profile handle
/// </summary>
public static DRSProfileHandle DefaultGlobalProfileHandle
{
get => new DRSProfileHandle(new IntPtr(-1));
}
}
}

View File

@@ -0,0 +1,76 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// Represents a NVIDIA driver settings profile
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct DRSProfileV1 : IInitializable
{
internal StructureVersion _Version;
internal UnicodeString _ProfileName;
internal DRSGPUSupport _GPUSupport;
internal uint _IsPredefined;
internal uint _NumberOfApplications;
internal uint _NumberOfSettings;
/// <summary>
/// Creates a new instance of <see cref="DRSProfileV1" /> with the passed name and GPU series support list.
/// </summary>
/// <param name="name">The name of the profile.</param>
/// <param name="gpuSupport">An instance of <see cref="DRSGPUSupport" /> containing the list of supported GPU series.</param>
public DRSProfileV1(string name, DRSGPUSupport gpuSupport)
{
this = typeof(DRSProfileV1).Instantiate<DRSProfileV1>();
_ProfileName = new UnicodeString(name);
_GPUSupport = gpuSupport;
}
/// <summary>
/// Gets the name of the profile
/// </summary>
public string Name
{
get => _ProfileName.Value;
}
/// <summary>
/// Gets or sets the GPU series support list
/// </summary>
public DRSGPUSupport GPUSupport
{
get => _GPUSupport;
set => _GPUSupport = value;
}
/// <summary>
/// Gets a boolean value indicating if this profile is predefined
/// </summary>
public bool IsPredefined
{
get => _IsPredefined > 0;
}
/// <summary>
/// Gets the number of applications registered under this profile
/// </summary>
public int NumberOfApplications
{
get => (int) _NumberOfApplications;
}
/// <summary>
/// Gets the number of setting registered under this profile
/// </summary>
public int NumberOfSettings
{
get => (int) _NumberOfSettings;
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// DRSSessionHandle is a reference to a DRS session.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct DRSSessionHandle : IHandle, IEquatable<DRSSessionHandle>
{
internal readonly IntPtr _MemoryAddress;
/// <inheritdoc />
public bool Equals(DRSSessionHandle other)
{
return _MemoryAddress.Equals(other._MemoryAddress);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is DRSSessionHandle handle && Equals(handle);
}
/// <inheritdoc />
public override int GetHashCode()
{
return _MemoryAddress.GetHashCode();
}
/// <inheritdoc />
public override string ToString()
{
return $"DRSSessionHandle #{MemoryAddress.ToInt64()}";
}
/// <inheritdoc />
public IntPtr MemoryAddress
{
get => _MemoryAddress;
}
/// <inheritdoc />
public bool IsNull
{
get => _MemoryAddress == IntPtr.Zero;
}
/// <summary>
/// Checks for equality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are equal, otherwise false</returns>
public static bool operator ==(DRSSessionHandle left, DRSSessionHandle right)
{
return left.Equals(right);
}
/// <summary>
/// Checks for inequality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are not equal, otherwise false</returns>
public static bool operator !=(DRSSessionHandle left, DRSSessionHandle right)
{
return !left.Equals(right);
}
/// <summary>
/// Gets default DRSSessionHandle with a null pointer
/// </summary>
public static DRSSessionHandle DefaultHandle
{
get => default(DRSSessionHandle);
}
}
}

View File

@@ -0,0 +1,329 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// Represents a NVIDIA driver setting
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct DRSSettingV1 : IInitializable
{
internal StructureVersion _Version;
internal UnicodeString _SettingName;
internal uint _SettingId;
internal DRSSettingType _SettingType;
internal DRSSettingLocation _SettingLocation;
internal uint _IsCurrentPredefined;
internal uint _IsPredefinedValid;
internal DRSSettingValue _PredefinedValue;
internal DRSSettingValue _CurrentValue;
/// <summary>
/// Creates a new instance of <see cref="DRSSettingV1" /> containing the passed value.
/// </summary>
/// <param name="id">The setting identification number.</param>
/// <param name="settingType">The type of the setting's value</param>
/// <param name="value">The setting's value</param>
public DRSSettingV1(uint id, DRSSettingType settingType, object value)
{
this = typeof(DRSSettingV1).Instantiate<DRSSettingV1>();
Id = id;
IsPredefinedValueValid = false;
_SettingType = settingType;
CurrentValue = value;
}
/// <summary>
/// Creates a new instance of <see cref="DRSSettingV1" /> containing the passed value.
/// </summary>
/// <param name="id">The setting identification number.</param>
/// <param name="value">The setting's value</param>
public DRSSettingV1(uint id, string value) : this(id, DRSSettingType.String, value)
{
}
/// <summary>
/// Creates a new instance of <see cref="DRSSettingV1" /> containing the passed value.
/// </summary>
/// <param name="id">The setting identification number.</param>
/// <param name="value">The setting's value</param>
public DRSSettingV1(uint id, uint value) : this(id, DRSSettingType.Integer, value)
{
}
/// <summary>
/// Creates a new instance of <see cref="DRSSettingV1" /> containing the passed value.
/// </summary>
/// <param name="id">The setting identification number.</param>
/// <param name="value">The setting's value</param>
public DRSSettingV1(uint id, byte[] value) : this(id, DRSSettingType.Binary, value)
{
}
/// <summary>
/// Gets the name of the setting
/// </summary>
public string Name
{
get => _SettingName.Value;
}
/// <summary>
/// Gets the identification number of the setting
/// </summary>
public uint Id
{
get => _SettingId;
private set => _SettingId = value;
}
/// <summary>
/// Gets the setting's value type
/// </summary>
public DRSSettingType SettingType
{
get => _SettingType;
private set => _SettingType = value;
}
/// <summary>
/// Gets the setting location
/// </summary>
public DRSSettingLocation SettingLocation
{
get => _SettingLocation;
}
/// <summary>
/// Gets a boolean value indicating if the current value is the predefined value
/// </summary>
public bool IsCurrentValuePredefined
{
get => _IsCurrentPredefined > 0;
private set => _IsCurrentPredefined = value ? 1u : 0u;
}
/// <summary>
/// Gets a boolean value indicating if the predefined value is available and valid
/// </summary>
public bool IsPredefinedValueValid
{
get => _IsPredefinedValid > 0;
private set => _IsPredefinedValid = value ? 1u : 0u;
}
/// <summary>
/// Returns the predefined value as an integer
/// </summary>
/// <returns>An integer representing the predefined value</returns>
public uint GetPredefinedValueAsInteger()
{
return _PredefinedValue.AsInteger();
}
/// <summary>
/// Returns the predefined value as an array of bytes
/// </summary>
/// <returns>An byte array representing the predefined value</returns>
public byte[] GetPredefinedValueAsBinary()
{
return _PredefinedValue.AsBinary();
}
/// <summary>
/// Returns the predefined value as an unicode string
/// </summary>
/// <returns>An unicode string representing the predefined value</returns>
public string GetPredefinedValueAsUnicodeString()
{
return _PredefinedValue.AsUnicodeString();
}
/// <summary>
/// Gets the setting's predefined value
/// </summary>
public object PredefinedValue
{
get
{
if (!IsPredefinedValueValid)
{
return null;
}
switch (_SettingType)
{
case DRSSettingType.Integer:
return GetPredefinedValueAsInteger();
case DRSSettingType.Binary:
return GetPredefinedValueAsBinary();
case DRSSettingType.String:
case DRSSettingType.UnicodeString:
return GetPredefinedValueAsUnicodeString();
default:
throw new ArgumentOutOfRangeException(nameof(SettingType));
}
}
}
/// <summary>
/// Returns the current value as an integer
/// </summary>
/// <returns>An integer representing the current value</returns>
public uint GetCurrentValueAsInteger()
{
return _CurrentValue.AsInteger();
}
/// <summary>
/// Returns the current value as an array of bytes
/// </summary>
/// <returns>An byte array representing the current value</returns>
public byte[] GetCurrentValueAsBinary()
{
return _CurrentValue.AsBinary();
}
/// <summary>
/// Returns the current value as an unicode string
/// </summary>
/// <returns>An unicode string representing the current value</returns>
public string GetCurrentValueAsUnicodeString()
{
return _CurrentValue.AsUnicodeString();
}
/// <summary>
/// Sets the passed value as the current value
/// </summary>
/// <param name="value">The new value for the setting</param>
public void SetCurrentValueAsInteger(uint value)
{
if (SettingType != DRSSettingType.Integer)
{
throw new ArgumentOutOfRangeException(nameof(value), "Passed argument is invalid for this setting.");
}
_CurrentValue = new DRSSettingValue(value);
IsCurrentValuePredefined = IsPredefinedValueValid && (uint) CurrentValue == (uint) PredefinedValue;
}
/// <summary>
/// Sets the passed value as the current value
/// </summary>
/// <param name="value">The new value for the setting</param>
public void SetCurrentValueAsBinary(byte[] value)
{
if (SettingType != DRSSettingType.Binary)
{
throw new ArgumentOutOfRangeException(nameof(value), "Passed argument is invalid for this setting.");
}
_CurrentValue = new DRSSettingValue(value);
IsCurrentValuePredefined =
IsPredefinedValueValid &&
((byte[]) CurrentValue)?.SequenceEqual((byte[]) PredefinedValue ?? new byte[0]) == true;
}
/// <summary>
/// Sets the passed value as the current value
/// </summary>
/// <param name="value">The new value for the setting</param>
public void SetCurrentValueAsUnicodeString(string value)
{
if (SettingType != DRSSettingType.UnicodeString)
{
throw new ArgumentOutOfRangeException(nameof(value), "Passed argument is invalid for this setting.");
}
_CurrentValue = new DRSSettingValue(value);
IsCurrentValuePredefined =
IsPredefinedValueValid &&
string.Equals(
(string) CurrentValue,
(string) PredefinedValue,
StringComparison.InvariantCulture
);
}
/// <summary>
/// Gets or sets the setting's current value
/// </summary>
public object CurrentValue
{
get
{
switch (_SettingType)
{
case DRSSettingType.Integer:
return GetCurrentValueAsInteger();
case DRSSettingType.Binary:
return GetCurrentValueAsBinary();
case DRSSettingType.String:
case DRSSettingType.UnicodeString:
return GetCurrentValueAsUnicodeString();
default:
throw new ArgumentOutOfRangeException(nameof(SettingType));
}
}
private set
{
if (value is int intValue)
{
SetCurrentValueAsInteger((uint) intValue);
}
else if (value is uint unsignedIntValue)
{
SetCurrentValueAsInteger(unsignedIntValue);
}
else if (value is short shortValue)
{
SetCurrentValueAsInteger((uint) shortValue);
}
else if (value is ushort unsignedShortValue)
{
SetCurrentValueAsInteger(unsignedShortValue);
}
else if (value is long longValue)
{
SetCurrentValueAsInteger((uint) longValue);
}
else if (value is ulong unsignedLongValue)
{
SetCurrentValueAsInteger((uint) unsignedLongValue);
}
else if (value is byte byteValue)
{
SetCurrentValueAsInteger(byteValue);
}
else if (value is string stringValue)
{
SetCurrentValueAsUnicodeString(stringValue);
}
else if (value is byte[] binaryValue)
{
SetCurrentValueAsBinary(binaryValue);
}
else
{
throw new ArgumentException("Unacceptable argument type.", nameof(value));
}
}
}
}
}

View File

@@ -0,0 +1,97 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// Represents a setting value
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct DRSSettingValue : IInitializable
{
private const int UnicodeStringLength = UnicodeString.UnicodeStringLength;
private const int BinaryDataMax = 4096;
// Math.Max(BinaryDataMax + sizeof(uint), UnicodeStringLength * sizeof(ushort))
private const int FullStructureSize = 4100;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = FullStructureSize, ArraySubType = UnmanagedType.U1)]
internal byte[] _BinaryValue;
/// <summary>
/// Creates a new instance of <see cref="DRSSettingValue" /> containing the passed unicode string as the value
/// </summary>
/// <param name="value">The unicode string value</param>
public DRSSettingValue(string value)
{
if (value?.Length > UnicodeStringLength)
{
value = value.Substring(0, UnicodeStringLength);
}
_BinaryValue = new byte[FullStructureSize];
var stringBytes = Encoding.Unicode.GetBytes(value ?? string.Empty);
Array.Copy(stringBytes, 0, _BinaryValue, 0, Math.Min(stringBytes.Length, _BinaryValue.Length));
}
/// <summary>
/// Creates a new instance of <see cref="DRSSettingValue" /> containing the passed byte array as the value
/// </summary>
/// <param name="value">The byte array value</param>
public DRSSettingValue(byte[] value)
{
_BinaryValue = new byte[FullStructureSize];
if (value?.Length > 0)
{
var arrayLength = Math.Min(value.Length, BinaryDataMax);
var arrayLengthBytes = BitConverter.GetBytes((uint) arrayLength);
Array.Copy(arrayLengthBytes, 0, _BinaryValue, 0, arrayLengthBytes.Length);
Array.Copy(value, 0, _BinaryValue, arrayLengthBytes.Length, arrayLength);
}
}
/// <summary>
/// Creates a new instance of <see cref="DRSSettingValue" /> containing the passed integer as the value
/// </summary>
/// <param name="value">The integer value</param>
public DRSSettingValue(uint value)
{
_BinaryValue = new byte[FullStructureSize];
var arrayLengthBytes = BitConverter.GetBytes(value);
Array.Copy(arrayLengthBytes, 0, _BinaryValue, 0, arrayLengthBytes.Length);
}
/// <summary>
/// Returns the value as an integer
/// </summary>
/// <returns>An integer representing the value</returns>
public uint AsInteger()
{
return BitConverter.ToUInt32(_BinaryValue, 0);
}
/// <summary>
/// Returns the value as an array of bytes
/// </summary>
/// <returns>An array of bytes representing the value</returns>
public byte[] AsBinary()
{
return _BinaryValue.Skip(sizeof(uint)).Take((int) AsInteger()).ToArray();
}
/// <summary>
/// Returns the value as an unicode string
/// </summary>
/// <returns>An unicode string representing the value</returns>
public string AsUnicodeString()
{
return Encoding.Unicode.GetString(_BinaryValue).TrimEnd('\0');
}
}
}

View File

@@ -0,0 +1,140 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.DRS.Structures
{
/// <summary>
/// Contains a list of all possible values for a setting as well as its default value
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct DRSSettingValues : IInitializable
{
internal const int MaximumNumberOfValues = 100;
internal StructureVersion _Version;
internal uint _NumberOfValues;
internal DRSSettingType _SettingType;
internal DRSSettingValue _DefaultValue;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MaximumNumberOfValues)]
internal DRSSettingValue[] _Values;
/// <summary>
/// Gets the setting's value type
/// </summary>
public DRSSettingType SettingType
{
get => _SettingType;
}
/// <summary>
/// Gets a list of possible values for the setting
/// </summary>
public object[] Values
{
get
{
switch (_SettingType)
{
case DRSSettingType.Integer:
return ValuesAsInteger().Cast<object>().ToArray();
case DRSSettingType.Binary:
return ValuesAsBinary().Cast<object>().ToArray();
case DRSSettingType.String:
case DRSSettingType.UnicodeString:
return ValuesAsUnicodeString().Cast<object>().ToArray();
default:
throw new ArgumentOutOfRangeException(nameof(SettingType));
}
}
}
/// <summary>
/// Gets the default value of the setting
/// </summary>
public object DefaultValue
{
get
{
switch (_SettingType)
{
case DRSSettingType.Integer:
return DefaultValueAsInteger();
case DRSSettingType.Binary:
return DefaultValueAsBinary();
case DRSSettingType.String:
case DRSSettingType.UnicodeString:
return DefaultValueAsUnicodeString();
default:
throw new ArgumentOutOfRangeException(nameof(SettingType));
}
}
}
/// <summary>
/// Returns the default value as an integer
/// </summary>
/// <returns>An integer representing the default value</returns>
public uint DefaultValueAsInteger()
{
return _DefaultValue.AsInteger();
}
/// <summary>
/// Returns the default value as a byte array
/// </summary>
/// <returns>An array of bytes representing the default value</returns>
public byte[] DefaultValueAsBinary()
{
return _DefaultValue.AsBinary();
}
/// <summary>
/// Returns the default value as an unicode string
/// </summary>
/// <returns>A string representing the default value</returns>
public string DefaultValueAsUnicodeString()
{
return _DefaultValue.AsUnicodeString();
}
/// <summary>
/// Returns the setting's possible values as an array of integers
/// </summary>
/// <returns>An array of integers representing the possible values</returns>
public uint[] ValuesAsInteger()
{
return _Values.Take((int) _NumberOfValues).Select(value => value.AsInteger()).ToArray();
}
/// <summary>
/// Returns the setting's possible values as an array of byte arrays
/// </summary>
/// <returns>An array of byte arrays representing the possible values</returns>
public byte[][] ValuesAsBinary()
{
return _Values.Take((int) _NumberOfValues).Select(value => value.AsBinary()).ToArray();
}
/// <summary>
/// Returns the setting's possible values as an array of unicode strings
/// </summary>
/// <returns>An array of unicode strings representing the possible values</returns>
public string[] ValuesAsUnicodeString()
{
return _Values.Take((int) _NumberOfValues).Select(value => value.AsUnicodeString()).ToArray();
}
}
}

View File

@@ -0,0 +1,936 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using NvAPIWrapper.Native.DRS.Structures;
using NvAPIWrapper.Native.Exceptions;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.Native
{
/// <summary>
/// Contains driver settings static functions
/// </summary>
// ReSharper disable once ClassTooBig
public static class DRSApi
{
/// <summary>
/// This API adds an executable name to a profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="application">Input <see cref="IDRSApplication" /> instance containing the executable name.</param>
/// <returns>The newly created instance of <see cref="IDRSApplication" />.</returns>
public static IDRSApplication CreateApplication(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
IDRSApplication application)
{
using (var applicationReference = ValueTypeReference.FromValueType(application, application.GetType()))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_CreateApplication>()(
sessionHandle,
profileHandle,
applicationReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return applicationReference.ToValueType<IDRSApplication>(application.GetType());
}
}
/// <summary>
/// This API creates an empty profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profile">Input to the <see cref="DRSProfileV1" /> instance.</param>
/// <returns>The newly created profile handle.</returns>
public static DRSProfileHandle CreateProfile(DRSSessionHandle sessionHandle, DRSProfileV1 profile)
{
using (var profileReference = ValueTypeReference.FromValueType(profile))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_CreateProfile>()(
sessionHandle,
profileReference,
out var profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return profileHandle;
}
}
/// <summary>
/// This API allocates memory and initializes the session.
/// </summary>
/// <returns>The newly created session handle.</returns>
public static DRSSessionHandle CreateSession()
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_CreateSession>()(out var sessionHandle);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return sessionHandle;
}
/// <summary>
/// This API removes an executable from a profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="application">Input all the information about the application to be removed.</param>
public static void DeleteApplication(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
IDRSApplication application)
{
using (var applicationReference = ValueTypeReference.FromValueType(application, application.GetType()))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_DeleteApplicationEx>()(
sessionHandle,
profileHandle,
applicationReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
}
/// <summary>
/// This API removes an executable name from a profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="applicationName">Input the executable name to be removed.</param>
public static void DeleteApplication(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
string applicationName)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_DeleteApplication>()(
sessionHandle,
profileHandle,
new UnicodeString(applicationName)
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API deletes a profile or sets it back to a predefined value.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
public static void DeleteProfile(DRSSessionHandle sessionHandle, DRSProfileHandle profileHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_DeleteProfile>()(
sessionHandle,
profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API deletes a setting or sets it back to predefined value.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="settingId">Input settingId to be deleted.</param>
public static void DeleteProfileSetting(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
uint settingId)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_DeleteProfileSetting>()(
sessionHandle,
profileHandle,
settingId
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API frees the allocated resources for the session handle.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
public static void DestroySession(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_DestroySession>()(sessionHandle);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API enumerates all the applications in a given profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <returns>Instances of <see cref="IDRSApplication" /> with all the attributes filled.</returns>
[SuppressMessage("ReSharper", "EventExceptionNotDocumented")]
public static IEnumerable<IDRSApplication> EnumApplications(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle)
{
var maxApplicationsPerRequest = 8;
var enumApplications = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_EnumApplications>();
foreach (var acceptType in enumApplications.Accepts())
{
var i = 0u;
while (true)
{
var instances = acceptType.Instantiate<IDRSApplication>().Repeat(maxApplicationsPerRequest);
using (var applicationsReference = ValueTypeArray.FromArray(instances, acceptType))
{
var count = (uint) instances.Length;
var status = enumApplications(
sessionHandle,
profileHandle,
i,
ref count,
applicationsReference
);
if (status == Status.IncompatibleStructureVersion)
{
break;
}
if (status == Status.EndEnumeration)
{
yield break;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
foreach (var application in applicationsReference.ToArray<IDRSApplication>(
(int) count,
acceptType))
{
yield return application;
i++;
}
if (count < maxApplicationsPerRequest)
{
yield break;
}
}
}
}
throw new NVIDIANotSupportedException("This operation is not supported.");
}
/// <summary>
/// This API enumerates all the Ids of all the settings recognized by NVAPI.
/// </summary>
/// <returns>An array of <see cref="uint" />s filled with the settings identification numbers of available settings.</returns>
public static uint[] EnumAvailableSettingIds()
{
var settingIdsCount = (uint) ushort.MaxValue;
var settingIds = 0u.Repeat((int) settingIdsCount);
using (var settingIdsArray = ValueTypeArray.FromArray(settingIds))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_EnumAvailableSettingIds>()(
settingIdsArray,
ref settingIdsCount
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return settingIdsArray.ToArray<uint>((int) settingIdsCount);
}
}
/// <summary>
/// This API enumerates all available setting values for a given setting.
/// </summary>
/// <param name="settingId">Input settingId.</param>
/// <returns>All available setting values.</returns>
public static DRSSettingValues EnumAvailableSettingValues(uint settingId)
{
var settingValuesCount = (uint) DRSSettingValues.MaximumNumberOfValues;
var settingValues = typeof(DRSSettingValues).Instantiate<DRSSettingValues>();
using (var settingValuesReference = ValueTypeReference.FromValueType(settingValues))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_EnumAvailableSettingValues>()(
settingId,
ref settingValuesCount,
settingValuesReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return settingValuesReference.ToValueType<DRSSettingValues>(typeof(DRSSettingValues));
}
}
/// <summary>
/// This API enumerates through all the profiles in the session.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <returns>Instances of <see cref="DRSProfileHandle" /> each representing a profile.</returns>
public static IEnumerable<DRSProfileHandle> EnumProfiles(DRSSessionHandle sessionHandle)
{
var i = 0u;
while (true)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_EnumProfiles>()(
sessionHandle,
i,
out var profileHandle
);
if (status == Status.EndEnumeration)
{
yield break;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
yield return profileHandle;
i++;
}
}
/// <summary>
/// This API enumerates all the settings of a given profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <returns>Instances of <see cref="DRSSettingV1" />.</returns>
[SuppressMessage("ReSharper", "EventExceptionNotDocumented")]
public static IEnumerable<DRSSettingV1> EnumSettings(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle)
{
var maxSettingsPerRequest = 32;
var enumSettings = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_EnumSettings>();
var i = 0u;
while (true)
{
var instances = typeof(DRSSettingV1).Instantiate<DRSSettingV1>().Repeat(maxSettingsPerRequest);
using (var applicationsReference = ValueTypeArray.FromArray(instances))
{
var count = (uint) instances.Length;
var status = enumSettings(
sessionHandle,
profileHandle,
i,
ref count,
applicationsReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status == Status.EndEnumeration)
{
yield break;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
foreach (var application in applicationsReference.ToArray<DRSSettingV1>(
(int) count,
typeof(DRSSettingV1))
)
{
yield return application;
i++;
}
if (count < maxSettingsPerRequest)
{
yield break;
}
}
}
}
/// <summary>
/// This API searches the application and the associated profile for the given application name.
/// If a fully qualified path is provided, this function will always return the profile
/// the driver will apply upon running the application (on the path provided).
/// </summary>
/// <param name="sessionHandle">Input to the hSession handle</param>
/// <param name="applicationName">Input appName. For best results, provide a fully qualified path of the type</param>
/// <param name="profileHandle">The profile handle of the profile that the found application belongs to.</param>
/// <returns>An instance of <see cref="IDRSApplication" />.</returns>
[SuppressMessage("ReSharper", "EventExceptionNotDocumented")]
public static IDRSApplication FindApplicationByName(
DRSSessionHandle sessionHandle,
string applicationName,
out DRSProfileHandle? profileHandle)
{
var findApplicationByName = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_FindApplicationByName>();
foreach (var acceptType in findApplicationByName.Accepts())
{
var instance = acceptType.Instantiate<IDRSApplication>();
using (var applicationReference = ValueTypeReference.FromValueType(instance, acceptType))
{
var status = findApplicationByName(
sessionHandle,
new UnicodeString(applicationName),
out var applicationProfileHandle,
applicationReference
);
if (status == Status.IncompatibleStructureVersion)
{
continue;
}
if (status == Status.ExecutableNotFound)
{
profileHandle = null;
return null;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
profileHandle = applicationProfileHandle;
return applicationReference.ToValueType<IDRSApplication>(acceptType);
}
}
throw new NVIDIANotSupportedException("This operation is not supported.");
}
/// <summary>
/// This API finds a profile in the current session.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileName">Input profileName.</param>
/// <returns>The profile handle.</returns>
public static DRSProfileHandle FindProfileByName(DRSSessionHandle sessionHandle, string profileName)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_FindProfileByName>()(
sessionHandle,
new UnicodeString(profileName),
out var profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return profileHandle;
}
/// <summary>
/// This API gets information about the given application. The input application name
/// must match exactly what the Profile has stored for the application.
/// This function is better used to retrieve application information from a previous
/// enumeration.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="applicationName">Input application name.</param>
/// <returns>
/// An instance of <see cref="IDRSApplication" /> with all attributes filled if found; otherwise
/// <see langword="null" />.
/// </returns>
[SuppressMessage("ReSharper", "EventExceptionNotDocumented")]
public static IDRSApplication GetApplicationInfo(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
string applicationName)
{
var getApplicationInfo = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetApplicationInfo>();
foreach (var acceptType in getApplicationInfo.Accepts())
{
var instance = acceptType.Instantiate<IDRSApplication>();
using (var applicationReference = ValueTypeReference.FromValueType(instance, acceptType))
{
var status = getApplicationInfo(
sessionHandle,
profileHandle,
new UnicodeString(applicationName),
applicationReference
);
if (status == Status.IncompatibleStructureVersion)
{
continue;
}
if (status == Status.ExecutableNotFound)
{
return null;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return applicationReference.ToValueType<IDRSApplication>(acceptType);
}
}
throw new NVIDIANotSupportedException("This operation is not supported.");
}
/// <summary>
/// Returns the handle to the current global profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <returns>Base profile handle.</returns>
public static DRSProfileHandle GetBaseProfile(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetBaseProfile>()(
sessionHandle,
out var profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return profileHandle;
}
/// <summary>
/// This API returns the handle to the current global profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <returns>Current global profile handle.</returns>
public static DRSProfileHandle GetCurrentGlobalProfile(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetCurrentGlobalProfile>()(
sessionHandle,
out var profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return profileHandle;
}
/// <summary>
/// This API obtains the number of profiles in the current session object.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <returns>Number of profiles in the current session.</returns>
public static int GetNumberOfProfiles(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetNumProfiles>()(
sessionHandle,
out var profileCount
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return (int) profileCount;
}
/// <summary>
/// This API gets information about the given profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <returns>An instance of <see cref="DRSProfileV1" /> with all attributes filled.</returns>
public static DRSProfileV1 GetProfileInfo(DRSSessionHandle sessionHandle, DRSProfileHandle profileHandle)
{
var profile = typeof(DRSProfileV1).Instantiate<DRSProfileV1>();
using (var profileReference = ValueTypeReference.FromValueType(profile))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetProfileInfo>()(
sessionHandle,
profileHandle,
profileReference
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return profileReference.ToValueType<DRSProfileV1>().GetValueOrDefault();
}
}
/// <summary>
/// This API gets information about the given setting.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="settingId">Input settingId.</param>
/// <returns>An instance of <see cref="DRSSettingV1" /> describing the setting if found; otherwise <see langword="null" />.</returns>
public static DRSSettingV1? GetSetting(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
uint settingId)
{
var instance = typeof(DRSSettingV1).Instantiate<DRSSettingV1>();
using (var settingReference = ValueTypeReference.FromValueType(instance, typeof(DRSSettingV1)))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetSetting>()(
sessionHandle,
profileHandle,
settingId,
settingReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status == Status.SettingNotFound)
{
return null;
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return settingReference.ToValueType<DRSSettingV1>(typeof(DRSSettingV1));
}
}
/// <summary>
/// This API gets the binary identification number of a setting given the setting name.
/// </summary>
/// <param name="settingName">Input Unicode settingName.</param>
/// <returns>The corresponding settingId.</returns>
public static uint GetSettingIdFromName(string settingName)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetSettingIdFromName>()(
new UnicodeString(settingName),
out var settingId
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return settingId;
}
/// <summary>
/// This API gets the setting name given the binary identification number.
/// </summary>
/// <param name="settingId">Input settingId.</param>
/// <returns>Corresponding settingName.</returns>
public static string GetSettingNameFromId(uint settingId)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_GetSettingNameFromId>()(
settingId,
out var settingName
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
return settingName.Value;
}
/// <summary>
/// This API loads and parses the settings data.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
public static void LoadSettings(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_LoadSettings>()(sessionHandle);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API loads settings from the given file path.
/// </summary>
/// <param name="sessionHandle">Input to the session handle</param>
/// <param name="fileName">Binary full file path.</param>
public static void LoadSettings(DRSSessionHandle sessionHandle, string fileName)
{
var unicodeFileName = new UnicodeString(fileName);
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_LoadSettingsFromFile>()(
sessionHandle,
unicodeFileName
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API restores the whole system to predefined(default) values.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
public static void RestoreDefaults(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_RestoreAllDefaults>()(
sessionHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API restores the given profile to predefined(default) values.
/// Any and all user specified modifications will be removed.
/// If the whole profile was set by the user, the profile will be removed.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
public static void RestoreDefaults(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_RestoreProfileDefault>()(
sessionHandle,
profileHandle
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API restores the given profile setting to predefined(default) values.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="settingId">Input settingId.</param>
public static void RestoreDefaults(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
uint settingId)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_RestoreProfileDefaultSetting>()(
sessionHandle,
profileHandle,
settingId
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API saves the settings data to the system.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
public static void SaveSettings(DRSSessionHandle sessionHandle)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_SaveSettings>()(sessionHandle);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API saves settings to the given file path.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="fileName">Binary full file path.</param>
public static void SaveSettings(DRSSessionHandle sessionHandle, string fileName)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_SaveSettingsToFile>()(
sessionHandle,
new UnicodeString(fileName)
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// This API sets the current global profile in the driver.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileName">Input the new current global profile name.</param>
public static void SetCurrentGlobalProfile(DRSSessionHandle sessionHandle, string profileName)
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_SetCurrentGlobalProfile>()(
sessionHandle,
new UnicodeString(profileName)
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
/// <summary>
/// Specifies flags for a given profile. Currently only the GPUSupport is
/// used to update the profile. Neither the name, number of settings or applications
/// or other profile information can be changed with this function.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="profile">Input the new profile info.</param>
public static void SetProfileInfo(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
DRSProfileV1 profile)
{
using (var profileReference = ValueTypeReference.FromValueType(profile))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_SetProfileInfo>()(
sessionHandle,
profileHandle,
profileReference
);
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
}
/// <summary>
/// This API adds/modifies a setting to a profile.
/// </summary>
/// <param name="sessionHandle">Input to the session handle.</param>
/// <param name="profileHandle">Input profile handle.</param>
/// <param name="setting">
/// An instance of <see cref="DRSSettingV1" /> containing the setting identification number and new
/// value for the setting.
/// </param>
public static void SetSetting(
DRSSessionHandle sessionHandle,
DRSProfileHandle profileHandle,
DRSSettingV1 setting)
{
using (var settingReference = ValueTypeReference.FromValueType(setting, setting.GetType()))
{
var status = DelegateFactory.GetDelegate<Delegates.DRS.NvAPI_DRS_SetSetting>()(
sessionHandle,
profileHandle,
settingReference
);
if (status == Status.IncompatibleStructureVersion)
{
throw new NVIDIANotSupportedException("This operation is not supported.");
}
if (status != Status.Ok)
{
throw new NVIDIAApiException(status);
}
}
}
}
}

View File

@@ -0,0 +1,255 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.DRS.Structures;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
namespace NvAPIWrapper.Native.Delegates
{
// ReSharper disable InconsistentNaming
internal static class DRS
{
[FunctionId(FunctionId.NvAPI_DRS_CreateApplication)]
public delegate Status NvAPI_DRS_CreateApplication(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In]
[Accepts(
typeof(DRSApplicationV4),
typeof(DRSApplicationV3),
typeof(DRSApplicationV2),
typeof(DRSApplicationV1)
)]
ValueTypeReference application
);
[FunctionId(FunctionId.NvAPI_DRS_CreateProfile)]
public delegate Status NvAPI_DRS_CreateProfile(
[In] DRSSessionHandle sessionHandle,
[In] [Accepts(typeof(DRSProfileV1))] ValueTypeReference profile,
[Out] out DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_CreateSession)]
public delegate Status NvAPI_DRS_CreateSession([Out] out DRSSessionHandle sessionHandle);
[FunctionId(FunctionId.NvAPI_DRS_DeleteApplication)]
public delegate Status NvAPI_DRS_DeleteApplication(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] UnicodeString applicationName
);
[FunctionId(FunctionId.NvAPI_DRS_DeleteApplicationEx)]
public delegate Status NvAPI_DRS_DeleteApplicationEx(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In]
[Accepts(typeof(DRSApplicationV1), typeof(DRSApplicationV2), typeof(DRSApplicationV3),
typeof(DRSApplicationV4))]
ValueTypeReference application
);
[FunctionId(FunctionId.NvAPI_DRS_DeleteProfile)]
public delegate Status NvAPI_DRS_DeleteProfile(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_DeleteProfileSetting)]
public delegate Status NvAPI_DRS_DeleteProfileSetting(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] uint settingId
);
[FunctionId(FunctionId.NvAPI_DRS_DestroySession)]
public delegate Status NvAPI_DRS_DestroySession([In] DRSSessionHandle sessionHandle);
[FunctionId(FunctionId.NvAPI_DRS_EnumApplications)]
public delegate Status NvAPI_DRS_EnumApplications(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] uint index,
[In] [Out] ref uint count,
[In]
[Accepts(
typeof(DRSApplicationV4),
typeof(DRSApplicationV3),
typeof(DRSApplicationV2),
typeof(DRSApplicationV1)
)]
ValueTypeArray applications
);
[FunctionId(FunctionId.NvAPI_DRS_EnumAvailableSettingIds)]
public delegate Status NvAPI_DRS_EnumAvailableSettingIds(
[In] [Accepts(typeof(uint))] ValueTypeArray settingIds,
[In] [Out] ref uint count
);
[FunctionId(FunctionId.NvAPI_DRS_EnumAvailableSettingValues)]
public delegate Status NvAPI_DRS_EnumAvailableSettingValues(
[In] uint settingId,
[In] [Out] ref uint count,
[In] [Out] [Accepts(typeof(DRSSettingValues))]
ValueTypeReference settingValues
);
[FunctionId(FunctionId.NvAPI_DRS_EnumProfiles)]
public delegate Status NvAPI_DRS_EnumProfiles(
[In] DRSSessionHandle sessionHandle,
[In] uint index,
[Out] out DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_EnumSettings)]
public delegate Status NvAPI_DRS_EnumSettings(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] uint index,
[In] [Out] ref uint count,
[In] [Out] [Accepts(typeof(DRSSettingV1))]
ValueTypeArray settings
);
[FunctionId(FunctionId.NvAPI_DRS_FindApplicationByName)]
public delegate Status NvAPI_DRS_FindApplicationByName(
[In] DRSSessionHandle sessionHandle,
[In] UnicodeString applicationName,
[Out] out DRSProfileHandle profileHandle,
[In]
[Accepts(
typeof(DRSApplicationV4),
typeof(DRSApplicationV3),
typeof(DRSApplicationV2),
typeof(DRSApplicationV1)
)]
ValueTypeReference application
);
[FunctionId(FunctionId.NvAPI_DRS_FindProfileByName)]
public delegate Status NvAPI_DRS_FindProfileByName(
[In] DRSSessionHandle sessionHandle,
[In] UnicodeString profileName,
[Out] out DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_GetApplicationInfo)]
public delegate Status NvAPI_DRS_GetApplicationInfo(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] UnicodeString applicationName,
[In]
[Accepts(
typeof(DRSApplicationV4),
typeof(DRSApplicationV3),
typeof(DRSApplicationV2),
typeof(DRSApplicationV1)
)]
ValueTypeReference application
);
[FunctionId(FunctionId.NvAPI_DRS_GetBaseProfile)]
public delegate Status NvAPI_DRS_GetBaseProfile(
[In] DRSSessionHandle sessionHandle,
[Out] out DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_GetCurrentGlobalProfile)]
public delegate Status NvAPI_DRS_GetCurrentGlobalProfile(
[In] DRSSessionHandle sessionHandle,
[Out] out DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_GetNumProfiles)]
public delegate Status NvAPI_DRS_GetNumProfiles([In] DRSSessionHandle sessionHandle, [Out] out uint count);
[FunctionId(FunctionId.NvAPI_DRS_GetProfileInfo)]
public delegate Status NvAPI_DRS_GetProfileInfo(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] [Accepts(typeof(DRSProfileV1))] ValueTypeReference profile
);
[FunctionId(FunctionId.NvAPI_DRS_GetSetting)]
public delegate Status NvAPI_DRS_GetSetting(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] uint settingId,
[Out] [Accepts(typeof(DRSSettingV1))] ValueTypeReference setting
);
[FunctionId(FunctionId.NvAPI_DRS_GetSettingIdFromName)]
public delegate Status NvAPI_DRS_GetSettingIdFromName(
[In] UnicodeString settingName,
[Out] out uint settingId
);
[FunctionId(FunctionId.NvAPI_DRS_GetSettingNameFromId)]
public delegate Status NvAPI_DRS_GetSettingNameFromId(
[In] uint settingId,
[Out] out UnicodeString settingName
);
[FunctionId(FunctionId.NvAPI_DRS_LoadSettings)]
public delegate Status NvAPI_DRS_LoadSettings([In] DRSSessionHandle sessionHandle);
[FunctionId(FunctionId.NvAPI_DRS_LoadSettingsFromFile)]
public delegate Status NvAPI_DRS_LoadSettingsFromFile(
[In] DRSSessionHandle sessionHandle,
[In] UnicodeString fileName
);
[FunctionId(FunctionId.NvAPI_DRS_RestoreAllDefaults)]
public delegate Status NvAPI_DRS_RestoreAllDefaults(
[In] DRSSessionHandle sessionHandle
);
[FunctionId(FunctionId.NvAPI_DRS_RestoreProfileDefault)]
public delegate Status NvAPI_DRS_RestoreProfileDefault(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle
);
[FunctionId(FunctionId.NvAPI_DRS_RestoreProfileDefaultSetting)]
public delegate Status NvAPI_DRS_RestoreProfileDefaultSetting(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] uint settingId
);
[FunctionId(FunctionId.NvAPI_DRS_SaveSettings)]
public delegate Status NvAPI_DRS_SaveSettings([In] DRSSessionHandle sessionHandle);
[FunctionId(FunctionId.NvAPI_DRS_SaveSettingsToFile)]
public delegate Status NvAPI_DRS_SaveSettingsToFile(
[In] DRSSessionHandle sessionHandle,
[In] UnicodeString fileName
);
[FunctionId(FunctionId.NvAPI_DRS_SetCurrentGlobalProfile)]
public delegate Status NvAPI_DRS_SetCurrentGlobalProfile(
[In] DRSSessionHandle sessionHandle,
[In] UnicodeString profileName
);
[FunctionId(FunctionId.NvAPI_DRS_SetProfileInfo)]
public delegate Status NvAPI_DRS_SetProfileInfo(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] [Accepts(typeof(DRSProfileV1))] ValueTypeReference profile
);
[FunctionId(FunctionId.NvAPI_DRS_SetSetting)]
public delegate Status NvAPI_DRS_SetSetting(
[In] DRSSessionHandle sessionHandle,
[In] DRSProfileHandle profileHandle,
[In] [Accepts(typeof(DRSSettingV1))] ValueTypeReference setting
);
}
}

View File

@@ -0,0 +1,328 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Display;
using NvAPIWrapper.Native.Display.Structures;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.GPU.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using Rectangle = NvAPIWrapper.Native.General.Structures.Rectangle;
// ReSharper disable InconsistentNaming
namespace NvAPIWrapper.Native.Delegates
{
internal static class Display
{
[FunctionId(FunctionId.NvAPI_CreateDisplayFromUnAttachedDisplay)]
public delegate Status NvAPI_CreateDisplayFromUnAttachedDisplay(
[In] UnAttachedDisplayHandle display,
[Out] out DisplayHandle newDisplay
);
[FunctionId(FunctionId.NvAPI_Disp_ColorControl)]
public delegate Status NvAPI_Disp_ColorControl(
[In] uint displayId,
[In]
[Out]
[Accepts(
typeof(ColorDataV5),
typeof(ColorDataV4),
typeof(ColorDataV3),
typeof(ColorDataV2),
typeof(ColorDataV1)
)]
ValueTypeReference colorData
);
[FunctionId(FunctionId.NvAPI_DISP_DeleteCustomDisplay)]
public delegate Status NvAPI_DISP_DeleteCustomDisplay(
[In] [Accepts(typeof(uint))] ValueTypeArray displayIds,
[In] uint count,
[In] [Accepts(typeof(CustomDisplay))] ValueTypeReference customDisplay
);
[FunctionId(FunctionId.NvAPI_DISP_EnumCustomDisplay)]
public delegate Status NvAPI_DISP_EnumCustomDisplay(
[In] uint displayId,
[In] uint index,
[In] [Accepts(typeof(CustomDisplay))] ValueTypeReference customDisplay
);
[FunctionId(FunctionId.NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle)]
public delegate Status NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle(
[In] [MarshalAs(UnmanagedType.LPStr)] string displayName,
[Out] out UnAttachedDisplayHandle display
);
[FunctionId(FunctionId.NvAPI_DISP_GetDisplayConfig)]
public delegate Status NvAPI_DISP_GetDisplayConfig(
[In] [Out] ref uint pathInfoCount,
[In] [Accepts(typeof(PathInfoV2), typeof(PathInfoV1))]
ValueTypeArray pathInfos
);
[FunctionId(FunctionId.NvAPI_DISP_GetDisplayIdByDisplayName)]
public delegate Status NvAPI_DISP_GetDisplayIdByDisplayName([In] string displayName, [Out] out uint displayId);
[FunctionId(FunctionId.NvAPI_DISP_GetGDIPrimaryDisplayId)]
public delegate Status NvAPI_DISP_GetGDIPrimaryDisplayId([Out] out uint displayId);
[FunctionId(FunctionId.NvAPI_Disp_GetHdrCapabilities)]
public delegate Status NvAPI_Disp_GetHdrCapabilities(
[In] uint displayId,
[In] [Out] [Accepts(typeof(HDRCapabilitiesV1))]
ValueTypeReference hdrCapabilities
);
[FunctionId(FunctionId.NvAPI_DISP_GetMonitorCapabilities)]
public delegate Status NvAPI_DISP_GetMonitorCapabilities(
[In] uint displayId,
[In] [Accepts(typeof(MonitorCapabilities))]
ValueTypeReference capabilities
);
[FunctionId(FunctionId.NvAPI_DISP_GetMonitorColorCapabilities)]
public delegate Status NvAPI_DISP_GetMonitorColorCapabilities(
[In] uint displayId,
[In] [Accepts(typeof(MonitorColorData))]
ValueTypeArray capabilities,
[In] [Out] ref uint count
);
[FunctionId(FunctionId.NvAPI_DISP_GetTiming)]
public delegate Status NvAPI_DISP_GetTiming(
[In] uint displayId,
[In] [Accepts(typeof(TimingInput))] ValueTypeReference timingInput,
[In] [Accepts(typeof(Timing))] ValueTypeReference timing
);
[FunctionId(FunctionId.NvAPI_Disp_HdrColorControl)]
public delegate Status NvAPI_Disp_HdrColorControl(
[In] uint displayId,
[In] [Out] [Accepts(typeof(HDRColorDataV2), typeof(HDRColorDataV1))]
ValueTypeReference hdrColorData
);
[FunctionId(FunctionId.NvAPI_Disp_InfoFrameControl)]
public delegate Status NvAPI_Disp_InfoFrameControl(
[In] uint displayId,
[In] [Accepts(typeof(InfoFrameData))] ValueTypeReference infoFrameData
);
[FunctionId(FunctionId.NvAPI_DISP_RevertCustomDisplayTrial)]
public delegate Status NvAPI_DISP_RevertCustomDisplayTrial(
[In] [Accepts(typeof(uint))] ValueTypeArray displayIds,
[In] uint count
);
[FunctionId(FunctionId.NvAPI_DISP_SaveCustomDisplay)]
public delegate Status NvAPI_DISP_SaveCustomDisplay(
[In] [Accepts(typeof(uint))] ValueTypeArray displayIds,
[In] uint count,
[In] uint isThisOutputIdOnly,
[In] uint isThisMonitorIdOnly
);
[FunctionId(FunctionId.NvAPI_DISP_SetDisplayConfig)]
public delegate Status NvAPI_DISP_SetDisplayConfig(
[In] uint pathInfoCount,
[In] [Accepts(typeof(PathInfoV2), typeof(PathInfoV1))]
ValueTypeArray pathInfos,
[In] DisplayConfigFlags flags
);
[FunctionId(FunctionId.NvAPI_DISP_TryCustomDisplay)]
public delegate Status NvAPI_DISP_TryCustomDisplay(
[In] [Accepts(typeof(uint))] ValueTypeArray displayIds,
[In] uint count,
[In] [Accepts(typeof(CustomDisplay))] ValueTypeArray customDisplays
);
[FunctionId(FunctionId.NvAPI_EnumNvidiaDisplayHandle)]
public delegate Status NvAPI_EnumNvidiaDisplayHandle(
[In] uint enumId,
[Out] out DisplayHandle display
);
[FunctionId(FunctionId.NvAPI_EnumNvidiaUnAttachedDisplayHandle)]
public delegate Status NvAPI_EnumNvidiaUnAttachedDisplayHandle(
[In] uint enumId,
[Out] out UnAttachedDisplayHandle display
);
[FunctionId(FunctionId.NvAPI_GetAssociatedDisplayOutputId)]
public delegate Status NvAPI_GetAssociatedDisplayOutputId(
[In] DisplayHandle display,
[Out] out OutputId outputId
);
[FunctionId(FunctionId.NvAPI_GetAssociatedNvidiaDisplayHandle)]
public delegate Status NvAPI_GetAssociatedNvidiaDisplayHandle(
[In] [MarshalAs(UnmanagedType.LPStr)] string displayName,
[Out] out DisplayHandle display
);
[FunctionId(FunctionId.NvAPI_GetAssociatedNvidiaDisplayName)]
public delegate Status NvAPI_GetAssociatedNvidiaDisplayName(
[In] DisplayHandle display,
[Out] out ShortString displayName
);
[FunctionId(FunctionId.NvAPI_GetDisplayDriverBuildTitle)]
public delegate Status NvAPI_GetDisplayDriverBuildTitle(
[In] DisplayHandle displayHandle,
[Out] out ShortString name
);
[FunctionId(FunctionId.NvAPI_GetDisplayDriverMemoryInfo)]
public delegate Status NvAPI_GetDisplayDriverMemoryInfo(
[In] DisplayHandle displayHandle,
[In]
[Accepts(
typeof(DisplayDriverMemoryInfoV3),
typeof(DisplayDriverMemoryInfoV2),
typeof(DisplayDriverMemoryInfoV1)
)]
ValueTypeReference memoryInfo
);
[FunctionId(FunctionId.NvAPI_GetDVCInfo)]
public delegate Status NvAPI_GetDVCInfo(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] [Accepts(typeof(PrivateDisplayDVCInfo))]
ValueTypeReference dvcInfo
);
[FunctionId(FunctionId.NvAPI_GetDVCInfoEx)]
public delegate Status NvAPI_GetDVCInfoEx(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] [Accepts(typeof(PrivateDisplayDVCInfoEx))]
ValueTypeReference dvcInfo
);
[FunctionId(FunctionId.NvAPI_GetHDMISupportInfo)]
public delegate Status NvAPI_GetHDMISupportInfo(
[In] DisplayHandle displayHandle,
[In] uint displayIdOrOutputId,
[In] [Accepts(typeof(HDMISupportInfoV2), typeof(HDMISupportInfoV1))]
ValueTypeReference supportInfo
);
[FunctionId(FunctionId.NvAPI_GetHUEInfo)]
public delegate Status NvAPI_GetHUEInfo(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] [Accepts(typeof(PrivateDisplayHUEInfo))]
ValueTypeReference hueInfo
);
[FunctionId(FunctionId.NvAPI_GetSupportedViews)]
public delegate Status NvAPI_GetSupportedViews(
[In] DisplayHandle display,
[In] [Accepts(typeof(TargetViewMode))] ValueTypeArray viewModes,
[Out] [In] ref uint viewCount
);
[FunctionId(FunctionId.NvAPI_GetUnAttachedAssociatedDisplayName)]
public delegate Status NvAPI_GetUnAttachedAssociatedDisplayName(
[In] UnAttachedDisplayHandle display,
[Out] out ShortString displayName
);
[FunctionId(FunctionId.NvAPI_GPU_GetScanoutCompositionParameter)]
public delegate Status NvAPI_GPU_GetScanOutCompositionParameter(
[In] uint displayId,
[In] ScanOutCompositionParameter parameter,
[Out] out ScanOutCompositionParameterValue parameterValue,
[Out] out float container
);
[FunctionId(FunctionId.NvAPI_GPU_GetScanoutConfiguration)]
public delegate Status NvAPI_GPU_GetScanOutConfiguration(
[In] uint displayId,
[In] [Accepts(typeof(Rectangle))] ValueTypeReference desktopRectangle,
[In] [Accepts(typeof(Rectangle))] ValueTypeReference scanOutRectangle
);
[FunctionId(FunctionId.NvAPI_GPU_GetScanoutConfigurationEx)]
public delegate Status NvAPI_GPU_GetScanOutConfigurationEx(
[In] uint displayId,
[In] [Accepts(typeof(ScanOutInformationV1))]
ValueTypeReference scanOutInformation
);
[FunctionId(FunctionId.NvAPI_GPU_GetScanoutIntensityState)]
public delegate Status NvAPI_GPU_GetScanOutIntensityState(
[In] uint displayId,
[In] [Accepts(typeof(ScanOutIntensityStateV1))]
ValueTypeReference scanOutIntensityState
);
[FunctionId(FunctionId.NvAPI_GPU_GetScanoutWarpingState)]
public delegate Status NvAPI_GPU_GetScanOutWarpingState(
[In] uint displayId,
[In] [Accepts(typeof(ScanOutWarpingStateV1))]
ValueTypeReference scanOutWarpingState
);
[FunctionId(FunctionId.NvAPI_GPU_SetScanoutCompositionParameter)]
public delegate Status NvAPI_GPU_SetScanOutCompositionParameter(
[In] uint displayId,
[In] ScanOutCompositionParameter parameter,
[In] ScanOutCompositionParameterValue parameterValue,
[In] ref float container
);
[FunctionId(FunctionId.NvAPI_GPU_SetScanoutIntensity)]
public delegate Status NvAPI_GPU_SetScanOutIntensity(
[In] uint displayId,
[In] [Accepts(typeof(ScanOutIntensityV2), typeof(ScanOutIntensityV1))]
ValueTypeReference scanOutIntensityData,
[Out] out int isSticky
);
[FunctionId(FunctionId.NvAPI_GPU_SetScanoutWarping)]
public delegate Status NvAPI_GPU_SetScanOutWarping(
[In] uint displayId,
[In] [Accepts(typeof(ScanOutWarpingV1))]
ValueTypeReference scanOutWarping,
[In] [Out] ref int maximumNumberOfVertices,
[Out] out int isSticky
);
[FunctionId(FunctionId.NvAPI_SetDVCLevel)]
public delegate Status NvAPI_SetDVCLevel(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] int dvcLevel
);
[FunctionId(FunctionId.NvAPI_SetDVCLevelEx)]
public delegate Status NvAPI_SetDVCLevelEx(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] [Accepts(typeof(PrivateDisplayDVCInfoEx))]
ValueTypeReference dvcInfo
);
[FunctionId(FunctionId.NvAPI_SetHUEAngle)]
public delegate Status NvAPI_SetHUEAngle(
[In] DisplayHandle displayHandle,
[In] OutputId displayId,
[In] int hueAngle
);
[FunctionId(FunctionId.NvAPI_SetRefreshRateOverride)]
public delegate Status NvAPI_SetRefreshRateOverride(
[In] DisplayHandle displayHandle,
[In] OutputId outputMask,
[In] float refreshRate,
[In] uint isDeferred
);
}
}

View File

@@ -0,0 +1,726 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Display.Structures;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.GPU.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
// ReSharper disable InconsistentNaming
namespace NvAPIWrapper.Native.Delegates
{
internal static class GPU
{
[FunctionId(FunctionId.NvAPI_EnumLogicalGPUs)]
public delegate Status NvAPI_EnumLogicalGPUs(
[In] [Out] [MarshalAs(UnmanagedType.LPArray, SizeConst = LogicalGPUHandle.MaxLogicalGPUs)]
LogicalGPUHandle[]
gpuHandles,
[Out] out uint gpuCount);
[FunctionId(FunctionId.NvAPI_EnumPhysicalGPUs)]
public delegate Status NvAPI_EnumPhysicalGPUs(
[In] [Out] [MarshalAs(UnmanagedType.LPArray, SizeConst = PhysicalGPUHandle.MaxPhysicalGPUs)]
PhysicalGPUHandle[]
gpuHandles,
[Out] out uint gpuCount);
[FunctionId(FunctionId.NvAPI_EnumTCCPhysicalGPUs)]
public delegate Status NvAPI_EnumTCCPhysicalGPUs(
[In] [Out] [MarshalAs(UnmanagedType.LPArray, SizeConst = PhysicalGPUHandle.MaxPhysicalGPUs)]
PhysicalGPUHandle[]
gpuHandles,
[Out] out uint gpuCount);
[FunctionId(FunctionId.NvAPI_GetDriverModel)]
public delegate Status NvAPI_GetDriverModel(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint model);
[FunctionId(FunctionId.NvAPI_GetGPUIDfromPhysicalGPU)]
public delegate Status NvAPI_GetGPUIDFromPhysicalGPU(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint gpuId);
[FunctionId(FunctionId.NvAPI_GetLogicalGPUFromDisplay)]
public delegate Status NvAPI_GetLogicalGPUFromDisplay(
[In] DisplayHandle displayHandle,
[Out] out LogicalGPUHandle gpuHandle);
[FunctionId(FunctionId.NvAPI_GetLogicalGPUFromPhysicalGPU)]
public delegate Status NvAPI_GetLogicalGPUFromPhysicalGPU(
[In] PhysicalGPUHandle physicalGPUHandle,
[Out] out LogicalGPUHandle logicalGPUHandle);
[FunctionId(FunctionId.NvAPI_GetPhysicalGPUFromGPUID)]
public delegate Status NvAPI_GetPhysicalGPUFromGPUID(
[In] uint gpuId,
[Out] out PhysicalGPUHandle physicalGpu);
[FunctionId(FunctionId.NvAPI_GetPhysicalGPUFromUnAttachedDisplay)]
public delegate Status NvAPI_GetPhysicalGPUFromUnAttachedDisplay(
[In] UnAttachedDisplayHandle displayHandle,
[Out] out PhysicalGPUHandle gpuHandle);
[FunctionId(FunctionId.NvAPI_GetPhysicalGPUsFromDisplay)]
public delegate Status NvAPI_GetPhysicalGPUsFromDisplay(
[In] DisplayHandle displayHandle,
[In] [Out] [MarshalAs(UnmanagedType.LPArray, SizeConst = PhysicalGPUHandle.MaxPhysicalGPUs)]
PhysicalGPUHandle[]
gpuHandles,
[Out] out uint gpuCount);
[FunctionId(FunctionId.NvAPI_GetPhysicalGPUsFromLogicalGPU)]
public delegate Status NvAPI_GetPhysicalGPUsFromLogicalGPU(
[In] LogicalGPUHandle logicalGPUHandle,
[In] [Out] [MarshalAs(UnmanagedType.LPArray, SizeConst = PhysicalGPUHandle.MaxPhysicalGPUs)]
PhysicalGPUHandle[]
gpuHandles,
[Out] out uint gpuCount);
[FunctionId(FunctionId.NvAPI_GPU_ClientFanCoolersGetControl)]
public delegate Status NvAPI_GPU_ClientFanCoolersGetControl(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateFanCoolersControlV1))] [In]
ValueTypeReference control);
[FunctionId(FunctionId.NvAPI_GPU_ClientFanCoolersGetInfo)]
public delegate Status NvAPI_GPU_ClientFanCoolersGetInfo(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateFanCoolersInfoV1))] [In]
ValueTypeReference info);
[FunctionId(FunctionId.NvAPI_GPU_ClientFanCoolersGetStatus)]
public delegate Status NvAPI_GPU_ClientFanCoolersGetStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateFanCoolersStatusV1))] [In]
ValueTypeReference status);
[FunctionId(FunctionId.NvAPI_GPU_ClientFanCoolersSetControl)]
public delegate Status NvAPI_GPU_ClientFanCoolersSetControl(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateFanCoolersControlV1))] [In]
ValueTypeReference control);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumDevicesGetControl)]
public delegate Status NvAPI_GPU_ClientIlluminationDevicesGetControl(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationDeviceControlParametersV1))] [In]
ValueTypeReference illuminationDeviceControlInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumDevicesGetInfo)]
public delegate Status NvAPI_GPU_ClientIlluminationDevicesGetInfo(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationDeviceInfoParametersV1))] [In]
ValueTypeReference illuminationDevicesInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumDevicesSetControl)]
public delegate Status NvAPI_GPU_ClientIlluminationDevicesSetControl(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationDeviceControlParametersV1))] [In]
ValueTypeReference illuminationDeviceControlInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumZonesGetControl)]
public delegate Status NvAPI_GPU_ClientIlluminationZonesGetControl(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationZoneControlParametersV1))] [In]
ValueTypeReference illuminationZoneControlInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumZonesGetInfo)]
public delegate Status NvAPI_GPU_ClientIlluminationZonesGetInfo(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationZoneInfoParametersV1))] [In]
ValueTypeReference illuminationZoneInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientIllumZonesSetControl)]
public delegate Status NvAPI_GPU_ClientIlluminationZonesSetControl(
[In] PhysicalGPUHandle gpu,
[Accepts(typeof(IlluminationZoneControlParametersV1))] [In]
ValueTypeReference illuminationZoneControlInfo
);
[FunctionId(FunctionId.NvAPI_GPU_ClientPowerPoliciesGetInfo)]
public delegate Status NvAPI_GPU_ClientPowerPoliciesGetInfo(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivatePowerPoliciesInfoV1))] [In]
ValueTypeReference powerInfo);
[FunctionId(FunctionId.NvAPI_GPU_ClientPowerPoliciesGetStatus)]
public delegate Status NvAPI_GPU_ClientPowerPoliciesGetStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivatePowerPoliciesStatusV1))] [In]
ValueTypeReference status);
[FunctionId(FunctionId.NvAPI_GPU_ClientPowerPoliciesSetStatus)]
public delegate Status NvAPI_GPU_ClientPowerPoliciesSetStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivatePowerPoliciesStatusV1))] [In]
ValueTypeReference status);
[FunctionId(FunctionId.NvAPI_GPU_ClientPowerTopologyGetStatus)]
public delegate Status NvAPI_GPU_ClientPowerTopologyGetStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivatePowerTopologiesStatusV1))] [In]
ValueTypeReference status);
[FunctionId(FunctionId.NvAPI_GPU_EnableDynamicPstates)]
public delegate Status NvAPI_GPU_EnableDynamicPStates([In] PhysicalGPUHandle physicalGpu);
[FunctionId(FunctionId.NvAPI_GPU_EnableOverclockedPstates)]
public delegate Status NvAPI_GPU_EnableOverclockedPStates([In] PhysicalGPUHandle physicalGpu);
[FunctionId(FunctionId.NvAPI_GPU_GetActiveOutputs)]
public delegate Status NvAPI_GPU_GetActiveOutputs(
[In] PhysicalGPUHandle physicalGpu,
[Out] out OutputId outputMask);
[FunctionId(FunctionId.NvAPI_GPU_GetAGPAperture)]
public delegate Status NvAPI_GPU_GetAGPAperture(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint size);
[FunctionId(FunctionId.NvAPI_GPU_GetAllClockFrequencies)]
public delegate Status NvAPI_GPU_GetAllClockFrequencies(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(ClockFrequenciesV3), typeof(ClockFrequenciesV2), typeof(ClockFrequenciesV1))]
ValueTypeReference nvClocks);
[FunctionId(FunctionId.NvAPI_GPU_GetAllDisplayIds)]
public delegate Status NvAPI_GPU_GetAllDisplayIds(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(DisplayIdsV2))] [In] [Out]
ValueTypeArray pDisplayIds,
[In] [Out] ref uint displayIdCount);
[FunctionId(FunctionId.NvAPI_GPU_GetArchInfo)]
public delegate Status NvAPI_GPU_GetArchInfo(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateArchitectInfoV2))] [In]
ValueTypeReference info);
[FunctionId(FunctionId.NvAPI_GPU_GetBoardInfo)]
public delegate Status NvAPI_GPU_GetBoardInfo(
[In] PhysicalGPUHandle physicalGpu,
[Out] [In] ref BoardInfo info);
[FunctionId(FunctionId.NvAPI_GPU_GetBusId)]
public delegate Status NvAPI_GPU_GetBusId(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint gpuBusId);
[FunctionId(FunctionId.NvAPI_GPU_GetBusSlotId)]
public delegate Status NvAPI_GPU_GetBusSlotId(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint gpuBusSlotId);
[FunctionId(FunctionId.NvAPI_GPU_GetBusType)]
public delegate Status NvAPI_GPU_GetBusType(
[In] PhysicalGPUHandle physicalGpu,
[Out] out GPUBusType gpuBusType);
[FunctionId(FunctionId.NvAPI_GPU_GetClockBoostLock)]
public delegate Status NvAPI_GPU_GetClockBoostLock(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostLockV2))]
ValueTypeReference clockLocks);
[FunctionId(FunctionId.NvAPI_GPU_GetClockBoostMask)]
public delegate Status NvAPI_GPU_GetClockBoostMask(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostMasksV1))]
ValueTypeReference clockMasks);
[FunctionId(FunctionId.NvAPI_GPU_GetClockBoostRanges)]
public delegate Status NvAPI_GPU_GetClockBoostRanges(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostRangesV1))]
ValueTypeReference clockRanges);
[FunctionId(FunctionId.NvAPI_GPU_GetClockBoostTable)]
public delegate Status NvAPI_GPU_GetClockBoostTable(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostTableV1))]
ValueTypeReference boostTable);
[FunctionId(FunctionId.NvAPI_GPU_GetConnectedDisplayIds)]
public delegate Status NvAPI_GPU_GetConnectedDisplayIds(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(DisplayIdsV2))] [In] [Out]
ValueTypeArray pDisplayIds,
[In] [Out] ref uint displayIdCount,
[In] ConnectedIdsFlag flags);
[FunctionId(FunctionId.NvAPI_GPU_GetCoolerPolicyTable)]
public delegate Status NvAPI_GPU_GetCoolerPolicyTable(
[In] PhysicalGPUHandle physicalGpu,
[In] uint index,
[In] [Accepts(typeof(PrivateCoolerPolicyTableV1))]
ValueTypeReference coolerPolicyTable,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetCoolerSettings)]
public delegate Status NvAPI_GPU_GetCoolerSettings(
[In] PhysicalGPUHandle physicalGpu,
[In] CoolerTarget coolerIndex,
[In] [Accepts(typeof(PrivateCoolerSettingsV1))]
ValueTypeReference coolerSettings);
[FunctionId(FunctionId.NvAPI_GPU_GetCoreVoltageBoostPercent)]
public delegate Status NvAPI_GPU_GetCoreVoltageBoostPercent(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateVoltageBoostPercentV1))]
ValueTypeReference voltageBoostPercent);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentAGPRate)]
public delegate Status NvAPI_GPU_GetCurrentAGPRate(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint rate);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentFanSpeedLevel)]
public delegate Status NvAPI_GPU_GetCurrentFanSpeedLevel(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint fanLevel);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentPCIEDownstreamWidth)]
public delegate Status NvAPI_GPU_GetCurrentPCIEDownstreamWidth(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint width);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentPstate)]
public delegate Status NvAPI_GPU_GetCurrentPState(
[In] PhysicalGPUHandle physicalGpu,
[Out] out PerformanceStateId performanceStateId);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentThermalLevel)]
public delegate Status NvAPI_GPU_GetCurrentThermalLevel(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint thermalLevel);
[FunctionId(FunctionId.NvAPI_GPU_GetCurrentVoltage)]
public delegate Status NvAPI_GPU_GetCurrentVoltage(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateVoltageStatusV1))]
ValueTypeReference voltageStatus);
[FunctionId(FunctionId.NvAPI_GPU_GetDynamicPstatesInfoEx)]
public delegate Status NvAPI_GPU_GetDynamicPStatesInfoEx(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(DynamicPerformanceStatesInfoV1))]
ValueTypeReference performanceStatesInfoEx);
[FunctionId(FunctionId.NvAPI_GPU_GetECCConfigurationInfo)]
public delegate Status NvAPI_GPU_GetECCConfigurationInfo(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(ECCConfigurationInfoV1))]
ValueTypeReference eccConfigurationInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetECCErrorInfo)]
public delegate Status NvAPI_GPU_GetECCErrorInfo(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(ECCErrorInfoV1))] ValueTypeReference eccErrorInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetECCStatusInfo)]
public delegate Status NvAPI_GPU_GetECCStatusInfo(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(ECCStatusInfoV1))]
ValueTypeReference eccStatusInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetEDID)]
public delegate Status NvAPI_GPU_GetEDID(
[In] PhysicalGPUHandle physicalGpu,
[In] OutputId outputId,
[Accepts(typeof(EDIDV3), typeof(EDIDV2), typeof(EDIDV1))] [In]
ValueTypeReference edid);
[FunctionId(FunctionId.NvAPI_GPU_GetFBWidthAndLocation)]
public delegate Status NvAPI_GPU_GetFBWidthAndLocation(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint width,
[Out] out uint location);
[FunctionId(FunctionId.NvAPI_GPU_GetFoundry)]
public delegate Status NvAPI_GPU_GetFoundry(
[In] PhysicalGPUHandle physicalGpu,
[Out] out GPUFoundry pFoundry);
[FunctionId(FunctionId.NvAPI_GPU_GetFullName)]
public delegate Status NvAPI_GPU_GetFullName(
[In] PhysicalGPUHandle physicalGpu,
[Out] out ShortString name);
[FunctionId(FunctionId.NvAPI_GPU_GetGpuCoreCount)]
public delegate Status NvAPI_GPU_GetGpuCoreCount(
[In] PhysicalGPUHandle gpuHandle,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetGPUType)]
public delegate Status NvAPI_GPU_GetGPUType(
[In] PhysicalGPUHandle physicalGpu,
[Out] out GPUType gpuType);
[FunctionId(FunctionId.NvAPI_GPU_GetIllumination)]
public delegate Status NvAPI_GPU_GetIllumination(
[Accepts(typeof(GetIlluminationParameterV1))] [In]
ValueTypeReference illuminationInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetIRQ)]
public delegate Status NvAPI_GPU_GetIRQ(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint gpuIRQ);
[FunctionId(FunctionId.NvAPI_GPU_GetLogicalFBWidthAndLocation)]
public delegate Status NvAPI_GPU_GetLogicalFBWidthAndLocation(
[In] LogicalGPUHandle logicalGpu,
[Out] out uint width,
[Out] out uint location);
[FunctionId(FunctionId.NvAPI_GPU_GetMemoryInfo)]
public delegate Status NvAPI_GPU_GetMemoryInfo(
[In] PhysicalGPUHandle physicalGpu,
[In]
[Accepts(typeof(DisplayDriverMemoryInfoV3), typeof(DisplayDriverMemoryInfoV2),
typeof(DisplayDriverMemoryInfoV1))]
ValueTypeReference memoryInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetOutputType)]
public delegate Status NvAPI_GPU_GetOutputType(
[In] PhysicalGPUHandle physicalGpu,
[In] uint outputId,
[Out] out OutputType outputType);
[FunctionId(FunctionId.NvAPI_GPU_GetPartitionCount)]
public delegate Status NvAPI_GPU_GetPartitionCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetPCIEInfo)]
public delegate Status NvAPI_GPU_GetPCIEInfo(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivatePCIeInfoV2))] [In]
ValueTypeReference pcieInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetPCIIdentifiers)]
public delegate Status NvAPI_GPU_GetPCIIdentifiers(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint deviceId,
[Out] out uint subSystemId,
[Out] out uint revisionId,
[Out] out uint extDeviceId);
[FunctionId(FunctionId.NvAPI_GPU_GetPerfDecreaseInfo)]
public delegate Status NvAPI_GPU_GetPerfDecreaseInfo(
[In] PhysicalGPUHandle gpu,
[Out] out PerformanceDecreaseReason performanceDecreaseReason);
[FunctionId(FunctionId.NvAPI_GPU_GetPhysicalFrameBufferSize)]
public delegate Status NvAPI_GPU_GetPhysicalFrameBufferSize(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint size);
[FunctionId(FunctionId.NvAPI_GPU_GetPstates20)]
public delegate Status NvAPI_GPU_GetPStates20(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(
typeof(PerformanceStates20InfoV3),
typeof(PerformanceStates20InfoV2),
typeof(PerformanceStates20InfoV1)
)]
[In]
ValueTypeReference performanceStatesInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetPstatesInfoEx)]
public delegate Status NvAPI_GPU_GetPStatesInfoEx(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(
typeof(PerformanceStatesInfoV3),
typeof(PerformanceStatesInfoV2),
typeof(PerformanceStatesInfoV1)
)]
[In]
ValueTypeReference performanceStatesInfo,
[In] GetPerformanceStatesInfoFlags flags);
[FunctionId(FunctionId.NvAPI_GPU_GetQuadroStatus)]
public delegate Status NvAPI_GPU_GetQuadroStatus(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint isQuadro);
[FunctionId(FunctionId.NvAPI_GPU_GetRamBankCount)]
public delegate Status NvAPI_GPU_GetRamBankCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetRamBusWidth)]
public delegate Status NvAPI_GPU_GetRamBusWidth(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint busWidth);
[FunctionId(FunctionId.NvAPI_GPU_GetRamMaker)]
public delegate Status NvAPI_GPU_GetRamMaker(
[In] PhysicalGPUHandle physicalGpu,
[Out] out GPUMemoryMaker maker);
[FunctionId(FunctionId.NvAPI_GPU_GetRamType)]
public delegate Status NvAPI_GPU_GetRamType(
[In] PhysicalGPUHandle physicalGpu,
[Out] out GPUMemoryType type);
[FunctionId(FunctionId.NvAPI_GPU_GetROPCount)]
public delegate Status NvAPI_GPU_GetROPCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetShaderPipeCount)]
public delegate Status NvAPI_GPU_GetShaderPipeCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetShaderSubPipeCount)]
public delegate Status NvAPI_GPU_GetShaderSubPipeCount(
[In] PhysicalGPUHandle gpuHandle,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetShortName)]
public delegate Status NvAPI_GPU_GetShortName(
[In] PhysicalGPUHandle physicalGpu,
[Out] out ShortString name);
[FunctionId(FunctionId.NvAPI_GPU_GetSystemType)]
public delegate Status NvAPI_GPU_GetSystemType(
[In] PhysicalGPUHandle physicalGpu,
[Out] out SystemType systemType);
[FunctionId(FunctionId.NvAPI_GPU_GetTachReading)]
public delegate Status NvAPI_GPU_GetTachReading(
[In] PhysicalGPUHandle gpuHandle,
[Out] out uint value);
[FunctionId(FunctionId.NvAPI_GPU_GetThermalPoliciesInfo)]
public delegate Status NvAPI_GPU_GetThermalPoliciesInfo(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateThermalPoliciesInfoV2))] [In]
ValueTypeReference info);
[FunctionId(FunctionId.NvAPI_GPU_GetThermalPoliciesStatus)]
public delegate Status NvAPI_GPU_GetThermalPoliciesStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateThermalPoliciesStatusV2))] [In]
ValueTypeReference info);
[FunctionId(FunctionId.NvAPI_GPU_GetThermalSettings)]
public delegate Status NvAPI_GPU_GetThermalSettings(
[In] PhysicalGPUHandle physicalGpu,
[In] ThermalSettingsTarget sensorIndex,
[In] [Accepts(typeof(ThermalSettingsV2), typeof(ThermalSettingsV1))]
ValueTypeReference thermalSettings);
[FunctionId(FunctionId.NvAPI_GPU_GetTotalSMCount)]
public delegate Status NvAPI_GPU_GetTotalSMCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetTotalSPCount)]
public delegate Status NvAPI_GPU_GetTotalSPCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetTotalTPCCount)]
public delegate Status NvAPI_GPU_GetTotalTPCCount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_GetUsages)]
public delegate Status NvAPI_GPU_GetUsages(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateUsagesInfoV1))]
ValueTypeReference usageInfo);
[FunctionId(FunctionId.NvAPI_GPU_GetVbiosOEMRevision)]
public delegate Status NvAPI_GPU_GetVbiosOEMRevision(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint biosOEMRevision);
[FunctionId(FunctionId.NvAPI_GPU_GetVbiosRevision)]
public delegate Status NvAPI_GPU_GetVbiosRevision(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint biosRevision);
[FunctionId(FunctionId.NvAPI_GPU_GetVbiosVersionString)]
public delegate Status NvAPI_GPU_GetVbiosVersionString(
[In] PhysicalGPUHandle physicalGpu,
[Out] out ShortString biosVersion);
[FunctionId(FunctionId.NvAPI_GPU_GetVFPCurve)]
public delegate Status NvAPI_GPU_GetVFPCurve(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateVFPCurveV1))]
ValueTypeReference vfpCurve);
[FunctionId(FunctionId.NvAPI_GPU_GetVirtualFrameBufferSize)]
public delegate Status NvAPI_GPU_GetVirtualFrameBufferSize(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint size);
[FunctionId(FunctionId.NvAPI_GPU_GetVPECount)]
public delegate Status NvAPI_GPU_GetVPECount(
[In] PhysicalGPUHandle physicalGpu,
[Out] out uint count);
[FunctionId(FunctionId.NvAPI_GPU_PerfPoliciesGetInfo)]
public delegate Status NvAPI_GPU_PerfPoliciesGetInfo(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivatePerformanceInfoV1))]
ValueTypeReference performanceInfo);
[FunctionId(FunctionId.NvAPI_GPU_PerfPoliciesGetStatus)]
public delegate Status NvAPI_GPU_PerfPoliciesGetStatus(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivatePerformanceStatusV1))]
ValueTypeReference performanceStatus);
[FunctionId(FunctionId.NvAPI_GPU_QueryActiveApps)]
public delegate Status NvAPI_GPU_QueryActiveApps(
[In] PhysicalGPUHandle gpu,
[In] [Accepts(typeof(PrivateActiveApplicationV2))]
ValueTypeArray applications,
[In] [Out] ref uint numberOfApplications
);
[FunctionId(FunctionId.NvAPI_GPU_QueryIlluminationSupport)]
public delegate Status NvAPI_GPU_QueryIlluminationSupport(
[Accepts(typeof(QueryIlluminationSupportParameterV1))] [In]
ValueTypeReference illuminationSupportInfo);
[FunctionId(FunctionId.NvAPI_GPU_ResetECCErrorInfo)]
public delegate Status NvAPI_GPU_ResetECCErrorInfo(
[In] PhysicalGPUHandle physicalGpu,
[In] byte resetCurrent,
[In] byte resetAggregated
);
[FunctionId(FunctionId.NvAPI_GPU_RestoreCoolerPolicyTable)]
public delegate Status NvAPI_GPU_RestoreCoolerPolicyTable(
[In] PhysicalGPUHandle physicalGpu,
[In] uint[] indexes,
[In] uint indexesCount,
[In] CoolerPolicy policy);
[FunctionId(FunctionId.NvAPI_GPU_RestoreCoolerSettings)]
public delegate Status NvAPI_GPU_RestoreCoolerSettings(
[In] PhysicalGPUHandle physicalGpu,
[In] uint[] indexes,
[In] uint indexesCount);
[FunctionId(FunctionId.NvAPI_GPU_SetClockBoostLock)]
public delegate Status NvAPI_GPU_SetClockBoostLock(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostLockV2))]
ValueTypeReference clockLocks);
[FunctionId(FunctionId.NvAPI_GPU_SetClockBoostTable)]
public delegate Status NvAPI_GPU_SetClockBoostTable(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateClockBoostTableV1))]
ValueTypeReference boostTable);
[FunctionId(FunctionId.NvAPI_GPU_SetCoolerLevels)]
public delegate Status NvAPI_GPU_SetCoolerLevels(
[In] PhysicalGPUHandle physicalGpu,
[In] uint index,
[In] [Accepts(typeof(PrivateCoolerLevelsV1))]
ValueTypeReference coolerLevels,
[In] uint count);
[FunctionId(FunctionId.NvAPI_GPU_SetCoolerPolicyTable)]
public delegate Status NvAPI_GPU_SetCoolerPolicyTable(
[In] PhysicalGPUHandle physicalGpu,
[In] uint index,
[In] [Accepts(typeof(PrivateCoolerPolicyTableV1))]
ValueTypeReference coolerLevels,
[In] uint count);
[FunctionId(FunctionId.NvAPI_GPU_SetCoreVoltageBoostPercent)]
public delegate Status NvAPI_GPU_SetCoreVoltageBoostPercent(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(PrivateVoltageBoostPercentV1))]
ValueTypeReference voltageBoostPercent);
[FunctionId(FunctionId.NvAPI_GPU_SetECCConfiguration)]
public delegate Status NvAPI_GPU_SetECCConfiguration(
[In] PhysicalGPUHandle physicalGpu,
[In] byte isEnable,
[In] byte isEnableImmediately
);
[FunctionId(FunctionId.NvAPI_GPU_SetEDID)]
public delegate Status NvAPI_GPU_SetEDID(
[In] PhysicalGPUHandle physicalGpu,
[In] uint outputId,
[Accepts(typeof(EDIDV3), typeof(EDIDV2), typeof(EDIDV1))] [In]
ValueTypeReference edid);
[FunctionId(FunctionId.NvAPI_GPU_SetIllumination)]
public delegate Status NvAPI_GPU_SetIllumination(
[Accepts(typeof(SetIlluminationParameterV1))] [In]
ValueTypeReference illuminationInfo);
[FunctionId(FunctionId.NvAPI_GPU_SetPstates20)]
public delegate Status NvAPI_GPU_SetPStates20(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PerformanceStates20InfoV3), typeof(PerformanceStates20InfoV2),
typeof(PerformanceStates20InfoV1))]
[In]
ValueTypeReference performanceStatesInfo);
[FunctionId(FunctionId.NvAPI_GPU_SetThermalPoliciesStatus)]
public delegate Status NvAPI_GPU_SetThermalPoliciesStatus(
[In] PhysicalGPUHandle physicalGpu,
[Accepts(typeof(PrivateThermalPoliciesStatusV2))] [In]
ValueTypeReference info);
[FunctionId(FunctionId.NvAPI_GPU_ValidateOutputCombination)]
public delegate Status NvAPI_GPU_ValidateOutputCombination(
[In] PhysicalGPUHandle physicalGpu,
[In] OutputId outputMask);
[FunctionId(FunctionId.NvAPI_I2CRead)]
public delegate Status NvAPI_I2CRead(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(I2CInfoV3), typeof(I2CInfoV2))] ValueTypeReference i2cInfo
);
[FunctionId(FunctionId.NvAPI_I2CWrite)]
public delegate Status NvAPI_I2CWrite(
[In] PhysicalGPUHandle physicalGpu,
[In] [Accepts(typeof(I2CInfoV3), typeof(I2CInfoV2))] ValueTypeReference i2cInfo
);
[FunctionId(FunctionId.NvAPI_SYS_GetDisplayIdFromGpuAndOutputId)]
public delegate Status NvAPI_SYS_GetDisplayIdFromGpuAndOutputId(
[In] PhysicalGPUHandle gpu,
[In] OutputId outputId,
[Out] out uint displayId);
[FunctionId(FunctionId.NvAPI_SYS_GetGpuAndOutputIdFromDisplayId)]
public delegate Status NvAPI_SYS_GetGpuAndOutputIdFromDisplayId(
[In] uint displayId,
[Out] out PhysicalGPUHandle gpu,
[Out] out OutputId outputId);
[FunctionId(FunctionId.NvAPI_SYS_GetPhysicalGpuFromDisplayId)]
public delegate Status NvAPI_SYS_GetPhysicalGpuFromDisplayId(
[In] uint displayId,
[Out] out PhysicalGPUHandle gpu);
}
}

View File

@@ -0,0 +1,43 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
// ReSharper disable InconsistentNaming
namespace NvAPIWrapper.Native.Delegates
{
internal static class General
{
[FunctionId(FunctionId.NvAPI_GetErrorMessage)]
public delegate Status NvAPI_GetErrorMessage([In] Status status, out ShortString message);
[FunctionId(FunctionId.NvAPI_GetInterfaceVersionString)]
public delegate Status NvAPI_GetInterfaceVersionString(out ShortString version);
[FunctionId(FunctionId.NvAPI_Initialize)]
public delegate Status NvAPI_Initialize();
[FunctionId(FunctionId.NvAPI_RestartDisplayDriver)]
public delegate Status NvAPI_RestartDisplayDriver();
[FunctionId(FunctionId.NvAPI_SYS_GetChipSetInfo)]
public delegate Status NvAPI_SYS_GetChipSetInfo(
[In] [Accepts(typeof(ChipsetInfoV4), typeof(ChipsetInfoV3), typeof(ChipsetInfoV2), typeof(ChipsetInfoV1))]
ValueTypeReference chipsetInfo);
[FunctionId(FunctionId.NvAPI_SYS_GetDriverAndBranchVersion)]
public delegate Status NvAPI_SYS_GetDriverAndBranchVersion(
out uint driverVersion,
out ShortString buildBranchString);
[FunctionId(FunctionId.NvAPI_SYS_GetLidAndDockInfo)]
public delegate Status NvAPI_SYS_GetLidAndDockInfo([In] [Out] ref LidDockParameters lidAndDock);
[FunctionId(FunctionId.NvAPI_Unload)]
public delegate Status NvAPI_Unload();
}
}

View File

@@ -0,0 +1,88 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Mosaic;
using NvAPIWrapper.Native.Mosaic.Structures;
// ReSharper disable InconsistentNaming
namespace NvAPIWrapper.Native.Delegates
{
internal static class Mosaic
{
[FunctionId(FunctionId.NvAPI_Mosaic_EnableCurrentTopo)]
public delegate Status NvAPI_Mosaic_EnableCurrentTopo(uint enable);
[FunctionId(FunctionId.NvAPI_Mosaic_EnumDisplayGrids)]
public delegate Status NvAPI_Mosaic_EnumDisplayGrids(
[Accepts(typeof(GridTopologyV2), typeof(GridTopologyV1))] [In] [Out]
ValueTypeArray gridTopology,
[In] [Out] ref uint gridCount);
[FunctionId(FunctionId.NvAPI_Mosaic_EnumDisplayModes)]
public delegate Status NvAPI_Mosaic_EnumDisplayModes(
[Accepts(typeof(GridTopologyV2), typeof(GridTopologyV1))] [In]
ValueTypeReference gridTopology,
[Accepts(typeof(DisplaySettingsV2), typeof(DisplaySettingsV1))] [In] [Out]
ValueTypeArray
displaysSettings,
[In] [Out] ref uint displaysCount);
[FunctionId(FunctionId.NvAPI_Mosaic_GetCurrentTopo)]
public delegate Status NvAPI_Mosaic_GetCurrentTopo(
[In] [Out] ref TopologyBrief topoBrief,
[Accepts(typeof(DisplaySettingsV2), typeof(DisplaySettingsV1))] [In] [Out]
ValueTypeReference displaySetting,
[Out] out int overlapX,
[Out] out int overlapY);
[FunctionId(FunctionId.NvAPI_Mosaic_GetOverlapLimits)]
public delegate Status NvAPI_Mosaic_GetOverlapLimits(
[In] TopologyBrief topoBrief,
[Accepts(typeof(DisplaySettingsV2), typeof(DisplaySettingsV1))] [In]
ValueTypeReference displaySetting,
[Out] out int minOverlapX,
[Out] out int maxOverlapX,
[Out] out int minOverlapY,
[Out] out int maxOverlapY);
[FunctionId(FunctionId.NvAPI_Mosaic_GetSupportedTopoInfo)]
public delegate Status NvAPI_Mosaic_GetSupportedTopoInfo(
[Accepts(typeof(SupportedTopologiesInfoV2), typeof(SupportedTopologiesInfoV1))] [In] [Out]
ValueTypeReference
supportedTopoInfo,
TopologyType topologyType);
[FunctionId(FunctionId.NvAPI_Mosaic_GetTopoGroup)]
public delegate Status NvAPI_Mosaic_GetTopoGroup(
[In] TopologyBrief topoBrief,
[In] [Out] ref TopologyGroup topoGroup);
[FunctionId(FunctionId.NvAPI_Mosaic_SetCurrentTopo)]
public delegate Status NvAPI_Mosaic_SetCurrentTopo(
[In] TopologyBrief topoBrief,
[Accepts(typeof(DisplaySettingsV2), typeof(DisplaySettingsV1))] [In]
ValueTypeReference displaySetting,
int overlapX,
int overlapY,
uint enable
);
[FunctionId(FunctionId.NvAPI_Mosaic_SetDisplayGrids)]
public delegate Status NvAPI_Mosaic_SetDisplayGrids(
[Accepts(typeof(GridTopologyV2), typeof(GridTopologyV1))] [In]
ValueTypeArray gridTopologies,
[In] uint gridCount,
[In] SetDisplayTopologyFlag setTopoFlags);
[FunctionId(FunctionId.NvAPI_Mosaic_ValidateDisplayGrids)]
public delegate Status NvAPI_Mosaic_ValidateDisplayGrids(
[In] SetDisplayTopologyFlag setTopoFlags,
[Accepts(typeof(GridTopologyV2), typeof(GridTopologyV1))] [In]
ValueTypeArray gridTopologies,
[In] [Out] ref DisplayTopologyStatus[] topoStatuses,
[In] uint gridCount);
}
}

View File

@@ -0,0 +1,248 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Display.Structures;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Stereo;
using NvAPIWrapper.Native.Stereo.Structures;
// ReSharper disable InconsistentNaming
namespace NvAPIWrapper.Native.Delegates
{
internal static class Stereo
{
[FunctionId(FunctionId.NvAPI_D3D1x_CreateSwapChain)]
public delegate Status NvAPI_D3D1x_CreateSwapChain(
[In] StereoHandle stereoHandle,
[In] IntPtr dxgiSwapChainDescription,
[Out] out IntPtr dxgiSwapChain,
[In] StereoSwapChainMode mode
);
[FunctionId(FunctionId.NvAPI_D3D9_CreateSwapChain)]
public delegate Status NvAPI_D3D9_CreateSwapChain(
[In] StereoHandle stereoHandle,
[In] IntPtr d3dPresentParameters,
[Out] out IntPtr direct3DSwapChain9,
[In] StereoSwapChainMode mode
);
[FunctionId(FunctionId.NvAPI_Stereo_Activate)]
public delegate Status NvAPI_Stereo_Activate(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_CaptureJpegImage)]
public delegate Status NvAPI_Stereo_CaptureJpegImage(
[In] StereoHandle stereoHandle,
[In] uint quality
);
[FunctionId(FunctionId.NvAPI_Stereo_CapturePngImage)]
public delegate Status NvAPI_Stereo_CapturePngImage(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_CreateConfigurationProfileRegistryKey)]
public delegate Status NvAPI_Stereo_CreateConfigurationProfileRegistryKey(
[In] StereoRegistryProfileType registryProfileType
);
[FunctionId(FunctionId.NvAPI_Stereo_CreateHandleFromIUnknown)]
public delegate Status NvAPI_Stereo_CreateHandleFromIUnknown(
[In] IntPtr d3dDevice,
[Out] out StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_Deactivate)]
public delegate Status NvAPI_Stereo_Deactivate(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_Debug_WasLastDrawStereoized)]
public delegate Status NvAPI_Stereo_Debug_WasLastDrawStereoized(
[In] StereoHandle stereoHandle,
[Out] out byte wasStereo
);
[FunctionId(FunctionId.NvAPI_Stereo_DecreaseConvergence)]
public delegate Status NvAPI_Stereo_DecreaseConvergence(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_DecreaseSeparation)]
public delegate Status NvAPI_Stereo_DecreaseSeparation(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_DeleteConfigurationProfileRegistryKey)]
public delegate Status NvAPI_Stereo_DeleteConfigurationProfileRegistryKey(
[In] StereoRegistryProfileType registryProfileType
);
[FunctionId(FunctionId.NvAPI_Stereo_DeleteConfigurationProfileValue)]
public delegate Status NvAPI_Stereo_DeleteConfigurationProfileValue(
[In] StereoRegistryProfileType registryProfileType,
[In] StereoRegistryIdentification registryId
);
[FunctionId(FunctionId.NvAPI_Stereo_DestroyHandle)]
public delegate Status NvAPI_Stereo_DestroyHandle(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_Disable)]
public delegate Status NvAPI_Stereo_Disable();
[FunctionId(FunctionId.NvAPI_Stereo_Enable)]
public delegate Status NvAPI_Stereo_Enable();
[FunctionId(FunctionId.NvAPI_Stereo_GetConvergence)]
public delegate Status NvAPI_Stereo_GetConvergence(
[In] StereoHandle stereoHandle,
[Out] out float convergence
);
[FunctionId(FunctionId.NvAPI_Stereo_GetDefaultProfile)]
public delegate Status NvAPI_Stereo_GetDefaultProfile(
[In] uint bufferSize,
[In] IntPtr stringBuffer,
[Out] out uint stringSize
);
[FunctionId(FunctionId.NvAPI_Stereo_GetEyeSeparation)]
public delegate Status NvAPI_Stereo_GetEyeSeparation(
[In] StereoHandle stereoHandle,
[Out] out float separation
);
[FunctionId(FunctionId.NvAPI_Stereo_GetFrustumAdjustMode)]
public delegate Status NvAPI_Stereo_GetFrustumAdjustMode(
[In] StereoHandle stereoHandle,
[Out] out StereoFrustumAdjustMode frustumAdjustMode
);
[FunctionId(FunctionId.NvAPI_Stereo_GetSeparation)]
public delegate Status NvAPI_Stereo_GetSeparation(
[In] StereoHandle stereoHandle,
[Out] out float separationPercentage
);
[FunctionId(FunctionId.NvAPI_Stereo_GetStereoSupport)]
public delegate Status NvAPI_Stereo_GetStereoSupport(
[In] IntPtr monitorHandle,
[In] [Accepts(typeof(StereoCapabilitiesV1))]
ValueTypeReference capabilities
);
[FunctionId(FunctionId.NvAPI_Stereo_GetSurfaceCreationMode)]
public delegate Status NvAPI_Stereo_GetSurfaceCreationMode(
[In] StereoHandle stereoHandle,
[Out] out StereoSurfaceCreateMode surfaceCreateMode
);
[FunctionId(FunctionId.NvAPI_Stereo_IncreaseConvergence)]
public delegate Status NvAPI_Stereo_IncreaseConvergence(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_IncreaseSeparation)]
public delegate Status NvAPI_Stereo_IncreaseSeparation(
[In] StereoHandle stereoHandle
);
[FunctionId(FunctionId.NvAPI_Stereo_InitActivation)]
public delegate Status NvAPI_Stereo_InitActivation(
[In] StereoHandle stereoHandle,
[In] StereoActivationFlag flag
);
[FunctionId(FunctionId.NvAPI_Stereo_IsActivated)]
public delegate Status NvAPI_Stereo_IsActivated(
[In] StereoHandle stereoHandle,
[Out] out byte isStereoActive
);
[FunctionId(FunctionId.NvAPI_Stereo_IsEnabled)]
public delegate Status NvAPI_Stereo_IsEnabled([Out] out byte isEnable);
[FunctionId(FunctionId.NvAPI_Stereo_IsWindowedModeSupported)]
public delegate Status NvAPI_Stereo_IsWindowedModeSupported([Out] out byte isEnable);
[FunctionId(FunctionId.NvAPI_Stereo_ReverseStereoBlitControl)]
public delegate Status NvAPI_Stereo_ReverseStereoBlitControl(
[In] StereoHandle stereoHandle,
[In] byte turnOn
);
[FunctionId(FunctionId.NvAPI_Stereo_SetActiveEye)]
public delegate Status NvAPI_Stereo_SetActiveEye(
[In] StereoHandle stereoHandle,
[In] StereoActiveEye activeEye
);
[FunctionId(FunctionId.NvAPI_Stereo_SetConfigurationProfileValue)]
public delegate Status NvAPI_Stereo_SetConfigurationProfileValueFloat(
[In] StereoRegistryProfileType registryProfileType,
[In] StereoRegistryIdentification registryId,
[In] ref float value
);
[FunctionId(FunctionId.NvAPI_Stereo_SetConfigurationProfileValue)]
public delegate Status NvAPI_Stereo_SetConfigurationProfileValueInteger(
[In] StereoRegistryProfileType registryProfileType,
[In] StereoRegistryIdentification registryId,
[In] ref int value
);
[FunctionId(FunctionId.NvAPI_Stereo_SetConvergence)]
public delegate Status NvAPI_Stereo_SetConvergence(
[In] StereoHandle stereoHandle,
[In] float newConvergence
);
[FunctionId(FunctionId.NvAPI_Stereo_SetDefaultProfile)]
public delegate Status NvAPI_Stereo_SetDefaultProfile(
[In] [MarshalAs(UnmanagedType.LPStr)] string profileName
);
[FunctionId(FunctionId.NvAPI_Stereo_SetDriverMode)]
public delegate Status NvAPI_Stereo_SetDriverMode(
[In] StereoDriverMode driverMode
);
[FunctionId(FunctionId.NvAPI_Stereo_SetFrustumAdjustMode)]
public delegate Status NvAPI_Stereo_SetFrustumAdjustMode(
[In] StereoHandle stereoHandle,
[In] StereoFrustumAdjustMode frustumAdjustMode
);
[FunctionId(FunctionId.NvAPI_Stereo_SetNotificationMessage)]
public delegate Status NvAPI_Stereo_SetNotificationMessage(
[In] StereoHandle stereoHandle,
[In] ulong windowHandle,
[In] ulong messageId
);
[FunctionId(FunctionId.NvAPI_Stereo_SetSeparation)]
public delegate Status NvAPI_Stereo_SetSeparation(
[In] StereoHandle stereoHandle,
[In] float newSeparationPercentage
);
[FunctionId(FunctionId.NvAPI_Stereo_SetSurfaceCreationMode)]
public delegate Status NvAPI_Stereo_SetSurfaceCreationMode(
[In] StereoHandle stereoHandle,
[In] StereoSurfaceCreateMode newSurfaceCreateMode
);
[FunctionId(FunctionId.NvAPI_Stereo_Trigger_Activation)]
public delegate Status NvAPI_Stereo_Trigger_Activation(
[In] StereoHandle stereoHandle
);
}
}

View File

@@ -0,0 +1,74 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for color data color space
/// </summary>
public enum ColorDataColorimetry : uint
{
/// <summary>
/// RGB color space
/// </summary>
RGB = 0,
/// <summary>
/// YCC601 color space
/// </summary>
YCC601,
/// <summary>
/// YCC709 color space
/// </summary>
YCC709,
/// <summary>
/// XVYCC601 color space
/// </summary>
XVYCC601,
/// <summary>
/// XVYCC709 color space
/// </summary>
XVYCC709,
/// <summary>
/// SYCC601 color space
/// </summary>
SYCC601,
/// <summary>
/// ADOBEYCC601 color space
/// </summary>
ADOBEYCC601,
/// <summary>
/// ADOBERGB color space
/// </summary>
ADOBERGB,
/// <summary>
/// BT2020RGB color space
/// </summary>
BT2020RGB,
/// <summary>
/// BT2020YCC color space
/// </summary>
BT2020YCC,
/// <summary>
/// BT2020cYCC color space
/// </summary>
// ReSharper disable once InconsistentNaming
BT2020cYCC,
/// <summary>
/// Default color space
/// </summary>
Default = 0xFE,
/// <summary>
/// Automatically select color space
/// </summary>
Auto = 0xFF
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the color data command
/// </summary>
public enum ColorDataCommand : uint
{
/// <summary>
/// Get the current color data
/// </summary>
Get = 1,
/// <summary>
/// Set the current color data
/// </summary>
Set,
/// <summary>
/// Check if the passed color data is supported
/// </summary>
IsSupportedColor,
/// <summary>
/// Get the default color data
/// </summary>
GetDefault
}
}

View File

@@ -0,0 +1,38 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the color data depth
/// </summary>
public enum ColorDataDepth : uint
{
/// <summary>
/// Default color depth meaning that the current setting should be kept
/// </summary>
Default = 0,
/// <summary>
/// 6bit per color depth
/// </summary>
BPC6 = 1,
/// <summary>
/// 8bit per color depth
/// </summary>
BPC8 = 2,
/// <summary>
/// 10bit per color depth
/// </summary>
BPC10 = 3,
/// <summary>
/// 12bit per color depth
/// </summary>
BPC12 = 4,
/// <summary>
/// 16bit per color depth
/// </summary>
BPC16 = 5
}
}

View File

@@ -0,0 +1,38 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the color data desktop color depth
/// </summary>
public enum ColorDataDesktopDepth : uint
{
/// <summary>
/// Default color depth meaning that the current setting should be kept
/// </summary>
Default = 0x0,
/// <summary>
/// 8bit per integer color component
/// </summary>
BPC8 = 0x1,
/// <summary>
/// 10bit integer per color component
/// </summary>
BPC10 = 0x2,
/// <summary>
/// 16bit float per color component
/// </summary>
BPC16Float = 0x3,
/// <summary>
/// 16bit float per color component wide color gamut
/// </summary>
BPC16FloatWcg = 0x4,
/// <summary>
/// 16bit float per color component HDR
/// </summary>
BPC16FloatHDR = 0x5
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for color data dynamic range
/// </summary>
public enum ColorDataDynamicRange : uint
{
/// <summary>
/// VESA standard progress signal
/// </summary>
VESA = 0,
/// <summary>
/// CEA interlaced signal
/// </summary>
CEA,
/// <summary>
/// Automatically select the best value
/// </summary>
Auto
}
}

View File

@@ -0,0 +1,38 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible color data color format values
/// </summary>
public enum ColorDataFormat : uint
{
/// <summary>
/// RGB color format
/// </summary>
RGB = 0,
/// <summary>
/// YUV422 color format
/// </summary>
YUV422,
/// <summary>
/// YUV444 color format
/// </summary>
YUV444,
/// <summary>
/// YUV420 color format
/// </summary>
YUV420,
/// <summary>
/// Default color format
/// </summary>
Default = 0xFE,
/// <summary>
/// Automatically select the best color format
/// </summary>
Auto = 0xFF
}
}

View File

@@ -0,0 +1,18 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the HDR color data command
/// </summary>
public enum ColorDataHDRCommand : uint
{
/// <summary>
/// Get the current HDR color data
/// </summary>
Get = 0,
/// <summary>
/// Set the current HDR color data
/// </summary>
Set = 1
}
}

View File

@@ -0,0 +1,61 @@
using System;
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible color data HDR modes
/// </summary>
public enum ColorDataHDRMode : uint
{
/// <summary>
/// Turn off HDR.
/// </summary>
Off = 0,
/// <summary>
/// Source: CCCS [a.k.a FP16 scRGB, linear, sRGB primaries, [-65504,0, 65504] range, RGB(1,1,1) = 80nits]
/// Output: UHDA HDR [a.k.a HDR10, RGB/YCC 10/12bpc ST2084(PQ) EOTF RGB(1,1,1) = 10000 nits, Rec2020 color primaries,
/// ST2086 static HDR metadata].
/// This is the only supported production HDR mode.
/// </summary>
UHDA = 2,
/// <summary>
/// Source: CCCS (a.k.a FP16 scRGB)
/// Output: EDR (Extended Dynamic Range) - HDR content is tone-mapped and gamut mapped to output on regular SDR display
/// set to max luminance ( ~300 nits ).
/// </summary>
[Obsolete("Do not use! Internal test mode only, to be removed.", false)]
EDR = 3,
/// <summary>
/// Source: any
/// Output: SDR (Standard Dynamic Range), we continuously send SDR EOTF InfoFrame signaling, HDMI compliance testing.
/// </summary>
[Obsolete("Do not use! Internal test mode only, to be removed.", false)]
SDR = 4,
/// <summary>
/// Source: HDR10 RGB 10bpc
/// Output: HDR10 RGB 10 colorDepth - signal UHDA HDR mode (PQ + Rec2020) to the sink but send source pixel values
/// unmodified (no PQ or Rec2020 conversions) - assumes source is already in HDR10 format.
/// </summary>
[Obsolete("Experimental mode only, not for production!", false)]
UHDAPassthrough = 5,
/// <summary>
/// Source: CCCS (a.k.a FP16 scRGB)
/// Output: notebook HDR
/// </summary>
[Obsolete("Do not use! Internal test mode only, to be removed.", false)]
UHDANB = 6,
/// <summary>
/// Source: RGB8 Dolby Vision encoded (12 colorDepth YCbCr422 packed into RGB8)
/// Output: Dolby Vision encoded : Application is to encoded frames in DV format and embed DV dynamic metadata as
/// described in Dolby Vision specification.
/// </summary>
[Obsolete("Experimental mode only, not for production!", false)]
DolbyVision = 7
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible values for the color data selection policy
/// </summary>
public enum ColorDataSelectionPolicy : uint
{
/// <summary>
/// Application or the Nvidia Control Panel user configuration are used to decide the best color format
/// </summary>
User = 0,
/// <summary>
/// Driver or the Operating System decides the best color format
/// </summary>
BestQuality = 1,
/// <summary>
/// Default value, <see cref="BestQuality" />
/// </summary>
Default = BestQuality,
/// <summary>
/// Unknown policy
/// </summary>
Unknown = 0xFF
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible color formats
/// </summary>
public enum ColorFormat
{
/// <summary>
/// Unknown, driver will choose one automatically.
/// </summary>
Unknown = 0,
/// <summary>
/// 8bpp mode
/// </summary>
P8 = 41,
/// <summary>
/// 16bpp mode
/// </summary>
R5G6B5 = 23,
/// <summary>
/// 32bpp mode
/// </summary>
A8R8G8B8 = 21,
/// <summary>
/// 64bpp (floating point)
/// </summary>
A16B16G16R16F = 113
}
}

View File

@@ -0,0 +1,41 @@
using System;
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Flags for applying settings, used by NvAPI_DISP_SetDisplayConfig()
/// </summary>
[Flags]
public enum DisplayConfigFlags
{
/// <summary>
/// None
/// </summary>
None = 0,
/// <summary>
/// Do not apply
/// </summary>
ValidateOnly = 0x00000001,
/// <summary>
/// Save to the persistence storage
/// </summary>
SaveToPersistence = 0x00000002,
/// <summary>
/// Driver reload is permitted if necessary
/// </summary>
DriverReloadAllowed = 0x00000004,
/// <summary>
/// Refresh OS mode list.
/// </summary>
ForceModeEnumeration = 0x00000008,
/// <summary>
/// Tell OS to avoid optimizing CommitVidPn call during a modeset
/// </summary>
ForceCommitVideoPresentNetwork = 0x00000010
}
}

View File

@@ -0,0 +1,34 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible display port color depths
/// </summary>
public enum DisplayPortColorDepth : uint
{
/// <summary>
/// Default color depth
/// </summary>
Default = 0,
/// <summary>
/// 6 bit per color color depth
/// </summary>
BPC6,
/// <summary>
/// 8 bit per color color depth
/// </summary>
BPC8,
/// <summary>
/// 10 bit per color color depth
/// </summary>
BPC10,
/// <summary>
/// 12 bit per color color depth
/// </summary>
BPC12,
/// <summary>
/// 16 bit per color color depth
/// </summary>
BPC16,
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible display port color formats
/// </summary>
public enum DisplayPortColorFormat : uint
{
/// <summary>
/// RGB color format
/// </summary>
RGB = 0,
/// <summary>
/// YCbCr422 color format
/// </summary>
YCbCr422 = 1,
/// <summary>
/// YCbCr444 color format
/// </summary>
YCbCr444 = 2
}
}

View File

@@ -0,0 +1,300 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio channel allocations (speaker placements)
/// </summary>
public enum InfoFrameAudioChannelAllocation : uint
{
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Empty [4] Empty [5] Empty [6] Front Right [7] Front Left
/// </summary>
FrFl = 0,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Empty [4] Empty [5] Low Frequency Effects [6] Front Right [7] Front Left
/// </summary>
LfeFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Empty [4] Front Center [5] Empty [6] Front Right [7] Front Left
/// </summary>
FcFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Empty [4] Front Center [5] Low Frequency Effects [6] Front Right [7] Front Left
/// </summary>
FcLfeFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Rear Center [4] Empty [5] Empty [6] Front Right [7] Front Left
/// </summary>
RcFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Rear Center [4] Empty [5] Low Frequency Effects [6] Front Right [7] Front Left
/// </summary>
RcLfeFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Rear Center [4] Front Center [5] Empty [6] Front Right [7] Front Left
/// </summary>
RcFcFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Empty [3] Rear Center [4] Front Center [5] Low Frequency Effects [6] Front Right [7] Front
/// Left
/// </summary>
RcFcLfeFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right [7] Front Left
/// </summary>
RrRlFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects [6] Front Right [7] Front Left
/// </summary>
RrRlLfeFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7] Front Left
/// </summary>
RrRlFcFrFl,
/// <summary>
/// [0] Empty [1] Empty [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6] Front Right [7]
/// Front Left
/// </summary>
RrRlFcLfeFrFl,
/// <summary>
/// [0] Empty [1] Rear Center [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right [7] Front Left
/// </summary>
RcRrRlFrFl,
/// <summary>
/// [0] Empty [1] Rear Center [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects [6] Front Right [7]
/// Front Left
/// </summary>
RcRrRlLfeFrFl,
/// <summary>
/// [0] Empty [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7] Front Left
/// </summary>
RcRrRlFcFrFl,
/// <summary>
/// [0] Empty [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6] Front Right
/// [7] Front Left
/// </summary>
RcRrRlFcLfeFrFl,
/// <summary>
/// [0] Rear Right Of Center [1] Rear Left Of Center [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
RrcRlcRrRlFrFl,
/// <summary>
/// [0] Rear Right Of Center [1] Rear Left Of Center [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
RrcRlcRrRlLfeFrFl,
/// <summary>
/// [0] Rear Right Of Center [1] Rear Left Of Center [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front
/// Right [7] Front Left
/// </summary>
RrcRlcRrRlFcFrFl,
/// <summary>
/// [0] Rear Right Of Center [1] Rear Left Of Center [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency
/// Effects [6] Front Right [7] Front Left
/// </summary>
RrcRlcRrRlFcLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Empty [4] Empty [5] Empty [6] Front Right [7]
/// Front Left
/// </summary>
FrcFlcFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Empty [4] Empty [5] Low Frequency Effects [6]
/// Front Right [7] Front Left
/// </summary>
FrcFlcLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Empty [4] Front Center [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
FrcFlcFcFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Empty [4] Front Center [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
FrcFlcFcLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Rear Center [4] Empty [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
FrcFlcRcFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Rear Center [4] Empty [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
FrcFlcRcLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Rear Center [4] Front Center [5] Empty [6] Front
/// Right [7] Front Left
/// </summary>
FrcFlcRcFcFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Empty [3] Rear Center [4] Front Center [5] Low Frequency
/// Effects [6] Front Right [7] Front Left
/// </summary>
FrcFlcRcFcLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
FrcFlcRrRlFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
FrcFlcRrRlLfeFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6]
/// Front Right [7] Front Left
/// </summary>
FrcFlcRrRlFcFrFl,
/// <summary>
/// [0] Front Right Of Center [1] Front Left Of Center [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency
/// Effects [6] Front Right [7] Front Left
/// </summary>
FrcFlcRrRlFcLfeFrFl,
/// <summary>
/// [0] Empty [1] Front Center High [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7] Front
/// Left
/// </summary>
FchRrRlFcFrFl,
/// <summary>
/// [0] Empty [1] Front Center High [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6] Front
/// Right [7] Front Left
/// </summary>
FchRrRlFcLfeFrFl,
/// <summary>
/// [0] TopCenter [1] Empty [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7] Front Left
/// </summary>
TcRrRlFcFrFl,
/// <summary>
/// [0] TopCenter [1] Empty [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6] Front Right [7]
/// Front Left
/// </summary>
TcRrRlFcLfeFrFl,
/// <summary>
/// [0] Front Right High [1] Front Left High [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right [7] Front
/// Left
/// </summary>
FrhFlhRrRlFrFl,
/// <summary>
/// [0] Front Right High [1] Front Left High [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects [6] Front
/// Right [7] Front Left
/// </summary>
FrhFlhRrRlLfeFrFl,
/// <summary>
/// [0] Front Right Wide [1] Front Left Wide [2] Rear Right [3] Rear Left [4] Empty [5] Empty [6] Front Right [7] Front
/// Left
/// </summary>
FrwFlwRrRlFrFl,
/// <summary>
/// [0] Front Right Wide [1] Front Left Wide [2] Rear Right [3] Rear Left [4] Empty [5] Low Frequency Effects [6] Front
/// Right [7] Front Left
/// </summary>
FrwFlwRrRlLfeFrFl,
/// <summary>
/// [0] TopCenter [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7] Front
/// Left
/// </summary>
TcRcRrRlFcFrFl,
/// <summary>
/// [0] TopCenter [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6] Front
/// Right [7] Front Left
/// </summary>
TcRcRrRlFcLfeFrFl,
/// <summary>
/// [0] Front Center High [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7]
/// Front Left
/// </summary>
FchRcRrRlFcFrFl,
/// <summary>
/// [0] Front Center High [1] Rear Center [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6]
/// Front Right [7] Front Left
/// </summary>
FchRcRrRlFcLfeFrFl,
/// <summary>
/// [0] TopCenter [1] Front Center High [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right [7]
/// Front Left
/// </summary>
TcFcRrRlFcFrFl,
/// <summary>
/// [0] TopCenter [1] Front Center High [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects [6]
/// Front Right [7] Front Left
/// </summary>
TcFchRrRlFcLfeFrFl,
/// <summary>
/// [0] Front Right High [1] Front Left High [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
FrhFlhRrRlFcFrFl,
/// <summary>
/// [0] Front Right High [1] Front Left High [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
FrhFlhRrRlFcLfeFrFl,
/// <summary>
/// [0] Front Right Wide [1] Front Left Wide [2] Rear Right [3] Rear Left [4] Front Center [5] Empty [6] Front Right
/// [7] Front Left
/// </summary>
FrwFlwRrRlFcFeFl,
/// <summary>
/// [0] Front Right Wide [1] Front Left Wide [2] Rear Right [3] Rear Left [4] Front Center [5] Low Frequency Effects
/// [6] Front Right [7] Front Left
/// </summary>
FrwFlwRrRlFcLfeFrFl,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 511
}
}

View File

@@ -0,0 +1,53 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio channels
/// </summary>
public enum InfoFrameAudioChannelCount : uint
{
/// <summary>
/// Data is available in the header of source data
/// </summary>
InHeader = 0,
/// <summary>
/// Two channels
/// </summary>
Two,
/// <summary>
/// Three channels
/// </summary>
Three,
/// <summary>
/// Four channels
/// </summary>
Four,
/// <summary>
/// Five channels
/// </summary>
Five,
/// <summary>
/// Six channels
/// </summary>
Six,
/// <summary>
/// Seven channels
/// </summary>
Seven,
/// <summary>
/// Eight channels
/// </summary>
Eight,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 15
}
}

View File

@@ -0,0 +1,93 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio codecs
/// </summary>
public enum InfoFrameAudioCodec : uint
{
/// <summary>
/// Data is available in the header of source data
/// </summary>
InHeader = 0,
/// <summary>
/// Pulse-code modulation
/// </summary>
PCM,
/// <summary>
/// Dolby AC-3
/// </summary>
AC3,
/// <summary>
/// MPEG1
/// </summary>
MPEG1,
/// <summary>
/// MP3 (MPEG-2 Audio Layer III)
/// </summary>
MP3,
/// <summary>
/// MPEG2
/// </summary>
MPEG2,
/// <summary>
/// Advanced Audio Coding
/// </summary>
AACLC,
/// <summary>
/// DTS
/// </summary>
DTS,
/// <summary>
/// Adaptive Transform Acoustic Coding
/// </summary>
ATRAC,
/// <summary>
/// Direct Stream Digital
/// </summary>
DSD,
/// <summary>
/// Dolby Digital Plus
/// </summary>
EAC3,
/// <summary>
/// DTS High Definition
/// </summary>
DTSHD,
/// <summary>
/// Meridian Lossless Packing
/// </summary>
MLP,
/// <summary>
/// DST
/// </summary>
DST,
/// <summary>
/// Windows Media Audio Pro
/// </summary>
WMAPRO,
/// <summary>
/// Extended audio codec value should be used to get information regarding audio codec
/// </summary>
UseExtendedCodecType,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 31
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible extended audio codecs
/// </summary>
public enum InfoFrameAudioExtendedCodec : uint
{
/// <summary>
/// Use the primary audio codec type, data not available
/// </summary>
UseCodecType = 0,
/// <summary>
/// High-Efficiency Advanced Audio Coding
/// </summary>
HEAAC,
/// <summary>
/// High-Efficiency Advanced Audio Coding 2
/// </summary>
HEAACVersion2,
/// <summary>
/// MPEG Surround
/// </summary>
MPEGSurround,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 63
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio low frequency effects channel playback level
/// </summary>
public enum InfoFrameAudioLFEPlaybackLevel : uint
{
/// <summary>
/// Data not available
/// </summary>
NoData = 0,
/// <summary>
/// No change to the source audio
/// </summary>
Plus0Decibel,
/// <summary>
/// Adds 10 decibel
/// </summary>
Plus10Decibel,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,93 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio channel level shift values
/// </summary>
public enum InfoFrameAudioLevelShift : uint
{
/// <summary>
/// No change to the source audio
/// </summary>
Shift0Decibel = 0,
/// <summary>
/// Shifts 1 decibel
/// </summary>
Shift1Decibel,
/// <summary>
/// Shifts 2 decibel
/// </summary>
Shift2Decibel,
/// <summary>
/// Shifts 3 decibel
/// </summary>
Shift3Decibel,
/// <summary>
/// Shifts 4 decibel
/// </summary>
Shift4Decibel,
/// <summary>
/// Shifts 5 decibel
/// </summary>
Shift5Decibel,
/// <summary>
/// Shifts 6 decibel
/// </summary>
Shift6Decibel,
/// <summary>
/// Shifts 7 decibel
/// </summary>
Shift7Decibel,
/// <summary>
/// Shifts 8 decibel
/// </summary>
Shift8Decibel,
/// <summary>
/// Shifts 9 decibel
/// </summary>
Shift9Decibel,
/// <summary>
/// Shifts 10 decibel
/// </summary>
Shift10Decibel,
/// <summary>
/// Shifts 11 decibel
/// </summary>
Shift11Decibel,
/// <summary>
/// Shifts 12 decibel
/// </summary>
Shift12Decibel,
/// <summary>
/// Shifts 13 decibel
/// </summary>
Shift13Decibel,
/// <summary>
/// Shifts 14 decibel
/// </summary>
Shift14Decibel,
/// <summary>
/// Shifts 15 decibel
/// </summary>
Shift15Decibel,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 31
}
}

View File

@@ -0,0 +1,53 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio sample rates (sampling frequency)
/// </summary>
public enum InfoFrameAudioSampleRate : uint
{
/// <summary>
/// Data is available in the header of source data
/// </summary>
InHeader = 0,
/// <summary>
/// 31kHz sampling frequency
/// </summary>
F32000Hz,
/// <summary>
/// 44.1kHz sampling frequency
/// </summary>
F44100Hz,
/// <summary>
/// 48kHz sampling frequency
/// </summary>
F48000Hz,
/// <summary>
/// 88.2kHz sampling frequency
/// </summary>
F88200Hz,
/// <summary>
/// 96kHz sampling frequency
/// </summary>
F96000Hz,
/// <summary>
/// 176.4kHz sampling frequency
/// </summary>
F176400Hz,
/// <summary>
/// 192kHz sampling frequency
/// </summary>
F192000Hz,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 15
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible audio sample size (bit depth)
/// </summary>
public enum InfoFrameAudioSampleSize : uint
{
/// <summary>
/// Data is available in the header of source data
/// </summary>
InHeader = 0,
/// <summary>
/// 16bit audio sample size
/// </summary>
B16,
/// <summary>
/// 20bit audio sample size
/// </summary>
B20,
/// <summary>
/// 24bit audio sample size
/// </summary>
B24,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for info-frame properties that accept or return a boolean value
/// </summary>
public enum InfoFrameBoolean : uint
{
/// <summary>
/// False
/// </summary>
False = 0,
/// <summary>
/// True
/// </summary>
True,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 3
}
}

View File

@@ -0,0 +1,50 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible commands for info-frame operations
/// </summary>
public enum InfoFrameCommand : uint
{
/// <summary>
/// Returns the fields in the info-frame with values set by the manufacturer (NVIDIA or OEM)
/// </summary>
GetDefault = 0,
/// <summary>
/// Sets the fields in the info-frame to auto, and info-frame to the default info-frame for use in a set.
/// </summary>
Reset,
/// <summary>
/// Get the current info-frame state.
/// </summary>
Get,
/// <summary>
/// Set the current info-frame state (flushed to the monitor), the values are one time and do not persist.
/// </summary>
Set,
/// <summary>
/// Get the override info-frame state, non-override fields will be set to value = AUTO, overridden fields will have the
/// current override values.
/// </summary>
GetOverride,
/// <summary>
/// Set the override info-frame state, non-override fields will be set to value = AUTO, other values indicate override;
/// persist across mode-set and reboot.
/// </summary>
SetOverride,
/// <summary>
/// Get properties associated with info-frame (each of the info-frame type will have properties).
/// </summary>
GetProperty,
/// <summary>
/// Set properties associated with info-frame.
/// </summary>
SetProperty
}
}

View File

@@ -0,0 +1,18 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible info-frame data type
/// </summary>
public enum InfoFrameDataType : uint
{
/// <summary>
/// Auxiliary Video data
/// </summary>
AuxiliaryVideoInformation = 2,
/// <summary>
/// Audio data
/// </summary>
AudioInformation = 4,
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible info-frame property modes
/// </summary>
public enum InfoFramePropertyMode : uint
{
/// <summary>
/// Driver determines whether to send info-frames.
/// </summary>
Auto = 0,
/// <summary>
/// Driver always sends info-frame.
/// </summary>
Enable,
/// <summary>
/// Driver never sends info-frame.
/// </summary>
Disable,
/// <summary>
/// Driver only sends info-frame when client requests it via info-frame escape call.
/// </summary>
AllowOverride
}
}

View File

@@ -0,0 +1,58 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for AVI aspect ratio portions
/// </summary>
public enum InfoFrameVideoAspectRatioActivePortion : uint
{
/// <summary>
/// Disabled or not available
/// </summary>
Disabled = 0,
/// <summary>
/// Letter box 16x9
/// </summary>
LetterboxGreaterThan16X9 = 4,
/// <summary>
/// Equal to the source frame size
/// </summary>
EqualCodedFrame = 8,
/// <summary>
/// Centered 4x3 ratio
/// </summary>
Center4X3 = 9,
/// <summary>
/// Centered 16x9 ratio
/// </summary>
Center16X9 = 10,
/// <summary>
/// Centered 14x9 ratio
/// </summary>
Center14X9 = 11,
/// <summary>
/// Bordered 4x3 on 14x9
/// </summary>
Bordered4X3On14X9 = 13,
/// <summary>
/// Bordered 16x9 on 14x9
/// </summary>
Bordered16X9On14X9 = 14,
/// <summary>
/// Bordered 16x9 on 4x3
/// </summary>
Bordered16X9On4X3 = 15,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 31
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Gets the possible values for AVI source aspect ratio
/// </summary>
public enum InfoFrameVideoAspectRatioCodedFrame : uint
{
/// <summary>
/// No data available
/// </summary>
NoData = 0,
/// <summary>
/// The 4x3 aspect ratio
/// </summary>
Aspect4X3,
/// <summary>
/// The 16x9 aspect ratio
/// </summary>
Aspect16X9,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI bar data that are available and should be used
/// </summary>
public enum InfoFrameVideoBarData : uint
{
/// <summary>
/// No bar data present
/// </summary>
NotPresent = 0,
/// <summary>
/// Vertical bar
/// </summary>
Vertical,
/// <summary>
/// Horizontal bar
/// </summary>
Horizontal,
/// <summary>
/// Both sides have bars
/// </summary>
Both,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI color formats
/// </summary>
public enum InfoFrameVideoColorFormat : uint
{
/// <summary>
/// The RGB color format
/// </summary>
RGB = 0,
/// <summary>
/// The YCbCr422 color format
/// </summary>
YCbCr422,
/// <summary>
/// The YCbCr444 color format
/// </summary>
YCbCr444,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the AVI color space
/// </summary>
public enum InfoFrameVideoColorimetry : uint
{
/// <summary>
/// No data available
/// </summary>
NoData = 0,
/// <summary>
/// The SMPTE170M color space
/// </summary>
SMPTE170M,
/// <summary>
/// The ITURBT709 color space
/// </summary>
ITURBT709,
/// <summary>
/// Extended colorimetry value should be used to get information regarding AVI color space
/// </summary>
UseExtendedColorimetry,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI content type
/// </summary>
public enum InfoFrameVideoContentType : uint
{
/// <summary>
/// Graphics content
/// </summary>
Graphics = 0,
/// <summary>
/// Photo content
/// </summary>
Photo,
/// <summary>
/// Cinematic content
/// </summary>
Cinema,
/// <summary>
/// Gaming content
/// </summary>
Game,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,41 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the AVI extended color space
/// </summary>
public enum InfoFrameVideoExtendedColorimetry : uint
{
/// <summary>
/// The xvYCC601 color space
/// </summary>
// ReSharper disable once InconsistentNaming
xvYCC601 = 0,
/// <summary>
/// The xvYCC709 color space
/// </summary>
// ReSharper disable once InconsistentNaming
xvYCC709,
/// <summary>
/// The sYCC601 color space
/// </summary>
// ReSharper disable once InconsistentNaming
sYCC601,
/// <summary>
/// The AdobeYCC601 color space
/// </summary>
AdobeYCC601,
/// <summary>
/// The AdobeRGB color space
/// </summary>
AdobeRGB,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 15
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI video content modes
/// </summary>
public enum InfoFrameVideoITC : uint
{
/// <summary>
/// Normal video content (Consumer Electronics)
/// </summary>
VideoContent = 0,
/// <summary>
/// Information Technology content
/// </summary>
ITContent,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 3
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the AVI non uniform picture scaling
/// </summary>
public enum InfoFrameVideoNonUniformPictureScaling : uint
{
/// <summary>
/// No data available
/// </summary>
NoData = 0,
/// <summary>
/// Horizontal scaling
/// </summary>
Horizontal,
/// <summary>
/// Vertical scaling
/// </summary>
Vertical,
/// <summary>
/// Scaling in both directions
/// </summary>
Both,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,63 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI pixel repetition values
/// </summary>
public enum InfoFrameVideoPixelRepetition : uint
{
/// <summary>
/// No pixel repetition
/// </summary>
None = 0,
/// <summary>
/// Two pixel repetition
/// </summary>
X2,
/// <summary>
/// Three pixel repetition
/// </summary>
X3,
/// <summary>
/// Four pixel repetition
/// </summary>
X4,
/// <summary>
/// Five pixel repetition
/// </summary>
X5,
/// <summary>
/// Six pixel repetition
/// </summary>
X6,
/// <summary>
/// Seven pixel repetition
/// </summary>
X7,
/// <summary>
/// Eight pixel repetition
/// </summary>
X8,
/// <summary>
/// Nine pixel repetition
/// </summary>
X9,
/// <summary>
/// Ten pixel repetition
/// </summary>
X10,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 31
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the AVI RGB quantization
/// </summary>
public enum InfoFrameVideoRGBQuantization : uint
{
/// <summary>
/// Default setting
/// </summary>
Default = 0,
/// <summary>
/// Limited RGB range [16-235] (86%)
/// </summary>
LimitedRange,
/// <summary>
/// Full RGB range [0-255] (100%)
/// </summary>
FullRange,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,28 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for AVI scan information
/// </summary>
public enum InfoFrameVideoScanInfo : uint
{
/// <summary>
/// No data available
/// </summary>
NoData = 0,
/// <summary>
/// Overscan
/// </summary>
OverScan,
/// <summary>
/// Underscan
/// </summary>
UnderScan,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible AVI YCC quantization
/// </summary>
public enum InfoFrameVideoYCCQuantization : uint
{
/// <summary>
/// Limited YCC range
/// </summary>
LimitedRange = 0,
/// <summary>
/// Full YCC range
/// </summary>
FullRange,
/// <summary>
/// Auto (Unspecified)
/// </summary>
Auto = 7
}
}

View File

@@ -0,0 +1,38 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible values for the monitor capabilities connector type
/// </summary>
public enum MonitorCapabilitiesConnectorType : uint
{
/// <summary>
/// Unknown or invalid connector
/// </summary>
Unknown = 0,
/// <summary>
/// VGA connector
/// </summary>
VGA,
/// <summary>
/// Composite connector (TV)
/// </summary>
TV,
/// <summary>
/// DVI connector
/// </summary>
DVI,
/// <summary>
/// HDMI connector
/// </summary>
HDMI,
/// <summary>
/// Display Port connector
/// </summary>
DisplayPort
}
}

View File

@@ -0,0 +1,18 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the monitor capabilities type
/// </summary>
public enum MonitorCapabilitiesType : uint
{
/// <summary>
/// The Vendor Specific Data Block
/// </summary>
VSDB = 0x1000,
/// <summary>
/// The Video Capability Data Block
/// </summary>
VCDB = 0x1001
}
}

View File

@@ -0,0 +1,33 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible rotate modes
/// </summary>
public enum Rotate : uint
{
/// <summary>
/// No rotation
/// </summary>
Degree0 = 0,
/// <summary>
/// 90 degree rotation
/// </summary>
Degree90 = 1,
/// <summary>
/// 180 degree rotation
/// </summary>
Degree180 = 2,
/// <summary>
/// 270 degree rotation
/// </summary>
Degree270 = 3,
/// <summary>
/// This value is ignored
/// </summary>
Ignored = 4
}
}

View File

@@ -0,0 +1,48 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Possible scaling modes
/// </summary>
public enum Scaling
{
/// <summary>
/// No change
/// </summary>
Default = 0,
/// <summary>
/// Balanced - Full Screen
/// </summary>
ToClosest = 1,
/// <summary>
/// Force GPU - Full Screen
/// </summary>
ToNative = 2,
/// <summary>
/// Force GPU - Centered\No Scaling
/// </summary>
GPUScanOutToNative = 3,
/// <summary>
/// Force GPU - Aspect Ratio
/// </summary>
ToAspectScanOutToNative = 5,
/// <summary>
/// Balanced - Aspect Ratio
/// </summary>
ToAspectScanOutToClosest = 6,
/// <summary>
/// Balanced - Centered\No Scaling
/// </summary>
GPUScanOutToClosest = 7,
/// <summary>
/// Customized scaling - For future use
/// </summary>
Customized = 255
}
}

View File

@@ -0,0 +1,13 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Holds a list of possible scan out composition configurable parameters
/// </summary>
public enum ScanOutCompositionParameter : uint
{
/// <summary>
/// Warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethod = 0
}
}

View File

@@ -0,0 +1,48 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Holds a list of possible scan out composition parameter values
/// </summary>
public enum ScanOutCompositionParameterValue : uint
{
/// <summary>
/// Default parameter value
/// </summary>
Default = 0,
/// <summary>
/// BiLinear value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBiLinear = 0x100,
/// <summary>
/// Bicubic Triangular value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicTriangular = 0x101,
/// <summary>
/// Bicubic Bell Shaped value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicBellShaped = 0x102,
/// <summary>
/// Bicubic B-Spline value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicBSpline = 0x103,
/// <summary>
/// Bicubic Adaptive Triangular value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicAdaptiveTriangular = 0x104,
/// <summary>
/// Bicubic Adaptive Bell Shaped value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicAdaptiveBellShaped = 0x105,
/// <summary>
/// Bicubic Adaptive B-Spline value for the warping re-sampling method parameter
/// </summary>
WarpingReSamplingMethodBicubicAdaptiveBSpline = 0x106
}
}

View File

@@ -0,0 +1,23 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Display spanning for Windows XP
/// </summary>
public enum SpanningOrientation
{
/// <summary>
/// No spanning
/// </summary>
None = 0,
/// <summary>
/// Horizontal spanning
/// </summary>
Horizontal = 1,
/// <summary>
/// Vertical spanning
/// </summary>
Vertical = 2
}
}

View File

@@ -0,0 +1,13 @@
namespace NvAPIWrapper.Native.Display
{
/// <summary>
/// Contains possible values for the type of the Static Metadata Descriptor block structure
/// </summary>
public enum StaticMetadataDescriptorId : uint
{
/// <summary>
/// Type 1 Static Metadata Descriptor block structure
/// </summary>
StaticMetadataType1 = 0
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds coordinates of a color in the color space
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct ColorDataColorCoordinate : IEquatable<ColorDataColorCoordinate>
{
private readonly ushort _X;
private readonly ushort _Y;
/// <summary>
/// Gets the color space's X coordinate
/// </summary>
public float X
{
get => (float) _X / 0xC350;
}
/// <summary>
/// Gets the color space's Y coordinate
/// </summary>
public float Y
{
get => (float) _Y / 0xC350;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataColorCoordinate" />.
/// </summary>
/// <param name="x">The color space's X coordinate.</param>
/// <param name="y">The color space's Y coordinate.</param>
public ColorDataColorCoordinate(float x, float y)
{
_X = (ushort) (Math.Min(Math.Max(x, 0), 1) * 0xC350);
_Y = (ushort) (Math.Min(Math.Max(y, 0), 1) * 0xC350);
}
/// <summary>
/// Creates an instance of <see cref="ColorDataColorCoordinate" />.
/// </summary>
/// <param name="coordinate">The color space's coordinates.</param>
public ColorDataColorCoordinate(PointF coordinate) : this(coordinate.X, coordinate.Y)
{
}
/// <inheritdoc />
public override string ToString()
{
return $"({X:F3}, {Y:F3})";
}
/// <inheritdoc />
public bool Equals(ColorDataColorCoordinate other)
{
return _X == other._X && _Y == other._Y;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
return obj is ColorDataColorCoordinate other && Equals(other);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (_X.GetHashCode() * 397) ^ _Y.GetHashCode();
}
}
/// <summary>
/// Checks two instance of <see cref="ColorDataColorCoordinate" /> for equality.
/// </summary>
/// <param name="left">The first instance.</param>
/// <param name="right">The second instance.</param>
/// <returns>true if both instances are equal, otherwise false.</returns>
public static bool operator ==(ColorDataColorCoordinate left, ColorDataColorCoordinate right)
{
return left.Equals(right);
}
/// <summary>
/// Checks two instance of <see cref="ColorDataColorCoordinate" /> for inequality.
/// </summary>
/// <param name="left">The first instance.</param>
/// <param name="right">The second instance.</param>
/// <returns>true if both instances are not equal, otherwise false.</returns>
public static bool operator !=(ColorDataColorCoordinate left, ColorDataColorCoordinate right)
{
return !left.Equals(right);
}
}
}

View File

@@ -0,0 +1,113 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct ColorDataV1 : IInitializable, IColorData
{
internal StructureVersion _Version;
internal ushort _Size;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
private readonly ColorDataBag _Data;
[StructLayout(LayoutKind.Sequential, Pack = 8)]
private struct ColorDataBag
{
public readonly byte ColorFormat;
public readonly byte Colorimetry;
public ColorDataBag(ColorDataFormat colorFormat, ColorDataColorimetry colorimetry)
{
ColorFormat = (byte)colorFormat;
Colorimetry = (byte)colorimetry;
}
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV1" /> to retrieve color data information
/// </summary>
/// <param name="command">The command to be executed.</param>
public ColorDataV1(ColorDataCommand command)
{
this = typeof(ColorDataV1).Instantiate<ColorDataV1>();
_Size = (ushort)_Version.StructureSize;
if (command != ColorDataCommand.Get && command != ColorDataCommand.GetDefault)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte)command;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV1" /> to modify the color data
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="colorimetry">The color data color space.</param>
public ColorDataV1(
ColorDataCommand command,
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry
)
{
this = typeof(ColorDataV1).Instantiate<ColorDataV1>();
_Size = (ushort)_Version.StructureSize;
if (command != ColorDataCommand.Set && command != ColorDataCommand.IsSupportedColor)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte)command;
_Data = new ColorDataBag(colorFormat, colorimetry);
}
/// <inheritdoc />
public ColorDataFormat ColorFormat
{
get => (ColorDataFormat)_Data.ColorFormat;
}
/// <inheritdoc />
public ColorDataColorimetry Colorimetry
{
get => (ColorDataColorimetry)_Data.Colorimetry;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => null;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get => null;
}
/// <inheritdoc />
public ColorDataSelectionPolicy? SelectionPolicy
{
get => null;
}
/// <inheritdoc />
public ColorDataDesktopDepth? DesktopColorDepth
{
get => null;
}
}
}

View File

@@ -0,0 +1,121 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(2)]
public struct ColorDataV2 : IInitializable, IColorData
{
internal StructureVersion _Version;
internal ushort _Size;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
private readonly ColorDataBag _Data;
[StructLayout(LayoutKind.Sequential, Pack = 8)]
private struct ColorDataBag
{
public readonly byte ColorFormat;
public readonly byte Colorimetry;
public readonly byte ColorDynamicRange;
public ColorDataBag(
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange
)
{
ColorFormat = (byte) colorFormat;
Colorimetry = (byte) colorimetry;
ColorDynamicRange = (byte) colorDynamicRange;
}
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV2" /> to retrieve color data information
/// </summary>
/// <param name="command">The command to be executed.</param>
public ColorDataV2(ColorDataCommand command)
{
this = typeof(ColorDataV2).Instantiate<ColorDataV2>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Get && command != ColorDataCommand.GetDefault)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV2" /> to modify the color data
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="colorimetry">The color data color space.</param>
/// <param name="colorDynamicRange">The color data dynamic range.</param>
public ColorDataV2(
ColorDataCommand command,
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange
)
{
this = typeof(ColorDataV2).Instantiate<ColorDataV2>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Set && command != ColorDataCommand.IsSupportedColor)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Data = new ColorDataBag(colorFormat, colorimetry, colorDynamicRange);
}
/// <inheritdoc />
public ColorDataFormat ColorFormat
{
get => (ColorDataFormat) _Data.ColorFormat;
}
/// <inheritdoc />
public ColorDataColorimetry Colorimetry
{
get => (ColorDataColorimetry) _Data.Colorimetry;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => (ColorDataDynamicRange) _Data.ColorDynamicRange;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get => null;
}
/// <inheritdoc />
public ColorDataSelectionPolicy? SelectionPolicy
{
get => null;
}
/// <inheritdoc />
public ColorDataDesktopDepth? DesktopColorDepth
{
get => null;
}
}
}

View File

@@ -0,0 +1,143 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(3)]
public struct ColorDataV3 : IInitializable, IColorData
{
internal StructureVersion _Version;
internal ushort _Size;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
private readonly ColorDataBag _Data;
[StructLayout(LayoutKind.Sequential, Pack = 8)]
private struct ColorDataBag
{
public readonly byte ColorFormat;
public readonly byte Colorimetry;
public readonly byte ColorDynamicRange;
public readonly ColorDataDepth ColorDepth;
public ColorDataBag(
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange,
ColorDataDepth colorDepth
)
{
ColorFormat = (byte) colorFormat;
Colorimetry = (byte) colorimetry;
ColorDynamicRange = (byte) colorDynamicRange;
ColorDepth = colorDepth;
}
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV3" /> to retrieve color data information
/// </summary>
/// <param name="command">The command to be executed.</param>
public ColorDataV3(ColorDataCommand command)
{
this = typeof(ColorDataV3).Instantiate<ColorDataV3>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Get && command != ColorDataCommand.GetDefault)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV3" /> to modify the color data
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="colorimetry">The color data color space.</param>
/// <param name="colorDynamicRange">The color data dynamic range.</param>
/// <param name="colorDepth">The color data color depth.</param>
public ColorDataV3(
ColorDataCommand command,
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange,
ColorDataDepth colorDepth
)
{
this = typeof(ColorDataV3).Instantiate<ColorDataV3>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Set && command != ColorDataCommand.IsSupportedColor)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Data = new ColorDataBag(colorFormat, colorimetry, colorDynamicRange, colorDepth);
}
/// <inheritdoc />
public ColorDataFormat ColorFormat
{
get => (ColorDataFormat) _Data.ColorFormat;
}
/// <inheritdoc />
public ColorDataColorimetry Colorimetry
{
get => (ColorDataColorimetry) _Data.Colorimetry;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => (ColorDataDynamicRange) _Data.ColorDynamicRange;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get
{
switch ((int) _Data.ColorDepth)
{
case 6:
return ColorDataDepth.BPC6;
case 8:
return ColorDataDepth.BPC8;
case 10:
return ColorDataDepth.BPC10;
case 12:
return ColorDataDepth.BPC12;
case 16:
return ColorDataDepth.BPC16;
default:
return _Data.ColorDepth;
}
}
}
/// <inheritdoc />
public ColorDataSelectionPolicy? SelectionPolicy
{
get => null;
}
/// <inheritdoc />
public ColorDataDesktopDepth? DesktopColorDepth
{
get => null;
}
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(4)]
public struct ColorDataV4 : IInitializable, IColorData
{
internal StructureVersion _Version;
internal ushort _Size;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
private readonly ColorDataBag _Data;
[StructLayout(LayoutKind.Sequential, Pack = 8)]
private struct ColorDataBag
{
public readonly byte ColorFormat;
public readonly byte Colorimetry;
public readonly byte ColorDynamicRange;
public readonly ColorDataDepth ColorDepth;
public readonly ColorDataSelectionPolicy ColorSelectionPolicy;
public ColorDataBag(
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange,
ColorDataDepth colorDepth,
ColorDataSelectionPolicy colorSelectionPolicy
)
{
ColorFormat = (byte) colorFormat;
Colorimetry = (byte) colorimetry;
ColorDynamicRange = (byte) colorDynamicRange;
ColorDepth = colorDepth;
ColorSelectionPolicy = colorSelectionPolicy;
}
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV4" /> to retrieve color data information
/// </summary>
/// <param name="command">The command to be executed.</param>
public ColorDataV4(ColorDataCommand command)
{
this = typeof(ColorDataV4).Instantiate<ColorDataV4>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Get && command != ColorDataCommand.GetDefault)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV4" /> to modify the color data
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="colorimetry">The color data color space.</param>
/// <param name="colorDynamicRange">The color data dynamic range.</param>
/// <param name="colorDepth">The color data color depth.</param>
/// <param name="colorSelectionPolicy">The color data selection policy.</param>
public ColorDataV4(
ColorDataCommand command,
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange,
ColorDataDepth colorDepth,
ColorDataSelectionPolicy colorSelectionPolicy
)
{
this = typeof(ColorDataV4).Instantiate<ColorDataV4>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Set && command != ColorDataCommand.IsSupportedColor)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Data = new ColorDataBag(colorFormat, colorimetry, colorDynamicRange, colorDepth, colorSelectionPolicy);
}
/// <inheritdoc />
public ColorDataFormat ColorFormat
{
get => (ColorDataFormat) _Data.ColorFormat;
}
/// <inheritdoc />
public ColorDataColorimetry Colorimetry
{
get => (ColorDataColorimetry) _Data.Colorimetry;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => (ColorDataDynamicRange) _Data.ColorDynamicRange;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get
{
switch ((int) _Data.ColorDepth)
{
case 6:
return ColorDataDepth.BPC6;
case 8:
return ColorDataDepth.BPC8;
case 10:
return ColorDataDepth.BPC10;
case 12:
return ColorDataDepth.BPC12;
case 16:
return ColorDataDepth.BPC16;
default:
return _Data.ColorDepth;
}
}
}
/// <inheritdoc />
public ColorDataSelectionPolicy? SelectionPolicy
{
get => _Data.ColorSelectionPolicy;
}
/// <inheritdoc />
public ColorDataDesktopDepth? DesktopColorDepth
{
get => null;
}
}
}

View File

@@ -0,0 +1,160 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(5)]
public struct ColorDataV5 : IInitializable, IColorData
{
internal StructureVersion _Version;
internal ushort _Size;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
private readonly ColorDataBag _Data;
[StructLayout(LayoutKind.Sequential, Pack = 8)]
private struct ColorDataBag
{
public readonly byte ColorFormat;
public readonly byte Colorimetry;
public readonly byte ColorDynamicRange;
public readonly ColorDataDepth ColorDepth;
public readonly ColorDataSelectionPolicy ColorSelectionPolicy;
public readonly ColorDataDesktopDepth DesktopColorDepth;
public ColorDataBag(
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange colorDynamicRange,
ColorDataDepth colorDepth,
ColorDataSelectionPolicy colorSelectionPolicy,
ColorDataDesktopDepth desktopColorDepth
)
{
ColorFormat = (byte) colorFormat;
Colorimetry = (byte) colorimetry;
ColorDynamicRange = (byte) colorDynamicRange;
ColorDepth = colorDepth;
ColorSelectionPolicy = colorSelectionPolicy;
DesktopColorDepth = desktopColorDepth;
}
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV5" /> to retrieve color data information
/// </summary>
/// <param name="command">The command to be executed.</param>
public ColorDataV5(ColorDataCommand command)
{
this = typeof(ColorDataV5).Instantiate<ColorDataV5>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Get && command != ColorDataCommand.GetDefault)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
}
/// <summary>
/// Creates an instance of <see cref="ColorDataV4" /> to modify the color data
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="colorimetry">The color data color space.</param>
/// <param name="dynamicRange">The color data dynamic range.</param>
/// <param name="colorDepth">The color data color depth.</param>
/// <param name="colorSelectionPolicy">The color data selection policy.</param>
/// <param name="desktopColorDepth">The color data desktop color depth.</param>
public ColorDataV5(
ColorDataCommand command,
ColorDataFormat colorFormat,
ColorDataColorimetry colorimetry,
ColorDataDynamicRange dynamicRange,
ColorDataDepth colorDepth,
ColorDataSelectionPolicy colorSelectionPolicy,
ColorDataDesktopDepth desktopColorDepth
)
{
this = typeof(ColorDataV5).Instantiate<ColorDataV5>();
_Size = (ushort) _Version.StructureSize;
if (command != ColorDataCommand.Set && command != ColorDataCommand.IsSupportedColor)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Data = new ColorDataBag(
colorFormat,
colorimetry,
dynamicRange,
colorDepth,
colorSelectionPolicy,
desktopColorDepth
);
}
/// <inheritdoc />
public ColorDataFormat ColorFormat
{
get => (ColorDataFormat) _Data.ColorFormat;
}
/// <inheritdoc />
public ColorDataColorimetry Colorimetry
{
get => (ColorDataColorimetry) _Data.Colorimetry;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => (ColorDataDynamicRange) _Data.ColorDynamicRange;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get
{
switch ((int) _Data.ColorDepth)
{
case 6:
return ColorDataDepth.BPC6;
case 8:
return ColorDataDepth.BPC8;
case 10:
return ColorDataDepth.BPC10;
case 12:
return ColorDataDepth.BPC12;
case 16:
return ColorDataDepth.BPC16;
default:
return _Data.ColorDepth;
}
}
}
/// <inheritdoc />
public ColorDataSelectionPolicy? SelectionPolicy
{
get => _Data.ColorSelectionPolicy;
}
/// <inheritdoc />
public ColorDataDesktopDepth? DesktopColorDepth
{
get => _Data.DesktopColorDepth;
}
}
}

View File

@@ -0,0 +1,135 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Hold information about a custom display resolution
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct CustomDisplay : IInitializable
{
internal StructureVersion _Version;
internal uint _Width;
internal uint _Height;
internal uint _Depth;
internal ColorFormat _ColorFormat;
internal ViewPortF _SourcePartition;
internal float _XRatio;
internal float _YRatio;
internal Timing _Timing;
internal uint _Flags;
/// <summary>
/// Gets the source surface (source mode) width.
/// </summary>
public uint Width
{
get => _Width;
}
/// <summary>
/// Gets the source surface (source mode) height.
/// </summary>
public uint Height
{
get => _Height;
}
/// <summary>
/// Gets the source surface color depth. "0" means all 8/16/32bpp.
/// </summary>
public uint Depth
{
get => _Depth;
}
/// <summary>
/// Gets the color format (optional)
/// </summary>
public ColorFormat ColorFormat
{
get => _ColorFormat;
}
/// <summary>
/// Gets the source partition viewport. All values are between [0, 1]. For multi-mon support, should be set to
/// (0,0,1.0,1.0) for now.
/// </summary>
public ViewPortF SourcePartition
{
get => _SourcePartition;
}
/// <summary>
/// Gets the horizontal scaling ratio.
/// </summary>
public float XRatio
{
get => _XRatio;
}
/// <summary>
/// Gets the vertical scaling ratio.
/// </summary>
public float YRatio
{
get => _YRatio;
}
/// <summary>
/// Gets the timing used to program TMDS/DAC/LVDS/HDMI/TVEncoder, etc.
/// </summary>
public Timing Timing
{
get => _Timing;
}
/// <summary>
/// Gets a boolean value indicating that a hardware mode-set without OS update should be performed.
/// </summary>
public bool HardwareModeSetOnly
{
get => _Flags.GetBit(0);
}
/// <summary>
/// Creates an instance of <see cref="CustomDisplay" />
/// </summary>
/// <param name="width">The source surface (source mode) width.</param>
/// <param name="height">The source surface (source mode) height.</param>
/// <param name="depth">The source surface color depth. "0" means all 8/16/32bpp.</param>
/// <param name="colorFormat">The color format (optional)</param>
/// <param name="xRatio">The horizontal scaling ratio.</param>
/// <param name="yRatio">The vertical scaling ratio.</param>
/// <param name="timing">The timing used to program TMDS/DAC/LVDS/HDMI/TVEncoder, etc.</param>
/// <param name="hwModeSetOnly">A boolean value indicating that a hardware mode-set without OS update should be performed.</param>
public CustomDisplay(
uint width,
uint height,
uint depth,
ColorFormat colorFormat,
float xRatio,
float yRatio,
Timing timing,
bool hwModeSetOnly
)
{
this = typeof(CustomDisplay).Instantiate<CustomDisplay>();
_Width = width;
_Height = height;
_Depth = depth;
_ColorFormat = colorFormat;
_SourcePartition = new ViewPortF(0, 0, 1, 1);
_XRatio = xRatio;
_YRatio = yRatio;
_Timing = timing;
_Flags = _Flags.SetBit(0, hwModeSetOnly);
}
}
}

View File

@@ -0,0 +1,70 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct DisplayColorData : IDisplayColorData
{
private readonly ColorDataColorCoordinate _FirstColorCoordinate;
private readonly ColorDataColorCoordinate _SecondColorCoordinate;
private readonly ColorDataColorCoordinate _ThirdColorCoordinate;
private readonly ColorDataColorCoordinate _WhiteColorCoordinate;
private readonly ushort _MaximumDesiredContentLuminance;
private readonly ushort _MinimumDesiredContentLuminance;
private readonly ushort _MaximumDesiredFrameAverageLightLevel;
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate FirstColorCoordinate
{
get => _FirstColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate SecondColorCoordinate
{
get => _SecondColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate ThirdColorCoordinate
{
get => _ThirdColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate WhiteColorCoordinate
{
get => _WhiteColorCoordinate;
}
/// <summary>
/// Gets the maximum desired content luminance [1.0-65535] in cd/m^2
/// </summary>
public float MaximumDesiredContentLuminance
{
get => _MaximumDesiredContentLuminance;
}
/// <summary>
/// Gets the maximum desired content frame average light level (a.k.a MaxFALL) [1.0-65535] in cd/m^2
/// </summary>
public float MaximumDesiredContentFrameAverageLightLevel
{
get => _MaximumDesiredFrameAverageLightLevel;
}
/// <summary>
/// Gets the maximum desired content luminance [1.0-6.5535] in cd/m^2
/// </summary>
public float MinimumDesiredContentLuminance
{
get => _MinimumDesiredContentLuminance / 10000f;
}
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// DisplayHandle is a one-to-one map to the GDI handle of an attached display in the Windows Display Properties
/// Settings page.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct DisplayHandle : IHandle, IEquatable<DisplayHandle>
{
internal readonly IntPtr _MemoryAddress;
/// <inheritdoc />
public IntPtr MemoryAddress
{
get => _MemoryAddress;
}
/// <inheritdoc />
public bool IsNull
{
get => _MemoryAddress == IntPtr.Zero;
}
/// <inheritdoc />
public bool Equals(DisplayHandle other)
{
return _MemoryAddress.Equals(other._MemoryAddress);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is DisplayHandle handle && Equals(handle);
}
/// <inheritdoc />
public override int GetHashCode()
{
return _MemoryAddress.GetHashCode();
}
/// <summary>
/// Checks for equality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are equal, otherwise false</returns>
public static bool operator ==(DisplayHandle left, DisplayHandle right)
{
return left.Equals(right);
}
/// <summary>
/// Checks for inequality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are not equal, otherwise false</returns>
public static bool operator !=(DisplayHandle left, DisplayHandle right)
{
return !left.Equals(right);
}
/// <inheritdoc />
public override string ToString()
{
return $"DisplayHandle #{MemoryAddress.ToInt64()}";
}
/// <summary>
/// Gets default DisplayHandle with a null pointer
/// </summary>
public static DisplayHandle DefaultHandle
{
get => default(DisplayHandle);
}
}
}

View File

@@ -0,0 +1,94 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IHDMISupportInfo" />
[StructLayout(LayoutKind.Explicit, Pack = 8)]
[StructureVersion(1)]
public struct HDMISupportInfoV1 : IInitializable, IHDMISupportInfo
{
[FieldOffset(0)] internal StructureVersion _Version;
[FieldOffset(4)] private readonly uint _Flags;
[FieldOffset(8)] private readonly uint _EDID861ExtensionRevision;
/// <inheritdoc />
public bool IsGPUCapableOfHDMIOutput
{
get => _Flags.GetBit(0);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfsYCC601
{
get => null;
}
/// <inheritdoc />
public bool IsMonitorCapableOfUnderscan
{
get => _Flags.GetBit(1);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfAdobeYCC601
{
get => null;
}
/// <inheritdoc />
public bool IsMonitorCapableOfBasicAudio
{
get => _Flags.GetBit(2);
}
/// <inheritdoc />
public bool IsMonitorCapableOfYCbCr444
{
get => _Flags.GetBit(3);
}
/// <inheritdoc />
public bool IsMonitorCapableOfYCbCr422
{
get => _Flags.GetBit(4);
}
/// <inheritdoc />
// ReSharper disable once IdentifierTypo
public bool IsMonitorCapableOfxvYCC601
{
get => _Flags.GetBit(5);
}
/// <inheritdoc />
// ReSharper disable once IdentifierTypo
public bool IsMonitorCapableOfxvYCC709
{
get => _Flags.GetBit(6);
}
/// <inheritdoc />
public bool IsHDMIMonitor
{
get => _Flags.GetBit(7);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfAdobeRGB
{
get => null;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public uint EDID861ExtensionRevision
{
get => _EDID861ExtensionRevision;
}
}
}

View File

@@ -0,0 +1,94 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IHDMISupportInfo" />
[StructLayout(LayoutKind.Explicit, Pack = 8)]
[StructureVersion(2)]
public struct HDMISupportInfoV2 : IInitializable, IHDMISupportInfo
{
[FieldOffset(0)] internal StructureVersion _Version;
[FieldOffset(4)] private readonly uint _Flags;
[FieldOffset(8)] private readonly uint _EDID861ExtensionRevision;
/// <inheritdoc />
public bool IsGPUCapableOfHDMIOutput
{
get => _Flags.GetBit(0);
}
/// <inheritdoc />
public bool IsMonitorCapableOfUnderscan
{
get => _Flags.GetBit(1);
}
/// <inheritdoc />
public bool IsMonitorCapableOfBasicAudio
{
get => _Flags.GetBit(2);
}
/// <inheritdoc />
public bool IsMonitorCapableOfYCbCr444
{
get => _Flags.GetBit(3);
}
/// <inheritdoc />
public bool IsMonitorCapableOfYCbCr422
{
get => _Flags.GetBit(4);
}
/// <inheritdoc />
// ReSharper disable once IdentifierTypo
public bool IsMonitorCapableOfxvYCC601
{
get => _Flags.GetBit(5);
}
/// <inheritdoc />
// ReSharper disable once IdentifierTypo
public bool IsMonitorCapableOfxvYCC709
{
get => _Flags.GetBit(6);
}
/// <inheritdoc />
public bool IsHDMIMonitor
{
get => _Flags.GetBit(7);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfsYCC601
{
get => _Flags.GetBit(8);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfAdobeYCC601
{
get => _Flags.GetBit(9);
}
/// <inheritdoc />
public bool? IsMonitorCapableOfAdobeRGB
{
get => _Flags.GetBit(10);
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public uint EDID861ExtensionRevision
{
get => _EDID861ExtensionRevision;
}
}
}

View File

@@ -0,0 +1,80 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains information regarding HDR capabilities of a display
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct HDRCapabilitiesV1 : IInitializable
{
internal StructureVersion _Version;
private readonly uint _RawReserved;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly StaticMetadataDescriptorId _StaticMetadataDescriptorId;
private readonly DisplayColorData _DisplayData;
internal HDRCapabilitiesV1(bool expandDriverDefaultHDRParameters)
{
this = typeof(HDRCapabilitiesV1).Instantiate<HDRCapabilitiesV1>();
_RawReserved = 0u.SetBit(3, expandDriverDefaultHDRParameters);
_StaticMetadataDescriptorId = StaticMetadataDescriptorId.StaticMetadataType1;
}
/// <summary>
/// Gets the display color space configurations
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public DisplayColorData DisplayData
{
get => _DisplayData;
}
/// <summary>
/// Gets a boolean value indicating if the HDMI2.0a UHDA HDR with ST2084 EOTF (CEA861.3) is supported.
/// </summary>
public bool IsST2084EOTFSupported
{
get => _RawReserved.GetBit(0);
}
/// <summary>
/// Gets a boolean value indicating if the HDMI2.0a traditional HDR gamma (CEA861.3) is supported.
/// </summary>
public bool IsTraditionalHDRGammaSupported
{
get => _RawReserved.GetBit(1);
}
/// <summary>
/// Gets a boolean value indicating if the Extended Dynamic Range on SDR displays is supported.
/// </summary>
public bool IsEDRSupported
{
get => _RawReserved.GetBit(2);
}
/// <summary>
/// Gets a boolean value indicating if the default EDID HDR parameters is expanded;
/// otherwise false if this instance contains actual HDR parameters.
/// </summary>
public bool IsDriverDefaultHDRParametersExpanded
{
get => _RawReserved.GetBit(3);
}
/// <summary>
/// Gets a boolean value indicating if the HDMI2.0a traditional SDR gamma is supported.
/// </summary>
public bool IsTraditionalSDRGammaSupported
{
get => _RawReserved.GetBit(4);
}
}
}

View File

@@ -0,0 +1,107 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IHDRColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct HDRColorDataV1 : IInitializable, IHDRColorData
{
internal StructureVersion _Version;
private readonly ColorDataHDRCommand _Command;
private readonly ColorDataHDRMode _HDRMode;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly StaticMetadataDescriptorId _StaticMetadataDescriptorId;
private readonly MasteringDisplayColorData _MasteringDisplayData;
/// <summary>
/// Creates an instance of <see cref="HDRColorDataV1" />.
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="hdrMode">The hdr mode.</param>
/// <param name="masteringDisplayData">The display color space configurations.</param>
public HDRColorDataV1(
ColorDataHDRCommand command,
ColorDataHDRMode hdrMode,
MasteringDisplayColorData masteringDisplayData = default
)
{
this = typeof(HDRColorDataV1).Instantiate<HDRColorDataV1>();
if (command != ColorDataHDRCommand.Set)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = command;
_HDRMode = hdrMode;
_MasteringDisplayData = masteringDisplayData;
_StaticMetadataDescriptorId = StaticMetadataDescriptorId.StaticMetadataType1;
}
/// <summary>
/// Creates an instance of <see cref="HDRColorDataV1" />.
/// </summary>
/// <param name="command">The command to be executed.</param>
public HDRColorDataV1(ColorDataHDRCommand command)
{
this = typeof(HDRColorDataV1).Instantiate<HDRColorDataV1>();
if (command != ColorDataHDRCommand.Get)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = command;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get => null;
}
/// <inheritdoc />
public ColorDataFormat? ColorFormat
{
get => null;
}
/// <summary>
/// Gets the color data command
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public ColorDataHDRCommand Command
{
get => _Command;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => null;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataHDRMode HDRMode
{
get => _HDRMode;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public MasteringDisplayColorData MasteringDisplayData
{
get => _MasteringDisplayData;
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc cref="IHDRColorData" />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(2)]
public struct HDRColorDataV2 : IInitializable, IHDRColorData
{
internal StructureVersion _Version;
private readonly ColorDataHDRCommand _Command;
private readonly ColorDataHDRMode _HDRMode;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly StaticMetadataDescriptorId _StaticMetadataDescriptorId;
private readonly MasteringDisplayColorData _MasteringDisplayData;
private readonly ColorDataFormat _ColorFormat;
private readonly ColorDataDynamicRange _DynamicRange;
private readonly ColorDataDepth _ColorDepth;
/// <summary>
/// Creates an instance of <see cref="HDRColorDataV2" />.
/// </summary>
/// <param name="command">The command to be executed.</param>
/// <param name="hdrMode">The hdr mode.</param>
/// <param name="masteringDisplayData">The display color space configurations.</param>
/// <param name="colorFormat">The color data color format.</param>
/// <param name="dynamicRange">The color data dynamic range.</param>
/// <param name="colorDepth">The color data color depth.</param>
public HDRColorDataV2(
ColorDataHDRCommand command,
ColorDataHDRMode hdrMode,
MasteringDisplayColorData masteringDisplayData = default,
ColorDataFormat colorFormat = ColorDataFormat.Default,
ColorDataDynamicRange dynamicRange = ColorDataDynamicRange.Auto,
ColorDataDepth colorDepth = ColorDataDepth.Default
)
{
this = typeof(HDRColorDataV2).Instantiate<HDRColorDataV2>();
if (command != ColorDataHDRCommand.Set)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = command;
_HDRMode = hdrMode;
_MasteringDisplayData = masteringDisplayData;
_ColorFormat = colorFormat;
_DynamicRange = dynamicRange;
_ColorDepth = colorDepth;
_StaticMetadataDescriptorId = StaticMetadataDescriptorId.StaticMetadataType1;
}
/// <summary>
/// Creates an instance of <see cref="HDRColorDataV2" />.
/// </summary>
/// <param name="command">The command to be executed.</param>
public HDRColorDataV2(ColorDataHDRCommand command)
{
this = typeof(HDRColorDataV2).Instantiate<HDRColorDataV2>();
if (command != ColorDataHDRCommand.Get)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = command;
}
/// <summary>
/// Gets the color data command
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public ColorDataHDRCommand Command
{
get => _Command;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataHDRMode HDRMode
{
get => _HDRMode;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public MasteringDisplayColorData MasteringDisplayData
{
get => _MasteringDisplayData;
}
/// <inheritdoc />
public ColorDataFormat? ColorFormat
{
get => _ColorFormat;
}
/// <inheritdoc />
public ColorDataDynamicRange? DynamicRange
{
get => _DynamicRange;
}
/// <inheritdoc />
public ColorDataDepth? ColorDepth
{
get
{
switch ((uint) _ColorDepth)
{
case 6:
return ColorDataDepth.BPC6;
case 8:
return ColorDataDepth.BPC8;
case 10:
return ColorDataDepth.BPC10;
case 12:
return ColorDataDepth.BPC12;
case 16:
return ColorDataDepth.BPC16;
default:
return _ColorDepth;
}
}
}
}
}

View File

@@ -0,0 +1,142 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains info-frame audio information
/// </summary>
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public struct InfoFrameAudio
{
[FieldOffset(0)] private readonly uint _WordAt0;
[FieldOffset(4)] private readonly uint _WordAt4;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
[FieldOffset(8)] private readonly uint _WordAt8;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
[FieldOffset(12)] private readonly byte _ByteAt12;
/// <summary>
/// Creates an instance of <see cref="InfoFrameAudio" />.
/// </summary>
/// <param name="codec">The audio coding type (codec)</param>
/// <param name="codecExtension">The audio codec from codec extension</param>
/// <param name="sampleSize">The audio sample size (depth)</param>
/// <param name="sampleRate">The audio sample rate (sampling frequency)</param>
/// <param name="channelCount">The number of audio channels</param>
/// <param name="channelAllocation">The audio channel allocation (speaker placements)</param>
/// <param name="isDownMixProhibited">A value indicating if down-mix is prohibited</param>
/// <param name="lfePlaybackLevel">The Low Frequency Effects playback level value</param>
/// <param name="levelShift">The audio level shift value</param>
public InfoFrameAudio(
InfoFrameAudioCodec codec,
InfoFrameAudioExtendedCodec codecExtension,
InfoFrameAudioSampleSize sampleSize,
InfoFrameAudioSampleRate sampleRate,
InfoFrameAudioChannelCount channelCount,
InfoFrameAudioChannelAllocation channelAllocation,
InfoFrameBoolean isDownMixProhibited,
InfoFrameAudioLFEPlaybackLevel lfePlaybackLevel,
InfoFrameAudioLevelShift levelShift
)
{
_WordAt0 = 0u
.SetBits(0, 5, (uint) codec)
.SetBits(5, 6, (uint) codecExtension)
.SetBits(11, 3, (uint) sampleSize)
.SetBits(14, 4, (uint) sampleRate)
.SetBits(18, 4, (uint) channelCount)
.SetBits(22, 9, (uint) channelAllocation);
_WordAt4 = 0u
.SetBits(0, 2, (uint) isDownMixProhibited)
.SetBits(2, 3, (uint) lfePlaybackLevel)
.SetBits(5, 5, (uint) levelShift);
_WordAt8 = 0;
_ByteAt12 = 0;
}
/// <summary>
/// Gets the audio coding type (codec)
/// </summary>
public InfoFrameAudioCodec Codec
{
get => (InfoFrameAudioCodec) _WordAt0.GetBits(0, 5);
}
/// <summary>
/// Gets the audio codec from codec extension; only valid when
/// <see cref="Codec" /> == <see cref="InfoFrameAudioCodec.UseExtendedCodecType" />
/// </summary>
public InfoFrameAudioExtendedCodec? ExtendedCodec
{
get
{
if (Codec != InfoFrameAudioCodec.UseExtendedCodecType)
{
return null;
}
return (InfoFrameAudioExtendedCodec) _WordAt0.GetBits(5, 6);
}
}
/// <summary>
/// Gets the audio sample size (depth)
/// </summary>
public InfoFrameAudioSampleSize SampleSize
{
get => (InfoFrameAudioSampleSize) _WordAt0.GetBits(11, 3);
}
/// <summary>
/// Gets the audio sample rate (sampling frequency)
/// </summary>
public InfoFrameAudioSampleRate SampleRate
{
get => (InfoFrameAudioSampleRate) _WordAt0.GetBits(14, 4);
}
/// <summary>
/// Gets the number of audio channels
/// </summary>
public InfoFrameAudioChannelCount ChannelCount
{
get => (InfoFrameAudioChannelCount) _WordAt0.GetBits(18, 4);
}
/// <summary>
/// Gets the audio channel allocation (speaker placements)
/// </summary>
public InfoFrameAudioChannelAllocation ChannelAllocation
{
get => (InfoFrameAudioChannelAllocation) _WordAt0.GetBits(22, 9);
}
/// <summary>
/// Gets a value indicating if down-mix is prohibited
/// </summary>
public InfoFrameBoolean IsDownMixProhibited
{
get => (InfoFrameBoolean) _WordAt4.GetBits(0, 2);
}
/// <summary>
/// Gets the Low Frequency Effects playback level value
/// </summary>
public InfoFrameAudioLFEPlaybackLevel LFEPlaybackLevel
{
get => (InfoFrameAudioLFEPlaybackLevel) _WordAt4.GetBits(2, 3);
}
/// <summary>
/// Gets the audio level shift value
/// </summary>
public InfoFrameAudioLevelShift LevelShift
{
get => (InfoFrameAudioLevelShift) _WordAt4.GetBits(5, 5);
}
}
}

View File

@@ -0,0 +1,199 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains info-frame requested information or information to be overriden
/// </summary>
[StructLayout(LayoutKind.Explicit, Pack = 8)]
[StructureVersion(1)]
public struct InfoFrameData : IInitializable
{
[FieldOffset(0)] internal StructureVersion _Version;
[FieldOffset(4)]
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly ushort _Size;
[FieldOffset(6)]
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
private readonly byte _Command;
[FieldOffset(7)] private readonly byte _Type;
[FieldOffset(8)] private readonly InfoFrameProperty _Property;
[FieldOffset(8)] private readonly InfoFrameAudio _Audio;
[FieldOffset(8)] private readonly InfoFrameVideo _Video;
/// <summary>
/// Creates a new instance of <see cref="InfoFrameData" />.
/// </summary>
/// <param name="command">
/// The operation to be done. Can be used for information retrieval or to reset configurations to
/// default.
/// </param>
/// <param name="dataType">The type of information.</param>
public InfoFrameData(InfoFrameCommand command, InfoFrameDataType dataType)
{
this = typeof(InfoFrameData).Instantiate<InfoFrameData>();
_Size = (ushort) _Version.StructureSize;
if (command != InfoFrameCommand.Get &&
command != InfoFrameCommand.GetDefault &&
command != InfoFrameCommand.GetOverride &&
command != InfoFrameCommand.GetProperty &&
command != InfoFrameCommand.Reset)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Type = (byte) dataType;
}
/// <summary>
/// Creates a new instance of <see cref="InfoFrameData" />.
/// </summary>
/// <param name="command">The operation to be done. Can only be used to change property information.</param>
/// <param name="dataType">The type of information.</param>
/// <param name="propertyInformation">The new property information to be set.</param>
public InfoFrameData(
InfoFrameCommand command,
InfoFrameDataType dataType,
InfoFrameProperty propertyInformation)
{
this = typeof(InfoFrameData).Instantiate<InfoFrameData>();
_Size = (ushort) _Version.StructureSize;
if (command != InfoFrameCommand.SetProperty)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Type = (byte) dataType;
_Property = propertyInformation;
}
/// <summary>
/// Creates a new instance of <see cref="InfoFrameData" />.
/// </summary>
/// <param name="command">The operation to be done. Can only be used to change current or default audio information.</param>
/// <param name="audioInformation">The new audio information to be set.</param>
public InfoFrameData(InfoFrameCommand command, InfoFrameAudio audioInformation)
{
this = typeof(InfoFrameData).Instantiate<InfoFrameData>();
_Size = (ushort) _Version.StructureSize;
if (command != InfoFrameCommand.Set &&
command != InfoFrameCommand.SetOverride)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Type = (byte) InfoFrameDataType.AudioInformation;
_Audio = audioInformation;
}
/// <summary>
/// Creates a new instance of <see cref="InfoFrameData" />.
/// </summary>
/// <param name="command">The operation to be done. Can only be used to change current or default video information.</param>
/// <param name="videoInformation">The new video information to be set.</param>
public InfoFrameData(InfoFrameCommand command, InfoFrameVideo videoInformation)
{
this = typeof(InfoFrameData).Instantiate<InfoFrameData>();
_Size = (ushort) _Version.StructureSize;
if (command != InfoFrameCommand.Set &&
command != InfoFrameCommand.SetOverride)
{
throw new ArgumentOutOfRangeException(nameof(command));
}
_Command = (byte) command;
_Type = (byte) InfoFrameDataType.AuxiliaryVideoInformation;
_Video = videoInformation;
}
/// <summary>
/// Gets the type of data contained in this instance
/// </summary>
public InfoFrameDataType Type
{
get => (InfoFrameDataType) _Type;
}
/// <summary>
/// Gets the operation type
/// </summary>
public InfoFrameCommand Command
{
get => (InfoFrameCommand) _Command;
}
/// <summary>
/// Gets the info-frame audio information if available; otherwise null
/// </summary>
public InfoFrameAudio? AudioInformation
{
get
{
if (Command == InfoFrameCommand.GetProperty || Command == InfoFrameCommand.SetProperty)
{
return null;
}
if (Type == InfoFrameDataType.AudioInformation)
{
return _Audio;
}
return null;
}
}
/// <summary>
/// Gets the info-frame auxiliary video information (AVI) if available; otherwise null
/// </summary>
public InfoFrameVideo? AuxiliaryVideoInformation
{
get
{
if (Command == InfoFrameCommand.GetProperty || Command == InfoFrameCommand.SetProperty)
{
return null;
}
if (Type == InfoFrameDataType.AuxiliaryVideoInformation)
{
return _Video;
}
return null;
}
}
/// <summary>
/// Gets the info-frame property information if available; otherwise null
/// </summary>
public InfoFrameProperty? PropertyInformation
{
get
{
if (Command != InfoFrameCommand.GetProperty && Command != InfoFrameCommand.SetProperty)
{
return null;
}
return _Property;
}
}
}
}

View File

@@ -0,0 +1,58 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains info-frame property information
/// </summary>
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public struct InfoFrameProperty
{
[FieldOffset(0)] private readonly uint _Word;
/// <summary>
/// Creates an instance of <see cref="InfoFrameProperty" />.
/// </summary>
/// <param name="mode">The info-frame operation mode</param>
/// <param name="isBlackListed">A value indicating if this display (monitor) is blacklisted</param>
public InfoFrameProperty(InfoFramePropertyMode mode, InfoFrameBoolean isBlackListed)
{
_Word = 0u
.SetBits(0, 4, (uint) mode)
.SetBits(4, 2, (uint) isBlackListed);
}
/// <summary>
/// Gets the info-frame operation mode
/// </summary>
public InfoFramePropertyMode Mode
{
get => (InfoFramePropertyMode) _Word.GetBits(0, 4);
}
/// <summary>
/// Gets a value indicating if this display (monitor) is blacklisted
/// </summary>
public InfoFrameBoolean IsBlackListed
{
get => (InfoFrameBoolean) _Word.GetBits(4, 2);
}
/// <summary>
/// Gets the info-frame version
/// </summary>
public byte Version
{
get => (byte) _Word.GetBits(16, 8);
}
/// <summary>
/// Gets the info-frame length
/// </summary>
public byte Length
{
get => (byte) _Word.GetBits(24, 8);
}
}
}

View File

@@ -0,0 +1,320 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains info-frame video information
/// </summary>
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public struct InfoFrameVideo
{
[FieldOffset(0)] private readonly uint _WordAt0;
[FieldOffset(4)] private readonly uint _WordAt4;
[FieldOffset(8)] private readonly uint _WordAt8;
[FieldOffset(12)] private readonly uint _WordAt12;
[FieldOffset(16)] private readonly uint _WordAt16;
[FieldOffset(20)] private readonly uint _WordAt20;
/// <summary>
/// Creates an instance of <see cref="InfoFrameVideo" />.
/// </summary>
/// <param name="videoIdentificationCode">The video identification code (VIC)</param>
/// <param name="pixelRepetition">The video pixel repetition</param>
/// <param name="colorFormat">The video color format</param>
/// <param name="colorimetry">The video color space</param>
/// <param name="extendedColorimetry">The extended video color space</param>
/// <param name="rgbQuantization">The RGB quantization configuration</param>
/// <param name="yccQuantization">The YCC quantization configuration</param>
/// <param name="contentMode">The video content mode</param>
/// <param name="contentType">The video content type</param>
/// <param name="scanInfo">The video scan information</param>
/// <param name="isActiveFormatInfoPresent">A value indicating if the active format information is present</param>
/// <param name="activeFormatAspectRatio">The active format aspect ratio</param>
/// <param name="pictureAspectRatio">The picture aspect ratio</param>
/// <param name="nonUniformPictureScaling">The non uniform picture scaling direction</param>
/// <param name="barInfo">The video bar information</param>
/// <param name="topBar">The top bar value if not auto and present; otherwise null</param>
/// <param name="bottomBar">The bottom bar value if not auto and present; otherwise null</param>
/// <param name="leftBar">The left bar value if not auto and present; otherwise null</param>
/// <param name="rightBar">The right bar value if not auto and present; otherwise null</param>
public InfoFrameVideo(
byte videoIdentificationCode,
InfoFrameVideoPixelRepetition pixelRepetition,
InfoFrameVideoColorFormat colorFormat,
InfoFrameVideoColorimetry colorimetry,
InfoFrameVideoExtendedColorimetry extendedColorimetry,
InfoFrameVideoRGBQuantization rgbQuantization,
InfoFrameVideoYCCQuantization yccQuantization,
InfoFrameVideoITC contentMode,
InfoFrameVideoContentType contentType,
InfoFrameVideoScanInfo scanInfo,
InfoFrameBoolean isActiveFormatInfoPresent,
InfoFrameVideoAspectRatioActivePortion activeFormatAspectRatio,
InfoFrameVideoAspectRatioCodedFrame pictureAspectRatio,
InfoFrameVideoNonUniformPictureScaling nonUniformPictureScaling,
InfoFrameVideoBarData barInfo,
uint? topBar,
uint? bottomBar,
uint? leftBar,
uint? rightBar
)
{
_WordAt0 = 0u
.SetBits(0, 8, videoIdentificationCode)
.SetBits(8, 5, (uint) pixelRepetition)
.SetBits(13, 3, (uint) colorFormat)
.SetBits(16, 3, (uint) colorimetry)
.SetBits(19, 4, (uint) extendedColorimetry)
.SetBits(23, 3, (uint) rgbQuantization)
.SetBits(26, 3, (uint) yccQuantization)
.SetBits(29, 2, (uint) contentMode);
_WordAt4 = 0u
.SetBits(0, 3, (uint) contentType)
.SetBits(3, 3, (uint) scanInfo)
.SetBits(6, 2, (uint) isActiveFormatInfoPresent)
.SetBits(8, 5, (uint) activeFormatAspectRatio)
.SetBits(13, 3, (uint) pictureAspectRatio)
.SetBits(16, 3, (uint) nonUniformPictureScaling)
.SetBits(19, 3, (uint) barInfo);
_WordAt8 = topBar == null ? 0x1FFFF : 0u.SetBits(0, 17, topBar.Value);
_WordAt12 = bottomBar == null ? 0x1FFFF : 0u.SetBits(0, 17, bottomBar.Value);
_WordAt16 = leftBar == null ? 0x1FFFF : 0u.SetBits(0, 17, leftBar.Value);
_WordAt20 = rightBar == null ? 0x1FFFF : 0u.SetBits(0, 17, rightBar.Value);
}
/// <summary>
/// Gets the video identification code (VIC)
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public byte? VideoIdentificationCode
{
get
{
var value = (byte) _WordAt0.GetBits(0, 8);
if (value == 0xFF)
{
return null;
}
return value;
}
}
/// <summary>
/// Gets the video pixel repetition
/// </summary>
public InfoFrameVideoPixelRepetition PixelRepetition
{
get => (InfoFrameVideoPixelRepetition) _WordAt0.GetBits(8, 5);
}
/// <summary>
/// Gets the video color format
/// </summary>
public InfoFrameVideoColorFormat ColorFormat
{
get => (InfoFrameVideoColorFormat) _WordAt0.GetBits(13, 3);
}
/// <summary>
/// Gets the video color space
/// </summary>
public InfoFrameVideoColorimetry Colorimetry
{
get => (InfoFrameVideoColorimetry) _WordAt0.GetBits(16, 3);
}
/// <summary>
/// Gets the extended video color space; only valid when <see cref="Colorimetry" /> ==
/// <see cref="InfoFrameVideoColorimetry.UseExtendedColorimetry" />
/// </summary>
public InfoFrameVideoExtendedColorimetry? ExtendedColorimetry
{
get
{
if (Colorimetry != InfoFrameVideoColorimetry.UseExtendedColorimetry)
{
return null;
}
return (InfoFrameVideoExtendedColorimetry) _WordAt0.GetBits(19, 4);
}
}
/// <summary>
/// Gets the RGB quantization configuration
/// </summary>
public InfoFrameVideoRGBQuantization RGBQuantization
{
get => (InfoFrameVideoRGBQuantization) _WordAt0.GetBits(23, 3);
}
/// <summary>
/// Gets the YCC quantization configuration
/// </summary>
public InfoFrameVideoYCCQuantization YCCQuantization
{
get => (InfoFrameVideoYCCQuantization) _WordAt0.GetBits(26, 3);
}
/// <summary>
/// Gets the video content mode
/// </summary>
public InfoFrameVideoITC ContentMode
{
get => (InfoFrameVideoITC) _WordAt0.GetBits(29, 2);
}
/// <summary>
/// Gets the video content type
/// </summary>
public InfoFrameVideoContentType ContentType
{
get => (InfoFrameVideoContentType) _WordAt4.GetBits(0, 3);
}
/// <summary>
/// Gets the video scan information
/// </summary>
public InfoFrameVideoScanInfo ScanInfo
{
get => (InfoFrameVideoScanInfo) _WordAt4.GetBits(3, 3);
}
/// <summary>
/// Gets a value indicating if the active format information is present
/// </summary>
public InfoFrameBoolean IsActiveFormatInfoPresent
{
get => (InfoFrameBoolean) _WordAt4.GetBits(6, 2);
}
/// <summary>
/// Gets the active format aspect ratio
/// </summary>
public InfoFrameVideoAspectRatioActivePortion ActiveFormatAspectRatio
{
get => (InfoFrameVideoAspectRatioActivePortion) _WordAt4.GetBits(8, 5);
}
/// <summary>
/// Gets the picture aspect ratio
/// </summary>
public InfoFrameVideoAspectRatioCodedFrame PictureAspectRatio
{
get => (InfoFrameVideoAspectRatioCodedFrame) _WordAt4.GetBits(13, 3);
}
/// <summary>
/// Gets the non uniform picture scaling direction
/// </summary>
public InfoFrameVideoNonUniformPictureScaling NonUniformPictureScaling
{
get => (InfoFrameVideoNonUniformPictureScaling) _WordAt4.GetBits(16, 3);
}
/// <summary>
/// Gets the video bar information
/// </summary>
public InfoFrameVideoBarData BarInfo
{
get => (InfoFrameVideoBarData) _WordAt4.GetBits(19, 3);
}
/// <summary>
/// Gets the top bar value if not auto and present; otherwise null
/// </summary>
public uint? TopBar
{
get
{
if (BarInfo == InfoFrameVideoBarData.NotPresent || BarInfo == InfoFrameVideoBarData.Horizontal)
{
return null;
}
var val = _WordAt8.GetBits(0, 17);
if (val == 0x1FFFF)
{
return null;
}
return (uint) val;
}
}
/// <summary>
/// Gets the bottom bar value if not auto and present; otherwise null
/// </summary>
public uint? BottomBar
{
get
{
if (BarInfo == InfoFrameVideoBarData.NotPresent || BarInfo == InfoFrameVideoBarData.Horizontal)
{
return null;
}
var val = _WordAt12.GetBits(0, 17);
if (val == 0x1FFFF)
{
return null;
}
return (uint) val;
}
}
/// <summary>
/// Gets the left bar value if not auto and present; otherwise null
/// </summary>
public uint? LeftBar
{
get
{
if (BarInfo == InfoFrameVideoBarData.NotPresent || BarInfo == InfoFrameVideoBarData.Vertical)
{
return null;
}
var val = _WordAt16.GetBits(0, 17);
if (val == 0x1FFFF)
{
return null;
}
return (uint) val;
}
}
/// <summary>
/// Gets the right bar value if not auto and present; otherwise null
/// </summary>
public uint? RightBar
{
get
{
if (BarInfo == InfoFrameVideoBarData.NotPresent || BarInfo == InfoFrameVideoBarData.Vertical)
{
return null;
}
var val = _WordAt20.GetBits(0, 17);
if (val == 0x1FFFF)
{
return null;
}
return (uint) val;
}
}
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Runtime.InteropServices;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Locally unique identifier is a 64-bit value guaranteed to be unique only on the system on which it was generated.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct LUID : IEquatable<LUID>
{
/// <summary>
/// 32Bit unsigned integer, low
/// </summary>
public readonly uint LowPart;
/// <summary>
/// 32Bit signed integer, high
/// </summary>
public readonly int HighPart;
/// <inheritdoc />
public override string ToString()
{
return $"{{{LowPart:X}-{HighPart:X}}}";
}
/// <inheritdoc />
public bool Equals(LUID other)
{
return LowPart == other.LowPart && HighPart == other.HighPart;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is LUID luid && Equals(luid);
}
/// <summary>
/// Checks for equality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are equal, otherwise false</returns>
public static bool operator ==(LUID left, LUID right)
{
return left.Equals(right);
}
/// <summary>
/// Checks for inequality between two objects of same type
/// </summary>
/// <param name="left">The first object</param>
/// <param name="right">The second object</param>
/// <returns>true, if both objects are not equal, otherwise false</returns>
public static bool operator !=(LUID left, LUID right)
{
return !left.Equals(right);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return ((int) LowPart * 397) ^ HighPart;
}
}
}
}

View File

@@ -0,0 +1,120 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <inheritdoc />
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct MasteringDisplayColorData : IDisplayColorData
{
private readonly ColorDataColorCoordinate _FirstColorCoordinate;
private readonly ColorDataColorCoordinate _SecondColorCoordinate;
private readonly ColorDataColorCoordinate _ThirdColorCoordinate;
private readonly ColorDataColorCoordinate _WhiteColorCoordinate;
private readonly ushort _MaximumMasteringLuminance;
private readonly ushort _MinimumMasteringLuminance;
private readonly ushort _MaximumContentLightLevel;
private readonly ushort _MaximumFrameAverageLightLevel;
/// <summary>
/// Creates an instance of <see cref="MasteringDisplayColorData" />.
/// </summary>
/// <param name="firstColorCoordinate">The first primary color coordinate.</param>
/// <param name="secondColorCoordinate">The second primary color coordinate.</param>
/// <param name="thirdColorCoordinate">The third primary color coordinate.</param>
/// <param name="whiteColorCoordinate">The white color coordinate.</param>
/// <param name="maximumMasteringLuminance">The maximum mastering display luminance [1.0-65535] in cd/m^2</param>
/// <param name="minimumMasteringLuminance">The maximum mastering display luminance [1.0-6.5535] in cd/m^2</param>
/// <param name="maximumContentLightLevel">
/// The maximum mastering display content light level (a.k.a MaxCLL) [1.0-65535] in
/// cd/m^2
/// </param>
/// <param name="maximumFrameAverageLightLevel">
/// The maximum mastering display frame average light level (a.k.a MaxFALL)
/// [1.0-65535] in cd/m^2
/// </param>
public MasteringDisplayColorData(
ColorDataColorCoordinate firstColorCoordinate,
ColorDataColorCoordinate secondColorCoordinate,
ColorDataColorCoordinate thirdColorCoordinate,
ColorDataColorCoordinate whiteColorCoordinate,
float maximumMasteringLuminance,
float minimumMasteringLuminance,
float maximumContentLightLevel,
float maximumFrameAverageLightLevel
)
{
_FirstColorCoordinate = firstColorCoordinate;
_SecondColorCoordinate = secondColorCoordinate;
_ThirdColorCoordinate = thirdColorCoordinate;
_WhiteColorCoordinate = whiteColorCoordinate;
_MaximumMasteringLuminance = (ushort) Math.Max(Math.Min(maximumMasteringLuminance, uint.MaxValue), 1);
_MinimumMasteringLuminance =
(ushort) Math.Max(Math.Min(minimumMasteringLuminance * 10000, uint.MaxValue), 1);
_MaximumContentLightLevel = (ushort) Math.Max(Math.Min(maximumContentLightLevel, uint.MaxValue), 1);
_MaximumFrameAverageLightLevel =
(ushort) Math.Max(Math.Min(maximumFrameAverageLightLevel, uint.MaxValue), 1);
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate FirstColorCoordinate
{
get => _FirstColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate SecondColorCoordinate
{
get => _SecondColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate ThirdColorCoordinate
{
get => _ThirdColorCoordinate;
}
/// <inheritdoc />
// ReSharper disable once ConvertToAutoProperty
public ColorDataColorCoordinate WhiteColorCoordinate
{
get => _WhiteColorCoordinate;
}
/// <summary>
/// Gets the maximum mastering display luminance [1.0-65535] in cd/m^2
/// </summary>
public float MaximumMasteringLuminance
{
get => _MaximumMasteringLuminance;
}
/// <summary>
/// Gets the maximum mastering display frame average light level (a.k.a MaxFALL) [1.0-65535] in cd/m^2
/// </summary>
public float MaximumFrameAverageLightLevel
{
get => _MaximumFrameAverageLightLevel;
}
/// <summary>
/// Gets the maximum mastering display content light level (a.k.a MaxCLL) [1.0-65535] in cd/m^2
/// </summary>
public float MaximumContentLightLevel
{
get => _MaximumContentLightLevel;
}
/// <summary>
/// Gets the maximum mastering display luminance [1.0-6.5535] in cd/m^2
/// </summary>
public float MinimumMasteringLuminance
{
get => _MinimumMasteringLuminance / 10000f;
}
}
}

View File

@@ -0,0 +1,96 @@
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains the monitor capabilities read from the Vendor Specific Data Block or the Video Capability Data Block
/// </summary>
[StructureVersion(1)]
[StructLayout(LayoutKind.Explicit, Pack = 8)]
public struct MonitorCapabilities : IInitializable
{
[FieldOffset(0)] internal StructureVersion _Version;
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
[FieldOffset(4)] private readonly ushort _Size;
[FieldOffset(8)] private readonly MonitorCapabilitiesType _Type;
[FieldOffset(12)] private readonly MonitorCapabilitiesConnectorType _ConnectorType;
[FieldOffset(16)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
private readonly byte[] _Data;
/// <summary>
/// Creates a new instance of <see cref="MonitorCapabilities" />.
/// </summary>
/// <param name="type">The type of information to be retrieved.</param>
public MonitorCapabilities(MonitorCapabilitiesType type)
{
this = typeof(MonitorCapabilities).Instantiate<MonitorCapabilities>();
_Size = (ushort) _Version.StructureSize;
_Type = type;
}
/// <summary>
/// Gets a boolean value indicating if this instance contains valid information
/// </summary>
public bool IsValid
{
get => _Data[0].GetBit(0);
}
/// <summary>
/// Gets the monitor capability type
/// </summary>
// ReSharper disable once ConvertToAutoPropertyWhenPossible
public MonitorCapabilitiesType Type
{
get => _Type;
}
/// <summary>
/// Gets the monitor connector type
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public MonitorCapabilitiesConnectorType ConnectorType
{
get => _ConnectorType;
}
/// <summary>
/// Gets the monitor VCDB capabilities information
/// </summary>
public MonitorVCDBCapabilities? VCDBCapabilities
{
get
{
if (IsValid && _Type == MonitorCapabilitiesType.VCDB)
{
return new MonitorVCDBCapabilities(_Data.Skip(1).ToArray());
}
return null;
}
}
/// <summary>
/// Gets the monitor VSDB capabilities information
/// </summary>
public MonitorVSDBCapabilities? VSDBCapabilities
{
get
{
if (IsValid && _Type == MonitorCapabilitiesType.VSDB)
{
return new MonitorVSDBCapabilities(_Data.Skip(1).ToArray());
}
return null;
}
}
}
}

View File

@@ -0,0 +1,57 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains information about a monitor color data
/// </summary>
[StructureVersion(1)]
[StructLayout(LayoutKind.Explicit, Pack = 8, Size = 12)]
public struct MonitorColorData : IInitializable
{
[FieldOffset(0)]
internal StructureVersion _Version;
[FieldOffset(4)]
private readonly DisplayPortColorFormat _ColorFormat;
[FieldOffset(8)]
private readonly DisplayPortColorDepth _ColorDepth;
/// <summary>
///Gets the monitor display port color format
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public DisplayPortColorFormat ColorFormat
{
get => _ColorFormat;
}
/// <summary>
/// Gets the monitor display port color depth
/// </summary>
// ReSharper disable once ConvertToAutoProperty
public DisplayPortColorDepth ColorDepth
{
get
{
switch ((uint) _ColorDepth)
{
case 6:
return DisplayPortColorDepth.BPC6;
case 8:
return DisplayPortColorDepth.BPC8;
case 10:
return DisplayPortColorDepth.BPC10;
case 12:
return DisplayPortColorDepth.BPC12;
case 16:
return DisplayPortColorDepth.BPC16;
default:
return _ColorDepth;
}
}
}
}
}

View File

@@ -0,0 +1,54 @@
using System;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains monitor VCDB capabilities
/// </summary>
public struct MonitorVCDBCapabilities
{
private readonly byte[] _data;
internal MonitorVCDBCapabilities(byte[] data)
{
if (data.Length != 49)
{
throw new ArgumentOutOfRangeException(nameof(data));
}
_data = data;
}
/// <summary>
/// Gets a boolean value indicating RGB range quantization
/// </summary>
public bool QuantizationRangeRGB
{
get => _data[0].GetBit(1);
}
/// <summary>
/// Gets a boolean value indicating Ycc range quantization
/// </summary>
public bool QuantizationRangeYcc
{
get => _data[0].GetBit(0);
}
public byte ScanInfoConsumerElectronicsVideoFormats
{
get => (byte)_data[0].GetBits(6, 2);
}
public byte ScanInfoInformationTechnologyVideoFormats
{
get => (byte)_data[0].GetBits(4, 2);
}
public byte ScanInfoPreferredVideoFormat
{
get => (byte)_data[0].GetBits(2, 2);
}
}
}

View File

@@ -0,0 +1,254 @@
using System;
using System.Linq;
using NvAPIWrapper.Native.Helpers;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Contains monitor VSDB capabilities
/// </summary>
public struct MonitorVSDBCapabilities
{
private readonly byte[] _data;
internal MonitorVSDBCapabilities(byte[] data)
{
if (data.Length != 49)
{
throw new ArgumentOutOfRangeException(nameof(data));
}
_data = data;
}
/// <summary>
/// Gets the audio latency if available or null
/// </summary>
public byte? AudioLatency
{
get
{
if (!_data[4].GetBit(7))
{
return null;
}
return _data[6];
}
}
public byte[] HDMI3D
{
get
{
if (!_data[9].GetBit(7))
{
return new byte[0];
}
return _data.Skip(18).Take(31).Take((int)_data[10].GetBits(0, 5)).ToArray();
}
}
public byte[] HDMIVideoImageCompositors
{
get
{
if (!_data[4].GetBit(5))
{
return new byte[0];
}
return _data.Skip(11).Take(7).Take((int)_data[10].GetBits(5, 3)).ToArray();
}
}
/// <summary>
/// Gets the interlaced audio latency if available or null
/// </summary>
public byte? InterlacedAudioLatency
{
get
{
if (!_data[4].GetBit(6))
{
return null;
}
return _data[8];
}
}
/// <summary>
/// Gets the interlaced video latency if available or null
/// </summary>
public byte? InterlacedVideoLatency
{
get
{
if (!_data[4].GetBit(6))
{
return null;
}
return _data[7];
}
}
public bool IsAISupported
{
get => _data[2].GetBit(7);
}
/// <summary>
/// Returns a boolean value indicating if the cinematic content is supported by the monitor or the connection
/// </summary>
public bool IsCinemaContentSupported
{
get => _data[4].GetBit(2);
}
/// <summary>
/// Returns a boolean value indicating if the 30bit deep color is supported by the monitor or the connection
/// </summary>
public bool IsDeepColor30BitsSupported
{
get => _data[2].GetBit(4);
}
/// <summary>
/// Returns a boolean value indicating if the 36bit deep color is supported by the monitor or the connection
/// </summary>
public bool IsDeepColor36BitsSupported
{
get => _data[2].GetBit(5);
}
/// <summary>
/// Returns a boolean value indicating if the 48bit deep color is supported by the monitor or the connection
/// </summary>
public bool IsDeepColor48BitsSupported
{
get => _data[2].GetBit(6);
}
/// <summary>
/// Returns a boolean value indicating if the YCbCr444 deep color is supported by the monitor or the connection
/// </summary>
public bool IsDeepColorYCbCr444Supported
{
get => _data[2].GetBit(3);
}
/// <summary>
/// Returns a boolean value indicating if the dual DVI operation is supported by the monitor or the connection
/// </summary>
public bool IsDualDVIOperationSupported
{
get => _data[2].GetBit(0);
}
/// <summary>
/// Returns a boolean value indicating if the gaming content is supported by the monitor or the connection
/// </summary>
public bool IsGameContentSupported
{
get => _data[4].GetBit(3);
}
/// <summary>
/// Returns a boolean value indicating if the graphics text content is supported by the monitor or the connection
/// </summary>
public bool IsGraphicsTextContentSupported
{
get => _data[4].GetBit(0);
}
/// <summary>
/// Returns a boolean value indicating if the photo content is supported by monitor or the connection
/// </summary>
public bool IsPhotoContentSupported
{
get => _data[4].GetBit(1);
}
/// <summary>
/// Gets the connection max TMDS clock supported by the monitor or the connection
/// </summary>
public byte MaxTMDSClock
{
get => _data[3];
}
/// <summary>
/// Gets the monitor physical address on port
/// </summary>
public MonitorPhysicalAddress PhysicalAddress
{
get => new MonitorPhysicalAddress(
(byte)_data[0].GetBits(4, 4),
(byte)_data[0].GetBits(0, 4),
(byte)_data[1].GetBits(4, 4),
(byte)_data[1].GetBits(0, 4)
);
}
/// <summary>
/// Gets the video latency if available or null
/// </summary>
public byte? VideoLatency
{
get
{
if (!_data[4].GetBit(7))
{
return null;
}
return _data[5];
}
}
/// <summary>
/// Represents a monitor physical address
/// </summary>
public class MonitorPhysicalAddress
{
internal MonitorPhysicalAddress(byte a, byte b, byte c, byte d)
{
A = a;
B = b;
C = c;
D = d;
}
/// <summary>
/// Gets the first part of a monitor physical address
/// </summary>
public byte A { get; set; }
/// <summary>
/// Gets the second part of a monitor physical address
/// </summary>
public byte B { get; set; }
/// <summary>
/// Gets the third part of a monitor physical address
/// </summary>
public byte C { get; set; }
/// <summary>
/// Gets the forth part of a monitor physical address
/// </summary>
public byte D { get; set; }
/// <inheritdoc />
public override string ToString()
{
return $"{A:D}.{B:D}.{C:D}.{D:D}";
}
}
}
}

View File

@@ -0,0 +1,268 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Exceptions;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.GPU;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds advanced information about a PathTargetInfo
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct PathAdvancedTargetInfo : IInitializable, IEquatable<PathAdvancedTargetInfo>
{
internal StructureVersion _Version;
internal readonly Rotate _Rotation;
internal readonly Scaling _Scaling;
internal readonly uint _RefreshRateInMillihertz;
internal uint _RawReserved;
internal readonly ConnectorType _ConnectorType;
internal readonly TVFormat _TVFormat;
internal readonly TimingOverride _TimingOverride;
internal readonly Timing _Timing;
/// <summary>
/// Creates a new PathAdvancedTargetInfo for monitors
/// </summary>
/// <param name="rotation">Screen rotation</param>
/// <param name="scale">Screen scaling</param>
/// <param name="refreshRateInMillihertz">Screen refresh rate</param>
/// <param name="timingOverride">Timing override</param>
/// <param name="isInterlaced">Indicates if the mode is interlaced</param>
/// <param name="isClonePrimary">Indicates if the display is the primary display of a clone topology</param>
/// <param name="isClonePanAndScanTarget">Indicates if the target Pan and Scan is enabled</param>
/// <param name="disableVirtualModeSupport"></param>
/// <param name="isPreferredUnscaledTarget"></param>
/// <exception cref="NVIDIANotSupportedException"></exception>
public PathAdvancedTargetInfo(
Rotate rotation,
Scaling scale,
uint refreshRateInMillihertz = 0,
TimingOverride timingOverride = TimingOverride.Current,
bool isInterlaced = false,
bool isClonePrimary = false,
bool isClonePanAndScanTarget = false,
bool disableVirtualModeSupport = false,
bool isPreferredUnscaledTarget = false)
{
if (timingOverride == TimingOverride.Custom)
{
throw new NVIDIANotSupportedException("Custom timing is not supported yet.");
}
this = typeof(PathAdvancedTargetInfo).Instantiate<PathAdvancedTargetInfo>();
_Rotation = rotation;
_Scaling = scale;
_RefreshRateInMillihertz = refreshRateInMillihertz;
_TimingOverride = timingOverride;
IsInterlaced = isInterlaced;
IsClonePrimary = isClonePrimary;
IsClonePanAndScanTarget = isClonePanAndScanTarget;
DisableVirtualModeSupport = disableVirtualModeSupport;
IsPreferredUnscaledTarget = isPreferredUnscaledTarget;
}
/// <summary>
/// Creates a new PathAdvancedTargetInfo for TVs
/// </summary>
/// <param name="rotation">Screen rotation</param>
/// <param name="scale">Screen scaling</param>
/// <param name="tvFormat">The TV format to apply</param>
/// <param name="connectorType">Specify connector type. For TV only</param>
/// <param name="refreshRateInMillihertz">Screen refresh rate</param>
/// <param name="timingOverride">Timing override</param>
/// <param name="isInterlaced">Indicates if the mode is interlaced</param>
/// <param name="isClonePrimary">Indicates if the display is the primary display of a clone topology</param>
/// <param name="isClonePanAndScanTarget">Indicates if the target Pan and Scan is enabled</param>
/// <param name="disableVirtualModeSupport"></param>
/// <param name="isPreferredUnscaledTarget"></param>
/// <exception cref="NVIDIANotSupportedException"></exception>
public PathAdvancedTargetInfo(
Rotate rotation,
Scaling scale,
TVFormat tvFormat,
ConnectorType connectorType,
uint refreshRateInMillihertz = 0,
TimingOverride timingOverride = TimingOverride.Current,
bool isInterlaced = false,
bool isClonePrimary = false,
bool isClonePanAndScanTarget = false,
bool disableVirtualModeSupport = false,
bool isPreferredUnscaledTarget = false)
: this(
rotation, scale, refreshRateInMillihertz, timingOverride, isInterlaced, isClonePrimary,
isClonePanAndScanTarget,
disableVirtualModeSupport, isPreferredUnscaledTarget)
{
if (tvFormat == TVFormat.None)
{
throw new NVIDIANotSupportedException(
"This overload is for TV displays, use the other overload(s) if the display is not a TV.");
}
this = typeof(PathAdvancedTargetInfo).Instantiate<PathAdvancedTargetInfo>();
_TVFormat = tvFormat;
_ConnectorType = connectorType;
}
/// <inheritdoc />
public bool Equals(PathAdvancedTargetInfo other)
{
return _Rotation == other._Rotation &&
_Scaling == other._Scaling &&
_RefreshRateInMillihertz == other._RefreshRateInMillihertz &&
(TVFormat == TVFormat.None || _ConnectorType == other._ConnectorType) &&
_TVFormat == other._TVFormat &&
_TimingOverride == other._TimingOverride &&
_Timing.Equals(other._Timing) &&
_RawReserved == other._RawReserved;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is PathAdvancedTargetInfo info && Equals(info);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _Rotation;
hashCode = (hashCode * 397) ^ (int) _Scaling;
hashCode = (hashCode * 397) ^ (int) _RefreshRateInMillihertz;
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ (int) _RawReserved;
hashCode = (hashCode * 397) ^ (int) _ConnectorType;
hashCode = (hashCode * 397) ^ (int) _TVFormat;
hashCode = (hashCode * 397) ^ (int) _TimingOverride;
hashCode = (hashCode * 397) ^ _Timing.GetHashCode();
return hashCode;
}
}
/// <summary>
/// Rotation setting
/// </summary>
public Rotate Rotation
{
get => _Rotation;
}
/// <summary>
/// Scaling setting
/// </summary>
public Scaling Scaling
{
get => _Scaling;
}
/// <summary>
/// Non-interlaced Refresh Rate of the mode, multiplied by 1000, 0 = ignored
/// This is the value which driver reports to the OS.
/// </summary>
public uint RefreshRateInMillihertz
{
get => _RefreshRateInMillihertz;
}
/// <summary>
/// Specify connector type. For TV only, ignored if TVFormat == TVFormat.None.
/// </summary>
public ConnectorType ConnectorType
{
get => _ConnectorType;
}
/// <summary>
/// To choose the last TV format set this value to TVFormat.None
/// In case of NvAPI_DISP_GetDisplayConfig(), this field will indicate the currently applied TV format;
/// if no TV format is applied, this field will have TVFormat.None value.
/// In case of NvAPI_DISP_SetDisplayConfig(), this field should only be set in case of TVs;
/// for other displays this field will be ignored and resolution &amp; refresh rate specified in input will be used to
/// apply the TV format.
/// </summary>
public TVFormat TVFormat
{
get => _TVFormat;
}
/// <summary>
/// Ignored if TimingOverride == TimingOverride.Current
/// </summary>
public TimingOverride TimingOverride
{
get => _TimingOverride;
}
/// <summary>
/// Scan out timing, valid only if TimingOverride == TimingOverride.Custom
/// The value Timing.PixelClockIn10KHertz is obtained from the EDID. The driver may tweak this value for HDTV, stereo,
/// etc., before reporting it to the OS.
/// </summary>
public Timing Timing
{
get => _Timing;
}
/// <summary>
/// Interlaced mode flag, ignored if refreshRate == 0
/// </summary>
public bool IsInterlaced
{
get => _RawReserved.GetBit(0);
private set => _RawReserved = _RawReserved.SetBit(0, value);
}
/// <summary>
/// Declares primary display in clone configuration. This is *NOT* GDI Primary.
/// Only one target can be primary per source. If no primary is specified, the first target will automatically be
/// primary.
/// </summary>
public bool IsClonePrimary
{
get => _RawReserved.GetBit(1);
private set => _RawReserved = _RawReserved.SetBit(1, value);
}
/// <summary>
/// Whether on this target Pan and Scan is enabled or has to be enabled. Valid only when the target is part of clone
/// topology.
/// </summary>
public bool IsClonePanAndScanTarget
{
get => _RawReserved.GetBit(2);
private set => _RawReserved = _RawReserved.SetBit(2, value);
}
/// <summary>
/// Indicates if virtual mode support is disabled
/// </summary>
public bool DisableVirtualModeSupport
{
get => _RawReserved.GetBit(3);
private set => _RawReserved = _RawReserved.SetBit(3, value);
}
/// <summary>
/// Indicates if the target is in preferred unscaled mode
/// </summary>
public bool IsPreferredUnscaledTarget
{
get => _RawReserved.GetBit(4);
private set => _RawReserved = _RawReserved.SetBit(4, value);
}
}
}

View File

@@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds information about a path
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
// ReSharper disable once RedundantExtendsListEntry
public struct PathInfoV1 : IPathInfo, IInitializable, IAllocatable, IEquatable<PathInfoV1>
{
internal StructureVersion _Version;
internal readonly uint _ReservedSourceId;
internal readonly uint _TargetInfoCount;
internal ValueTypeArray<PathTargetInfoV1> _TargetsInfo;
internal ValueTypeReference<SourceModeInfo> _SourceModeInfo;
/// <inheritdoc />
public uint SourceId
{
get => _ReservedSourceId;
}
/// <inheritdoc />
public IEnumerable<IPathTargetInfo> TargetsInfo
{
get => _TargetsInfo.ToArray((int) _TargetInfoCount)?.Cast<IPathTargetInfo>() ?? new IPathTargetInfo[0];
}
/// <inheritdoc />
public SourceModeInfo SourceModeInfo
{
get => _SourceModeInfo.ToValueType() ?? default(SourceModeInfo);
}
/// <summary>
/// Creates a new PathInfoV1
/// </summary>
/// <param name="targetsInformation">Information about path targets</param>
/// <param name="sourceModeInformation">Source mode information</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV1(
PathTargetInfoV1[] targetsInformation,
SourceModeInfo sourceModeInformation,
uint sourceId = 0)
{
this = typeof(PathInfoV1).Instantiate<PathInfoV1>();
_TargetInfoCount = (uint) targetsInformation.Length;
_TargetsInfo = ValueTypeArray<PathTargetInfoV1>.FromArray(targetsInformation);
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInformation);
_ReservedSourceId = sourceId;
}
/// <inheritdoc />
public bool Equals(PathInfoV1 other)
{
return _TargetInfoCount == other._TargetInfoCount &&
_TargetsInfo.Equals(other._TargetsInfo) &&
_SourceModeInfo.Equals(other._SourceModeInfo);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is PathInfoV1 && Equals((PathInfoV1) obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _TargetInfoCount;
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ _TargetsInfo.GetHashCode();
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ _SourceModeInfo.GetHashCode();
return hashCode;
}
}
/// <summary>
/// Creates a new PathInfoV1
/// </summary>
/// <param name="targetsInformation">Information about path targets</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV1(PathTargetInfoV1[] targetsInformation, uint sourceId = 0)
{
this = typeof(PathInfoV1).Instantiate<PathInfoV1>();
_TargetInfoCount = (uint) targetsInformation.Length;
_TargetsInfo = ValueTypeArray<PathTargetInfoV1>.FromArray(targetsInformation);
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.Null;
_ReservedSourceId = sourceId;
}
/// <summary>
/// Creates a new PathInfoV1
/// </summary>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV1(uint sourceId)
{
this = typeof(PathInfoV1).Instantiate<PathInfoV1>();
_TargetInfoCount = 0;
_TargetsInfo = ValueTypeArray<PathTargetInfoV1>.Null;
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.Null;
_ReservedSourceId = sourceId;
}
/// <summary>
/// Creates a new PathInfoV1
/// </summary>
/// <param name="sourceModeInfo">Source mode information</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV1(SourceModeInfo sourceModeInfo, uint sourceId)
{
this = typeof(PathInfoV1).Instantiate<PathInfoV1>();
_TargetInfoCount = 0;
_TargetsInfo = ValueTypeArray<PathTargetInfoV1>.Null;
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInfo);
_ReservedSourceId = sourceId;
}
/// <inheritdoc />
public void Dispose()
{
TargetsInfo.DisposeAll();
_TargetsInfo.Dispose();
_SourceModeInfo.Dispose();
}
void IAllocatable.Allocate()
{
if (_TargetInfoCount > 0 && _TargetsInfo.IsNull)
{
var targetInfo = typeof(PathTargetInfoV1).Instantiate<PathTargetInfoV1>();
var targetInfoList = targetInfo.Repeat((int) _TargetInfoCount).AllocateAll();
_TargetsInfo = ValueTypeArray<PathTargetInfoV1>.FromArray(targetInfoList.ToArray());
}
if (_SourceModeInfo.IsNull)
{
var sourceModeInfo = typeof(SourceModeInfo).Instantiate<SourceModeInfo>();
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInfo);
}
}
}
}

View File

@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds information about a path
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(2)]
// ReSharper disable once RedundantExtendsListEntry
public struct PathInfoV2 : IPathInfo, IInitializable, IAllocatable, IEquatable<PathInfoV2>
{
internal StructureVersion _Version;
internal readonly uint _SourceId;
internal readonly uint _TargetInfoCount;
internal ValueTypeArray<PathTargetInfoV2> _TargetsInfo;
internal ValueTypeReference<SourceModeInfo> _SourceModeInfo;
internal readonly uint _RawReserved;
internal ValueTypeReference<LUID> _OSAdapterLUID;
/// <inheritdoc />
public uint SourceId
{
get => _SourceId;
}
/// <inheritdoc />
public bool Equals(PathInfoV2 other)
{
return _TargetInfoCount == other._TargetInfoCount &&
_TargetsInfo.Equals(other._TargetsInfo) &&
_SourceModeInfo.Equals(other._SourceModeInfo) &&
_RawReserved == other._RawReserved;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is PathInfoV2 v2 && Equals(v2);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _TargetInfoCount;
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ _TargetsInfo.GetHashCode();
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ _SourceModeInfo.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _RawReserved;
return hashCode;
}
}
/// <inheritdoc />
public IEnumerable<IPathTargetInfo> TargetsInfo
{
get => _TargetsInfo.ToArray((int) _TargetInfoCount)?.Cast<IPathTargetInfo>() ?? new IPathTargetInfo[0];
}
/// <inheritdoc />
public SourceModeInfo SourceModeInfo
{
get => _SourceModeInfo.ToValueType() ?? default(SourceModeInfo);
}
/// <summary>
/// True for non-NVIDIA adapter.
/// </summary>
public bool IsNonNVIDIAAdapter
{
get => _RawReserved.GetBit(0);
}
/// <summary>
/// Used by Non-NVIDIA adapter for OS Adapter of LUID
/// </summary>
public LUID? OSAdapterLUID
{
get => _OSAdapterLUID.ToValueType();
}
/// <summary>
/// Creates a new PathInfoV2
/// </summary>
/// <param name="targetInformations">Information about path targets</param>
/// <param name="sourceModeInfo">Source mode information</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV2(PathTargetInfoV2[] targetInformations, SourceModeInfo sourceModeInfo, uint sourceId = 0)
{
this = typeof(PathInfoV2).Instantiate<PathInfoV2>();
_TargetInfoCount = (uint) targetInformations.Length;
_TargetsInfo = ValueTypeArray<PathTargetInfoV2>.FromArray(targetInformations);
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInfo);
_SourceId = sourceId;
}
/// <summary>
/// Creates a new PathInfoV2
/// </summary>
/// <param name="targetInformations">Information about path targets</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV2(PathTargetInfoV2[] targetInformations, uint sourceId = 0)
{
this = typeof(PathInfoV2).Instantiate<PathInfoV2>();
_TargetInfoCount = (uint) targetInformations.Length;
_TargetsInfo = ValueTypeArray<PathTargetInfoV2>.FromArray(targetInformations);
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.Null;
_SourceId = sourceId;
}
/// <summary>
/// Creates a new PathInfoV2
/// </summary>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV2(uint sourceId)
{
this = typeof(PathInfoV2).Instantiate<PathInfoV2>();
_TargetInfoCount = 0;
_TargetsInfo = ValueTypeArray<PathTargetInfoV2>.Null;
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.Null;
_SourceId = sourceId;
}
/// <summary>
/// Creates a new PathInfoV2
/// </summary>
/// <param name="sourceModeInfo">Source mode information</param>
/// <param name="sourceId">Source Id, can be zero</param>
public PathInfoV2(SourceModeInfo sourceModeInfo, uint sourceId)
{
this = typeof(PathInfoV2).Instantiate<PathInfoV2>();
_TargetInfoCount = 0;
_TargetsInfo = ValueTypeArray<PathTargetInfoV2>.Null;
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInfo);
_SourceId = sourceId;
}
/// <inheritdoc />
public void Dispose()
{
TargetsInfo.DisposeAll();
_TargetsInfo.Dispose();
_SourceModeInfo.Dispose();
}
void IAllocatable.Allocate()
{
if (_TargetInfoCount > 0 && _TargetsInfo.IsNull)
{
var targetInfo = typeof(PathTargetInfoV2).Instantiate<PathTargetInfoV2>();
var targetInfoList = targetInfo.Repeat((int) _TargetInfoCount).AllocateAll();
_TargetsInfo = ValueTypeArray<PathTargetInfoV2>.FromArray(targetInfoList.ToArray());
}
if (_SourceModeInfo.IsNull)
{
var sourceModeInfo = typeof(SourceModeInfo).Instantiate<SourceModeInfo>();
_SourceModeInfo = ValueTypeReference<SourceModeInfo>.FromValueType(sourceModeInfo);
}
}
}
}

View File

@@ -0,0 +1,111 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
// ReSharper disable RedundantExtendsListEntry
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds information about a path's target
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct PathTargetInfoV1 : IPathTargetInfo,
IInitializable,
IDisposable,
IAllocatable,
IEquatable<PathTargetInfoV1>,
IEquatable<PathTargetInfoV2>
{
internal readonly uint _DisplayId;
internal ValueTypeReference<PathAdvancedTargetInfo> _Details;
/// <inheritdoc />
public override string ToString()
{
return $"PathTargetInfoV2: Display #{_DisplayId}";
}
/// <inheritdoc />
public uint DisplayId
{
get => _DisplayId;
}
/// <inheritdoc />
public bool Equals(PathTargetInfoV1 other)
{
return _DisplayId == other._DisplayId && _Details.Equals(other._Details);
}
/// <inheritdoc />
public bool Equals(PathTargetInfoV2 other)
{
return _DisplayId == other._DisplayId && _Details.Equals(other._Details);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is PathTargetInfoV1 && Equals((PathTargetInfoV1) obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
// ReSharper disable once NonReadonlyMemberInGetHashCode
return ((int) _DisplayId * 397) ^ _Details.GetHashCode();
}
}
/// <inheritdoc />
public PathAdvancedTargetInfo? Details
{
get => _Details.ToValueType() ?? default(PathAdvancedTargetInfo);
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
public PathTargetInfoV1(uint displayId) : this()
{
_DisplayId = displayId;
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
/// <param name="details">Extra information</param>
public PathTargetInfoV1(uint displayId, PathAdvancedTargetInfo details) : this(displayId)
{
_Details = ValueTypeReference<PathAdvancedTargetInfo>.FromValueType(details);
}
/// <inheritdoc />
public void Dispose()
{
_Details.Dispose();
}
void IAllocatable.Allocate()
{
if (_Details.IsNull)
{
var detail = typeof(PathAdvancedTargetInfo).Instantiate<PathAdvancedTargetInfo>();
_Details = ValueTypeReference<PathAdvancedTargetInfo>.FromValueType(detail);
}
}
}
}

View File

@@ -0,0 +1,147 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Helpers.Structures;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.Display;
// ReSharper disable RedundantExtendsListEntry
namespace NvAPIWrapper.Native.Display.Structures
{
/// <summary>
/// Holds information about a path's target
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct PathTargetInfoV2 : IPathTargetInfo,
IInitializable,
IDisposable,
IAllocatable,
IEquatable<PathTargetInfoV2>,
IEquatable<PathTargetInfoV1>
{
internal readonly uint _DisplayId;
internal ValueTypeReference<PathAdvancedTargetInfo> _Details;
internal readonly uint _WindowsCCDTargetId;
/// <inheritdoc />
public uint DisplayId
{
get => _DisplayId;
}
/// <inheritdoc />
public override string ToString()
{
return $"PathTargetInfoV2: Display #{_DisplayId}";
}
/// <inheritdoc />
public PathAdvancedTargetInfo? Details
{
get => _Details.ToValueType();
}
/// <summary>
/// Windows CCD target ID. Must be present only for non-NVIDIA adapter, for NVIDIA adapter this parameter is ignored.
/// </summary>
public uint WindowsCCDTargetId
{
get => _WindowsCCDTargetId;
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
public PathTargetInfoV2(uint displayId) : this()
{
_DisplayId = displayId;
}
/// <inheritdoc />
public bool Equals(PathTargetInfoV2 other)
{
return _DisplayId == other._DisplayId && _Details.Equals(other._Details);
}
/// <inheritdoc />
public bool Equals(PathTargetInfoV1 other)
{
return _DisplayId == other._DisplayId && _Details.Equals(other._Details);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is PathTargetInfoV2 v2 && Equals(v2);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _DisplayId;
// ReSharper disable once NonReadonlyMemberInGetHashCode
hashCode = (hashCode * 397) ^ _Details.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _WindowsCCDTargetId;
return hashCode;
}
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
/// <param name="windowsCCDTargetId">Windows CCD target Id</param>
public PathTargetInfoV2(uint displayId, uint windowsCCDTargetId) : this(displayId)
{
_WindowsCCDTargetId = windowsCCDTargetId;
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
/// <param name="details">Extra information</param>
public PathTargetInfoV2(uint displayId, PathAdvancedTargetInfo details) : this(displayId)
{
_Details = ValueTypeReference<PathAdvancedTargetInfo>.FromValueType(details);
}
/// <summary>
/// Creates a new PathTargetInfoV1
/// </summary>
/// <param name="displayId">Display Id</param>
/// <param name="windowsCCDTargetId">Windows CCD target Id</param>
/// <param name="details">Extra information</param>
public PathTargetInfoV2(uint displayId, uint windowsCCDTargetId, PathAdvancedTargetInfo details)
: this(displayId, windowsCCDTargetId)
{
_Details = ValueTypeReference<PathAdvancedTargetInfo>.FromValueType(details);
}
/// <inheritdoc />
public void Dispose()
{
_Details.Dispose();
}
void IAllocatable.Allocate()
{
if (_Details.IsNull)
{
var detail = typeof(PathAdvancedTargetInfo).Instantiate<PathAdvancedTargetInfo>();
_Details = ValueTypeReference<PathAdvancedTargetInfo>.FromValueType(detail);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More