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,92 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.General;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Holds information about the system's chipset.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct ChipsetInfoV1 : IInitializable, IChipsetInfo, IEquatable<ChipsetInfoV1>
{
internal StructureVersion _Version;
internal readonly uint _VendorId;
internal readonly uint _DeviceId;
internal readonly ShortString _VendorName;
internal readonly ShortString _ChipsetName;
/// <inheritdoc />
public bool Equals(ChipsetInfoV1 other)
{
return _VendorId == other._VendorId &&
_DeviceId == other._DeviceId &&
_VendorName.Equals(other._VendorName) &&
_ChipsetName.Equals(other._ChipsetName);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is ChipsetInfoV1 v1 && Equals(v1);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _VendorId;
hashCode = (hashCode * 397) ^ (int) _DeviceId;
hashCode = (hashCode * 397) ^ _VendorName.GetHashCode();
hashCode = (hashCode * 397) ^ _ChipsetName.GetHashCode();
return hashCode;
}
}
/// <inheritdoc />
public override string ToString()
{
return $"{VendorName} {ChipsetName}";
}
/// <inheritdoc />
public int VendorId
{
get => (int) _VendorId;
}
/// <inheritdoc />
public int DeviceId
{
get => (int) _DeviceId;
}
/// <inheritdoc />
public string VendorName
{
get => _VendorName.Value;
}
/// <inheritdoc />
public string ChipsetName
{
get => _ChipsetName.Value;
}
/// <inheritdoc />
public ChipsetInfoFlag Flags
{
get => ChipsetInfoFlag.None;
}
}
}

View File

@@ -0,0 +1,95 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.General;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Holds information about the system's chipset.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(2)]
public struct ChipsetInfoV2 : IInitializable, IChipsetInfo, IEquatable<ChipsetInfoV2>
{
internal StructureVersion _Version;
internal readonly uint _VendorId;
internal readonly uint _DeviceId;
internal readonly ShortString _VendorName;
internal readonly ShortString _ChipsetName;
internal readonly ChipsetInfoFlag _Flags;
/// <inheritdoc />
public bool Equals(ChipsetInfoV2 other)
{
return _VendorId == other._VendorId &&
_DeviceId == other._DeviceId &&
_VendorName.Equals(other._VendorName) &&
_ChipsetName.Equals(other._ChipsetName) &&
_Flags == other._Flags;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is ChipsetInfoV2 v2 && Equals(v2);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _VendorId;
hashCode = (hashCode * 397) ^ (int) _DeviceId;
hashCode = (hashCode * 397) ^ _VendorName.GetHashCode();
hashCode = (hashCode * 397) ^ _ChipsetName.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _Flags;
return hashCode;
}
}
/// <inheritdoc />
public override string ToString()
{
return $"{VendorName} {ChipsetName}";
}
/// <inheritdoc />
public int VendorId
{
get => (int) _VendorId;
}
/// <inheritdoc />
public int DeviceId
{
get => (int) _DeviceId;
}
/// <inheritdoc />
public string VendorName
{
get => _VendorName.Value;
}
/// <inheritdoc />
public string ChipsetName
{
get => _ChipsetName.Value;
}
/// <inheritdoc />
public ChipsetInfoFlag Flags
{
get => _Flags;
}
}
}

View File

@@ -0,0 +1,128 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.General;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Holds information about the system's chipset.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(3)]
public struct ChipsetInfoV3 : IInitializable, IChipsetInfo, IEquatable<ChipsetInfoV3>
{
internal StructureVersion _Version;
internal readonly uint _VendorId;
internal readonly uint _DeviceId;
internal readonly ShortString _VendorName;
internal readonly ShortString _ChipsetName;
internal readonly ChipsetInfoFlag _Flags;
internal readonly uint _SubSystemVendorId;
internal readonly uint _SubSystemDeviceId;
internal readonly ShortString _SubSystemVendorName;
/// <inheritdoc />
public bool Equals(ChipsetInfoV3 other)
{
return _VendorId == other._VendorId &&
_DeviceId == other._DeviceId &&
_VendorName.Equals(other._VendorName) &&
_ChipsetName.Equals(other._ChipsetName) &&
_Flags == other._Flags &&
_SubSystemVendorId == other._SubSystemVendorId &&
_SubSystemDeviceId == other._SubSystemDeviceId &&
_SubSystemVendorName.Equals(other._SubSystemVendorName);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is ChipsetInfoV3 v3 && Equals(v3);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _VendorId;
hashCode = (hashCode * 397) ^ (int) _DeviceId;
hashCode = (hashCode * 397) ^ _VendorName.GetHashCode();
hashCode = (hashCode * 397) ^ _ChipsetName.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _Flags;
hashCode = (hashCode * 397) ^ (int) _SubSystemVendorId;
hashCode = (hashCode * 397) ^ (int) _SubSystemDeviceId;
hashCode = (hashCode * 397) ^ _SubSystemVendorName.GetHashCode();
return hashCode;
}
}
/// <inheritdoc />
public override string ToString()
{
return $"{SubSystemVendorName} {VendorName} {ChipsetName}";
}
/// <inheritdoc />
public int VendorId
{
get => (int) _VendorId;
}
/// <inheritdoc />
public int DeviceId
{
get => (int) _DeviceId;
}
/// <inheritdoc />
public string VendorName
{
get => _VendorName.Value;
}
/// <inheritdoc />
public string ChipsetName
{
get => _ChipsetName.Value;
}
/// <inheritdoc />
public ChipsetInfoFlag Flags
{
get => _Flags;
}
/// <summary>
/// Chipset subsystem vendor identification
/// </summary>
public int SubSystemVendorId
{
get => (int) _SubSystemVendorId;
}
/// <summary>
/// Chipset subsystem device identification
/// </summary>
public int SubSystemDeviceId
{
get => (int) _SubSystemDeviceId;
}
/// <summary>
/// Chipset subsystem vendor name
/// </summary>
public string SubSystemVendorName
{
get => _SubSystemVendorName.Value;
}
}
}

View File

@@ -0,0 +1,172 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Interfaces;
using NvAPIWrapper.Native.Interfaces.General;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Holds information about the system's chipset.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(4)]
public struct ChipsetInfoV4 : IInitializable, IChipsetInfo, IEquatable<ChipsetInfoV4>
{
internal StructureVersion _Version;
internal readonly uint _VendorId;
internal readonly uint _DeviceId;
internal readonly ShortString _VendorName;
internal readonly ShortString _ChipsetName;
internal readonly ChipsetInfoFlag _Flags;
internal readonly uint _SubSystemVendorId;
internal readonly uint _SubSystemDeviceId;
internal readonly ShortString _SubSystemVendorName;
internal readonly uint _HostBridgeVendorId;
internal readonly uint _HostBridgeDeviceId;
internal readonly uint _HostBridgeSubSystemVendorId;
internal readonly uint _HostBridgeSubSystemDeviceId;
/// <inheritdoc />
public bool Equals(ChipsetInfoV4 other)
{
return _VendorId == other._VendorId &&
_DeviceId == other._DeviceId &&
_VendorName.Equals(other._VendorName) &&
_ChipsetName.Equals(other._ChipsetName) &&
_Flags == other._Flags &&
_SubSystemVendorId == other._SubSystemVendorId &&
_SubSystemDeviceId == other._SubSystemDeviceId &&
_SubSystemVendorName.Equals(other._SubSystemVendorName) &&
_HostBridgeVendorId == other._HostBridgeVendorId &&
_HostBridgeDeviceId == other._HostBridgeDeviceId &&
_HostBridgeSubSystemVendorId == other._HostBridgeSubSystemVendorId &&
_HostBridgeSubSystemDeviceId == other._HostBridgeSubSystemDeviceId;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is ChipsetInfoV4 v4 && Equals(v4);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _VendorId;
hashCode = (hashCode * 397) ^ (int) _DeviceId;
hashCode = (hashCode * 397) ^ _VendorName.GetHashCode();
hashCode = (hashCode * 397) ^ _ChipsetName.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _Flags;
hashCode = (hashCode * 397) ^ (int) _SubSystemVendorId;
hashCode = (hashCode * 397) ^ (int) _SubSystemDeviceId;
hashCode = (hashCode * 397) ^ _SubSystemVendorName.GetHashCode();
hashCode = (hashCode * 397) ^ (int) _HostBridgeVendorId;
hashCode = (hashCode * 397) ^ (int) _HostBridgeDeviceId;
hashCode = (hashCode * 397) ^ (int) _HostBridgeSubSystemVendorId;
hashCode = (hashCode * 397) ^ (int) _HostBridgeSubSystemDeviceId;
return hashCode;
}
}
/// <inheritdoc />
public override string ToString()
{
return $"{SubSystemVendorName} {VendorName} {ChipsetName}";
}
/// <inheritdoc />
public int VendorId
{
get => (int) _VendorId;
}
/// <inheritdoc />
public int DeviceId
{
get => (int) _DeviceId;
}
/// <inheritdoc />
public string VendorName
{
get => _VendorName.Value;
}
/// <inheritdoc />
public string ChipsetName
{
get => _ChipsetName.Value;
}
/// <inheritdoc />
public ChipsetInfoFlag Flags
{
get => _Flags;
}
/// <summary>
/// Chipset subsystem vendor identification
/// </summary>
public int SubSystemVendorId
{
get => (int) _SubSystemVendorId;
}
/// <summary>
/// Chipset subsystem device identification
/// </summary>
public int SubSystemDeviceId
{
get => (int) _SubSystemDeviceId;
}
/// <summary>
/// Chipset subsystem vendor name
/// </summary>
public string SubSystemVendorName
{
get => _SubSystemVendorName.Value;
}
/// <summary>
/// Host bridge vendor identification
/// </summary>
public int HostBridgeVendorId
{
get => (int) _HostBridgeVendorId;
}
/// <summary>
/// Host bridge device identification
/// </summary>
public int HostBridgeDeviceId
{
get => (int) _HostBridgeDeviceId;
}
/// <summary>
/// Host bridge subsystem vendor identification
/// </summary>
public int HostBridgeSubSystemVendorId
{
get => (int) _HostBridgeSubSystemVendorId;
}
/// <summary>
/// Host bridge subsystem device identification
/// </summary>
public int HostBridgeSubSystemDeviceId
{
get => (int) _HostBridgeSubSystemDeviceId;
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.General.Structures
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct GenericString : IInitializable
{
public const int GenericStringLength = 4096;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = GenericStringLength)]
private readonly string _Value;
public string Value
{
get => _Value;
}
public GenericString(string value)
{
_Value = value ?? string.Empty;
}
public override string ToString()
{
return Value;
}
}
}

View File

@@ -0,0 +1,109 @@
using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Holds information about the lid and dock
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct LidDockParameters : IInitializable, IEquatable<LidDockParameters>
{
internal StructureVersion _Version;
internal readonly uint _CurrentLIDState;
internal readonly uint _CurrentDockState;
internal readonly uint _CurrentLIDPolicy;
internal readonly uint _CurrentDockPolicy;
internal readonly uint _ForcedLIDMechanismPresent;
internal readonly uint _ForcedDockMechanismPresent;
/// <inheritdoc />
public bool Equals(LidDockParameters other)
{
return _CurrentLIDState == other._CurrentLIDState &&
_CurrentDockState == other._CurrentDockState &&
_CurrentLIDPolicy == other._CurrentLIDPolicy &&
_CurrentDockPolicy == other._CurrentDockPolicy &&
_ForcedLIDMechanismPresent == other._ForcedLIDMechanismPresent &&
_ForcedDockMechanismPresent == other._ForcedDockMechanismPresent;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is LidDockParameters parameters && Equals(parameters);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = (int) _CurrentLIDState;
hashCode = (hashCode * 397) ^ (int) _CurrentDockState;
hashCode = (hashCode * 397) ^ (int) _CurrentLIDPolicy;
hashCode = (hashCode * 397) ^ (int) _CurrentDockPolicy;
hashCode = (hashCode * 397) ^ (int) _ForcedLIDMechanismPresent;
hashCode = (hashCode * 397) ^ (int) _ForcedDockMechanismPresent;
return hashCode;
}
}
/// <summary>
/// Gets current lid state
/// </summary>
public uint CurrentLidState
{
get => _CurrentLIDState;
}
/// <summary>
/// Gets current dock state
/// </summary>
public uint CurrentDockState
{
get => _CurrentDockState;
}
/// <summary>
/// Gets current lid policy
/// </summary>
public uint CurrentLidPolicy
{
get => _CurrentLIDPolicy;
}
/// <summary>
/// Gets current dock policy
/// </summary>
public uint CurrentDockPolicy
{
get => _CurrentDockPolicy;
}
/// <summary>
/// Gets forced lid mechanism present
/// </summary>
public uint ForcedLidMechanismPresent
{
get => _ForcedLIDMechanismPresent;
}
/// <summary>
/// Gets forced dock mechanism present
/// </summary>
public uint ForcedDockMechanismPresent
{
get => _ForcedDockMechanismPresent;
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.General.Structures
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct LongString : IInitializable
{
public const int LongStringLength = 256;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = LongStringLength)]
private readonly string _Value;
public string Value
{
get => _Value;
}
public LongString(string value)
{
_Value = value ?? string.Empty;
}
public override string ToString()
{
return Value;
}
}
}

View File

@@ -0,0 +1,80 @@
using System.Runtime.InteropServices;
namespace NvAPIWrapper.Native.General.Structures
{
/// <summary>
/// Represents a rectangle coordinates
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct Rectangle
{
internal int _X;
internal int _Y;
internal int _Width;
internal int _Height;
/// <summary>
/// Creates a new instance of <see cref="Rectangle" />
/// </summary>
/// <param name="x">The horizontal location value.</param>
/// <param name="y">The vertical location value.</param>
/// <param name="width">The width of the rectangle.</param>
/// <param name="height">The height of the rectangle.</param>
// ReSharper disable once TooManyDependencies
public Rectangle(int x, int y, int width, int height)
{
_X = x;
_Y = y;
_Width = width;
_Height = height;
}
/// <summary>
/// Gets the horizontal location value
/// </summary>
public int X
{
get => _X;
}
/// <summary>
/// Gets the vertical location value
/// </summary>
public int Y
{
get => _Y;
}
/// <summary>
/// Gets the rectangle width value
/// </summary>
public int Width
{
get => _Width;
}
/// <summary>
/// Gets the rectangle height value
/// </summary>
public int Height
{
get => _Height;
}
/// <summary>
/// Gets the horizontal left edge value
/// </summary>
public int X2
{
get => X + Width;
}
/// <summary>
/// Gets the vertical bottom edge value
/// </summary>
public int Y2
{
get => Y + Height;
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.General.Structures
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct ShortString : IInitializable
{
public const int ShortStringLength = 64;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ShortStringLength)]
private readonly string _Value;
public string Value
{
get => _Value;
}
public ShortString(string value)
{
_Value = value ?? string.Empty;
}
public override string ToString()
{
return Value;
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;
namespace NvAPIWrapper.Native.General.Structures
{
[StructLayout(LayoutKind.Sequential)]
internal struct StructureVersion
{
private readonly uint _version;
public int VersionNumber
{
get => (int) (_version >> 16);
}
public int StructureSize
{
get => (int) (_version & ~(0xFFFF << 16));
}
public StructureVersion(int version, Type structureType)
{
_version = (uint) (Marshal.SizeOf(structureType) | (version << 16));
}
public override string ToString()
{
return $"Structure Size: {StructureSize} Bytes, Version: {VersionNumber}";
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.General.Structures
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct UnicodeString : IInitializable
{
public const int UnicodeStringLength = 2048;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = UnicodeStringLength)]
private readonly string _Value;
public string Value
{
get => _Value;
}
public UnicodeString(string value)
{
_Value = value ?? string.Empty;
}
public override string ToString()
{
return Value;
}
}
}