Eco mode overclocking fix

This commit is contained in:
Serge
2023-05-07 18:10:18 +02:00
parent 2c4bdb87aa
commit 88f466103e
114 changed files with 234 additions and 5952 deletions

View File

@@ -1,481 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.DRS;
using NvAPIWrapper.Native.DRS.Structures;
namespace NvAPIWrapper.DRS
{
/// <summary>
/// Represents a NVIDIA driver settings profile
/// </summary>
public class DriverSettingsProfile
{
internal DriverSettingsProfile(DRSProfileHandle handle, DriverSettingsSession parentSession)
{
Handle = handle;
Session = parentSession;
}
/// <summary>
/// Gets a list of applications under this profile
/// </summary>
public IEnumerable<ProfileApplication> Applications
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
return DRSApi.EnumApplications(Session.Handle, Handle)
.Select(application => new ProfileApplication(application, this));
}
}
/// <summary>
/// Gets or sets the profile support value for GPU series
/// </summary>
public DRSGPUSupport GPUSupport
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
return profileInfo.GPUSupport;
}
set
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
profileInfo.GPUSupport = value;
DRSApi.SetProfileInfo(Session.Handle, Handle, profileInfo);
}
}
/// <summary>
/// Gets the profile handle
/// </summary>
public DRSProfileHandle Handle { get; private set; }
/// <summary>
/// Gets a boolean value indicating if this profile is predefined
/// </summary>
public bool IsPredefined
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
return profileInfo.IsPredefined;
}
}
/// <summary>
/// Gets a boolean value indicating if this profile is valid and contains a non-zero handle
/// </summary>
public bool IsValid
{
get => !Handle.IsNull;
}
/// <summary>
/// Gets the name of the profile
/// </summary>
public string Name
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
return profileInfo.Name;
}
}
/// <summary>
/// Gets the number of application registered under this profile
/// </summary>
public int NumberOfApplications
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
return profileInfo.NumberOfApplications;
}
}
/// <summary>
/// Gets the number of settings under this profile
/// </summary>
public int NumberOfSettings
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var profileInfo = DRSApi.GetProfileInfo(Session.Handle, Handle);
return profileInfo.NumberOfSettings;
}
}
/// <summary>
/// Gets the session that had queried this profile
/// </summary>
public DriverSettingsSession Session { get; }
/// <summary>
/// Gets a list of settings under this profile
/// </summary>
public IEnumerable<ProfileSetting> Settings
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
return DRSApi.EnumSettings(Session.Handle, Handle).Select(setting => new ProfileSetting(setting));
}
}
/// <summary>
/// Creates a new profile
/// </summary>
/// <param name="session">The session to create this profile in.</param>
/// <param name="profileName">The name of the profile.</param>
/// <param name="gpuSupport">The supported GPU series for this profile.</param>
/// <returns>An instance of <see cref="DriverSettingsProfile" /> representing this newly created profile.</returns>
public static DriverSettingsProfile CreateProfile(
DriverSettingsSession session,
string profileName,
DRSGPUSupport? gpuSupport = null)
{
gpuSupport = gpuSupport ?? new DRSGPUSupport();
var profileInfo = new DRSProfileV1(profileName, gpuSupport.Value);
var profileHandle = DRSApi.CreateProfile(session.Handle, profileInfo);
return new DriverSettingsProfile(profileHandle, session);
}
/// <inheritdoc />
public override string ToString()
{
if (!IsValid)
{
return "[Invalid]";
}
if (IsPredefined)
{
return $"{Name} (Predefined)";
}
return Name;
}
/// <summary>
/// Deletes this profile and makes this instance invalid.
/// </summary>
public void Delete()
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
DRSApi.DeleteProfile(Session.Handle, Handle);
Handle = DRSProfileHandle.DefaultHandle;
}
/// <summary>
/// Deletes an application by its name.
/// </summary>
/// <param name="applicationName">The name of the application to be deleted.</param>
public void DeleteApplicationByName(string applicationName)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
DRSApi.DeleteApplication(Session.Handle, Handle, applicationName);
}
/// <summary>
/// Deletes a setting by its identification number
/// </summary>
/// <param name="settingId">The identification number of the setting to be deleted.</param>
public void DeleteSetting(uint settingId)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
DRSApi.DeleteProfileSetting(Session.Handle, Handle, settingId);
}
/// <summary>
/// Deletes a setting by its known identification number.
/// </summary>
/// <param name="settingId">The known identification number of the setting to be deleted.</param>
public void DeleteSetting(KnownSettingId settingId)
{
DeleteSetting(SettingInfo.GetSettingId(settingId));
}
/// <summary>
/// Finds an application by its name.
/// </summary>
/// <param name="applicationName">The name of the application to search for.</param>
/// <returns>
/// An instance of <see cref="ProfileApplication" /> if an application is found; otherwise <see langword="null" />
/// .
/// </returns>
public ProfileApplication GetApplicationByName(string applicationName)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var application = DRSApi.GetApplicationInfo(Session.Handle, Handle, applicationName);
if (application == null)
{
return null;
}
return new ProfileApplication(application, this);
}
/// <summary>
/// Searches for a setting using its identification number.
/// </summary>
/// <param name="settingId">The identification number of the setting to search for.</param>
/// <returns>An instance of <see cref="ProfileSetting" /> if a setting is found; otherwise <see langword="null" />.</returns>
public ProfileSetting GetSetting(uint settingId)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var setting = DRSApi.GetSetting(Session.Handle, Handle, settingId);
if (setting == null)
{
return null;
}
return new ProfileSetting(setting.Value);
}
/// <summary>
/// Searches for a setting using its known identification number.
/// </summary>
/// <param name="settingId">The known identification number of the setting to search for.</param>
/// <returns>An instance of <see cref="ProfileSetting" /> if a setting is found; otherwise <see langword="null" />.</returns>
public ProfileSetting GetSetting(KnownSettingId settingId)
{
return GetSetting(SettingInfo.GetSettingId(settingId));
}
/// <summary>
/// Restores applications and settings of this profile to their default. This also deletes custom profiles resulting in
/// their handles becoming invalid.
/// </summary>
public void RestoreDefaults()
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var isPredefined = IsPredefined;
DRSApi.RestoreDefaults(Session.Handle, Handle);
if (!isPredefined)
{
Handle = DRSProfileHandle.DefaultHandle;
}
}
/// <summary>
/// Restores a setting to its default value.
/// </summary>
/// <param name="settingId">The identification number of the setting.</param>
public void RestoreSettingToDefault(uint settingId)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
DRSApi.RestoreDefaults(Session.Handle, Handle, settingId);
}
/// <summary>
/// Restores a setting to its default value.
/// </summary>
/// <param name="settingId">The known identification number of the setting.</param>
public void RestoreSettingToDefault(KnownSettingId settingId)
{
RestoreSettingToDefault(SettingInfo.GetSettingId(settingId));
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The known identification number of the setting to change its value.</param>
/// <param name="settingType">The type of the setting value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(KnownSettingId settingId, DRSSettingType settingType, object value)
{
SetSetting(SettingInfo.GetSettingId(settingId), settingType, value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The known identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(KnownSettingId settingId, string value)
{
SetSetting(SettingInfo.GetSettingId(settingId), value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The known identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(KnownSettingId settingId, byte[] value)
{
SetSetting(SettingInfo.GetSettingId(settingId), value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The known identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(KnownSettingId settingId, uint value)
{
SetSetting(SettingInfo.GetSettingId(settingId), value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The identification number of the setting to change its value.</param>
/// <param name="settingType">The type of the setting value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(uint settingId, DRSSettingType settingType, object value)
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid profile instance."
);
}
var setting = new DRSSettingV1(settingId, settingType, value);
DRSApi.SetSetting(Session.Handle, Handle, setting);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(uint settingId, string value)
{
SetSetting(settingId, DRSSettingType.UnicodeString, value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(uint settingId, byte[] value)
{
SetSetting(settingId, DRSSettingType.Binary, value);
}
/// <summary>
/// Sets a new value for a setting or creates a new setting and sets its value
/// </summary>
/// <param name="settingId">The identification number of the setting to change its value.</param>
/// <param name="value">The new value for the setting.</param>
public void SetSetting(uint settingId, uint value)
{
SetSetting(settingId, DRSSettingType.Integer, value);
}
}
}

View File

@@ -1,236 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.DRS.Structures;
namespace NvAPIWrapper.DRS
{
/// <summary>
/// Represents a driver settings session. This is the starting point for using DRS set of functionalities.
/// </summary>
public class DriverSettingsSession : IDisposable
{
internal DriverSettingsSession(DRSSessionHandle handle)
{
Handle = handle;
}
private DriverSettingsSession() : this(DRSApi.CreateSession())
{
}
/// <summary>
/// Gets the base settings profile
/// </summary>
public DriverSettingsProfile BaseProfile
{
get
{
var profileHandle = DRSApi.GetBaseProfile(Handle);
if (profileHandle.IsNull)
{
return null;
}
return new DriverSettingsProfile(profileHandle, this);
}
}
/// <summary>
/// Gets the global settings profile
/// </summary>
public DriverSettingsProfile CurrentGlobalProfile
{
get
{
var profileHandle = DRSApi.GetCurrentGlobalProfile(Handle);
if (profileHandle.IsNull)
{
return null;
}
return new DriverSettingsProfile(profileHandle, this);
}
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
if (string.IsNullOrEmpty(value.Name))
{
throw new ArgumentException("Profile name can not be empty.", nameof(value));
}
DRSApi.SetCurrentGlobalProfile(Handle, value.Name);
}
}
/// <summary>
/// Gets the session handle
/// </summary>
public DRSSessionHandle Handle { get; }
/// <summary>
/// Gets the number of registered profiles
/// </summary>
public int NumberOfProfiles
{
get => DRSApi.GetNumberOfProfiles(Handle);
}
/// <summary>
/// Gets the list of all registered profiles
/// </summary>
public IEnumerable<DriverSettingsProfile> Profiles
{
get { return DRSApi.EnumProfiles(Handle).Select(handle => new DriverSettingsProfile(handle, this)); }
}
/// <inheritdoc />
public void Dispose()
{
ReleaseUnmanagedResources();
GC.SuppressFinalize(this);
}
/// <summary>
/// Creates a new session and load the settings
/// </summary>
/// <returns>A new instance of <see cref="DriverSettingsSession" /> representing a session.</returns>
public static DriverSettingsSession CreateAndLoad()
{
var session = new DriverSettingsSession();
session.Load();
return session;
}
/// <summary>
/// Creates a new session and load the settings from a file
/// </summary>
/// <param name="fileName">The full path of file to load settings from.</param>
/// <returns>A new instance of <see cref="DriverSettingsSession" /> representing a session.</returns>
public static DriverSettingsSession CreateAndLoad(string fileName)
{
var session = new DriverSettingsSession();
session.Load(fileName);
return session;
}
/// <inheritdoc />
public override string ToString()
{
return $"{Handle} ({NumberOfProfiles} Profiles)";
}
/// <summary>
/// Finds an application by name. This method is useful when passed a full path of a file as it does return an
/// application almost always describing the NVIDIA driver behavior regarding the passed executable file.
/// </summary>
/// <param name="applicationName">The name of the application (with extension) or the full path of an executable file.</param>
/// <returns>An instance of <see cref="ProfileApplication" /> class.</returns>
public ProfileApplication FindApplication(string applicationName)
{
var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
{
return null;
}
var profile = new DriverSettingsProfile(profileHandle.Value, this);
return new ProfileApplication(application, profile);
}
/// <summary>
/// Finds a profile based on the application named passed. This method is useful when passed a full path of a file as
/// it does return a profile almost always describing the NVIDIA driver behavior regarding the passed executable file.
/// </summary>
/// <param name="applicationName">The name of the application (with extension) or the full path of an executable file.</param>
/// <returns>
/// An instance of <see cref="DriverSettingsProfile" /> class describing the NVIDIA driver behavior regarding the
/// passed executable file.
/// </returns>
public DriverSettingsProfile FindApplicationProfile(string applicationName)
{
var application = DRSApi.FindApplicationByName(Handle, applicationName, out var profileHandle);
if (application == null || !profileHandle.HasValue || profileHandle.Value.IsNull)
{
return null;
}
return new DriverSettingsProfile(profileHandle.Value, this);
}
/// <summary>
/// Finds a profile based on its name.
/// </summary>
/// <param name="profileName">The profile name to search for.</param>
/// <returns>An instance of <see cref="DriverSettingsProfile" /> class.</returns>
public DriverSettingsProfile FindProfileByName(string profileName)
{
var profileHandle = DRSApi.FindProfileByName(Handle, profileName);
if (profileHandle.IsNull)
{
return null;
}
return new DriverSettingsProfile(profileHandle, this);
}
/// <summary>
/// Resets all settings to default.
/// </summary>
public void RestoreDefaults()
{
DRSApi.RestoreDefaults(Handle);
}
/// <summary>
/// Saves the current session settings
/// </summary>
public void Save()
{
DRSApi.SaveSettings(Handle);
}
/// <summary>
/// Saves the current session settings to a file
/// </summary>
/// <param name="fileName">The full path of file to save settings to.</param>
public void Save(string fileName)
{
DRSApi.SaveSettings(Handle, fileName);
}
private void Load()
{
DRSApi.LoadSettings(Handle);
}
private void Load(string fileName)
{
DRSApi.LoadSettings(Handle, fileName);
}
private void ReleaseUnmanagedResources()
{
DRSApi.DestroySession(Handle);
}
/// <inheritdoc />
~DriverSettingsSession()
{
ReleaseUnmanagedResources();
}
}
}

View File

@@ -1,555 +0,0 @@
using System.ComponentModel;
namespace NvAPIWrapper.DRS
{
#pragma warning disable 1591
public enum KnownSettingId : uint
{
/// <summary>
/// Antialiasing - Line gamma
/// </summary>
[Description("Antialiasing - Line gamma")]
OpenGLAntiAliasingLineGamma = 0x2089BF6C,
/// <summary>
/// Deep color for 3D applications
/// </summary>
[Description("Deep color for 3D applications")]
OpenGLDeepColorScanOut = 0x2097C2F6,
/// <summary>
/// OpenGL default swap interval
/// </summary>
[Description("OpenGL default swap interval")]
OpenGLDefaultSwapInterval = 0x206A6582,
/// <summary>
/// OpenGL default swap interval fraction
/// </summary>
[Description("OpenGL default swap interval fraction")]
OpenGLDefaultSwapIntervalFractional = 0x206C4581,
/// <summary>
/// OpenGL default swap interval sign
/// </summary>
[Description("OpenGL default swap interval sign")]
OpenGLDefaultSwapIntervalSign = 0x20655CFA,
/// <summary>
/// Event Log Severity Threshold
/// </summary>
[Description("Event Log Severity Threshold")]
OpenGLEventLogSeverityThreshold = 0x209DF23E,
/// <summary>
/// Extension String version
/// </summary>
[Description("Extension String version")]
OpenGLExtensionStringVersion = 0x20FF7493,
/// <summary>
/// Buffer-flipping mode
/// </summary>
[Description("Buffer-flipping mode")] OpenGLForceBlit = 0x201F619F,
/// <summary>
/// Force Stereo shuttering
/// </summary>
[Description("Force Stereo shuttering")]
OpenGLForceStereo = 0x204D9A0C,
/// <summary>
/// Preferred OpenGL GPU
/// </summary>
[Description("Preferred OpenGL GPU")] OpenGLImplicitGPUAffinity = 0x20D0F3E6,
/// <summary>
/// Maximum frames allowed
/// </summary>
[Description("Maximum frames allowed")]
OpenGLMaximumFramesAllowed = 0x208E55E3,
/// <summary>
/// Exported Overlay pixel types
/// </summary>
[Description("Exported Overlay pixel types")]
OpenGLOverlayPixelType = 0x209AE66F,
/// <summary>
/// Enable overlay
/// </summary>
[Description("Enable overlay")] OpenGLOverlaySupport = 0x206C28C4,
/// <summary>
/// High level control of the rendering quality on OpenGL
/// </summary>
[Description("High level control of the rendering quality on OpenGL")]
OpenGLQualityEnhancements = 0x20797D6C,
/// <summary>
/// Unified back/depth buffer
/// </summary>
[Description("Unified back/depth buffer")]
OpenGLSingleBackDepthBuffer = 0x20A29055,
/// <summary>
/// Enable NV_gpu_multicast extension
/// </summary>
[Description("Enable NV_gpu_multicast extension")]
OpenGLSLIMulticast = 0x2092D3BE,
/// <summary>
/// Threaded optimization
/// </summary>
[Description("Threaded optimization")] OpenGLThreadControl = 0x20C1221E,
/// <summary>
/// Event Log Tmon Severity Threshold
/// </summary>
[Description("Event Log Tmon Severity Threshold")]
OpenGLTMONLevel = 0x202888C1,
/// <summary>
/// Triple buffering
/// </summary>
[Description("Triple buffering")] OpenGLTripleBuffer = 0x20FDD1F9,
/// <summary>
/// Antialiasing - Behavior Flags
/// </summary>
[Description("Antialiasing - Behavior Flags")]
AntiAliasingBehaviorFlags = 0x10ECDB82,
/// <summary>
/// Antialiasing - Transparency Multisampling
/// </summary>
[Description("Antialiasing - Transparency Multisampling")]
AntiAliasingModeAlphaToCoverage = 0x10FC2D9C,
/// <summary>
/// Antialiasing - Gamma correction
/// </summary>
[Description("Antialiasing - Gamma correction")]
AntiAliasingModeGammaCorrection = 0x107D639D,
/// <summary>
/// Antialiasing - Setting
/// </summary>
[Description("Antialiasing - Setting")]
AntiAliasingModeMethod = 0x10D773D2,
/// <summary>
/// Antialiasing - Transparency Supersampling
/// </summary>
[Description("Antialiasing - Transparency Supersampling")]
AntiAliasingModeReplay = 0x10D48A85,
/// <summary>
/// Antialiasing - Mode
/// </summary>
[Description("Antialiasing - Mode")] AntiAliasingModeSelector = 0x107EFC5B,
/// <summary>
/// Antialiasing - SLI AA
/// </summary>
[Description("Antialiasing - SLI AA")] AntiAliasingModeSelectorSLIAntiAliasing = 0x107AFC5B,
/// <summary>
/// Anisotropic filtering setting
/// </summary>
[Description("Anisotropic filtering setting")]
AnisotropicModeLevel = 0x101E61A9,
/// <summary>
/// Anisotropic filtering mode
/// </summary>
[Description("Anisotropic filtering mode")]
AnisotropicModeSelector = 0x10D2BB16,
/// <summary>
/// NVIDIA Predefined Ansel Usage
/// </summary>
[Description("NVIDIA Predefined Ansel Usage")]
AnselAllow = 0x1035DB89,
/// <summary>
/// Enable Ansel
/// </summary>
[Description("Enable Ansel")] AnselEnable = 0x1075D972,
/// <summary>
/// Ansel flags for enabled applications
/// </summary>
[Description("Ansel flags for enabled applications")]
AnselWhiteListed = 0x1085DA8A,
/// <summary>
/// Application Profile Notification Popup Timeout
/// </summary>
[Description("Application Profile Notification Popup Timeout")]
ApplicationProfileNotificationTimeOut = 0x104554B6,
/// <summary>
/// Steam Application ID
/// </summary>
[Description("Steam Application ID")] ApplicationSteamId = 0x107CDDBC,
/// <summary>
/// Battery Boost
/// </summary>
[Description("Battery Boost")] BatteryBoost = 0x10115C89,
/// <summary>
/// Do not display this profile in the Control Panel
/// </summary>
[Description("Do not display this profile in the Control Panel")]
ControlPanelHiddenProfile = 0x106D5CFF,
/// <summary>
/// List of Universal GPU ids
/// </summary>
[Description("List of Universal GPU ids")]
CUDAExcludedGPUs = 0x10354FF8,
/// <summary>
/// Maximum GPU Power
/// </summary>
[Description("Maximum GPU Power")] D3DOpenGLGPUMaximumPower = 0x10D1EF29,
/// <summary>
/// Export Performance Counters
/// </summary>
[Description("Export Performance Counters")]
ExportPerformanceCounters = 0x108F0841,
/// <summary>
/// NVIDIA Predefined FXAA Usage
/// </summary>
[Description("NVIDIA Predefined FXAA Usage")]
FXAAAllow = 0x1034CB89,
/// <summary>
/// Enable FXAA
/// </summary>
[Description("Enable FXAA")] FXAAEnable = 0x1074C972,
/// <summary>
/// Enable FXAA Indicator
/// </summary>
[Description("Enable FXAA Indicator")] FXAAIndicatorEnable = 0x1068FB9C,
/// <summary>
/// SLI indicator
/// </summary>
[Description("SLI indicator")] MCSFRShowSplit = 0x10287051,
/// <summary>
/// NVIDIA Quality upscaling
/// </summary>
[Description("NVIDIA Quality upscaling")]
NvidiaQualityUpScaling = 0x10444444,
/// <summary>
/// Maximum AA samples allowed for a given application
/// </summary>
[Description("Maximum AA samples allowed for a given application")]
OptimusMaximumAntiAliasing = 0x10F9DC83,
/// <summary>
/// Display the PhysX indicator
/// </summary>
[Description("Display the PhysX indicator")]
PhysxIndicator = 0x1094F16F,
/// <summary>
/// Power management mode
/// </summary>
[Description("Power management mode")] PreferredPerformanceState = 0x1057EB71,
/// <summary>
/// No override of Anisotropic filtering
/// </summary>
[Description("No override of Anisotropic filtering")]
PreventUiAnisotropicOverride = 0x103BCCB5,
/// <summary>
/// Frame Rate Limiter
/// </summary>
[Description("Frame Rate Limiter")] PerformanceStateFrameRateLimiter = 0x10834FEE,
/// <summary>
/// Frame Rate Limiter 2 Control
/// </summary>
[Description("Frame Rate Limiter 2 Control")]
PerformanceStateFrameRateLimiter2Control = 0x10834FFF,
/// <summary>
/// Frame Rate Monitor
/// </summary>
[Description("Frame Rate Monitor")] PerformanceStateFrameRateLimiterGpsControl = 0x10834F01,
/// <summary>
/// Frame Rate Monitor Control
/// </summary>
[Description("Frame Rate Monitor Control")]
PerformanceStateFrameRateMonitorControl = 0x10834F05,
/// <summary>
/// Maximum resolution allowed for a given application
/// </summary>
[Description("Maximum resolution allowed for a given application")]
ShimMaxResolution = 0x10F9DC82,
/// <summary>
/// Optimus flags for enabled applications
/// </summary>
[Description("Optimus flags for enabled applications")]
ShimMCCOMPAT = 0x10F9DC80,
/// <summary>
/// Enable application for Optimus
/// </summary>
[Description("Enable application for Optimus")]
ShimRenderingMode = 0x10F9DC81,
/// <summary>
/// Shim Rendering Mode Options per application for Optimus
/// </summary>
[Description("Shim Rendering Mode Options per application for Optimus")]
ShimRenderingOptions = 0x10F9DC84,
/// <summary>
/// Number of GPUs to use on SLI rendering mode
/// </summary>
[Description("Number of GPUs to use on SLI rendering mode")]
SLIGPUCount = 0x1033DCD1,
/// <summary>
/// NVIDIA predefined number of GPUs to use on SLI rendering mode
/// </summary>
[Description("NVIDIA predefined number of GPUs to use on SLI rendering mode")]
SLIPredefinedGPUCount = 0x1033DCD2,
/// <summary>
/// NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10
/// </summary>
[Description("NVIDIA predefined number of GPUs to use on SLI rendering mode on DirectX 10")]
SLIPredefinedGPUCountDX10 = 0x1033DCD3,
/// <summary>
/// NVIDIA predefined SLI mode
/// </summary>
[Description("NVIDIA predefined SLI mode")]
SLIPredefinedMode = 0x1033CEC1,
/// <summary>
/// NVIDIA predefined SLI mode on DirectX 10
/// </summary>
[Description("NVIDIA predefined SLI mode on DirectX 10")]
SLIPredefinedModeDX10 = 0x1033CEC2,
/// <summary>
/// SLI rendering mode
/// </summary>
[Description("SLI rendering mode")] SLIRenderingMode = 0x1033CED1,
/// <summary>
/// Virtual Reality pre-rendered frames
/// </summary>
[Description("Virtual Reality pre-rendered frames")]
VRPreRenderLimit = 0x10111133,
/// <summary>
/// Toggle the VRR global feature
/// </summary>
[Description("Toggle the VRR global feature")]
VRRFeatureIndicator = 0x1094F157,
/// <summary>
/// Display the VRR Overlay Indicator
/// </summary>
[Description("Display the VRR Overlay Indicator")]
VRROverlayIndicator = 0x1095F16F,
/// <summary>
/// VRR requested state
/// </summary>
[Description("VRR requested state")] VRRRequestState = 0x1094F1F7,
/// <summary>
/// G-SYNC
/// </summary>
[Description("G-SYNC")] VRRApplicationOverride = 0x10A879CF,
/// <summary>
/// G-SYNC
/// </summary>
[Description("G-SYNC")] VRRApplicationOverrideRequestState = 0x10A879AC,
/// <summary>
/// Enable G-SYNC globally
/// </summary>
[Description("Enable G-SYNC globally")]
VRRMode = 0x1194F158,
/// <summary>
/// Flag to control smooth AFR behavior
/// </summary>
[Description("Flag to control smooth AFR behavior")]
VSyncSmoothAFR = 0x101AE763,
/// <summary>
/// Variable refresh Rate
/// </summary>
[Description("Variable refresh Rate")] VSyncVRRControl = 0x10A879CE,
/// <summary>
/// Vsync - Behavior Flags
/// </summary>
[Description("Vsync - Behavior Flags")]
VSyncBehaviorFlags = 0x10FDEC23,
/// <summary>
/// Stereo - Swap eyes
/// </summary>
[Description("Stereo - Swap eyes")] WKSAPIStereoEyesExchange = 0x11AE435C,
/// <summary>
/// Stereo - Display mode
/// </summary>
[Description("Stereo - Display mode")] WKSAPIStereoMode = 0x11E91A61,
/// <summary>
/// Memory Allocation Policy
/// </summary>
[Description("Memory Allocation Policy")]
WKSMemoryAllocationPolicy = 0x11112233,
/// <summary>
/// Stereo - Dongle Support
/// </summary>
[Description("Stereo - Dongle Support")]
WKSStereoDongleSupport = 0x112493BD,
/// <summary>
/// Stereo - Enable
/// </summary>
[Description("Stereo - Enable")] WKSStereoSupport = 0x11AA9E99,
/// <summary>
/// Stereo <20> swap mode
/// </summary>
[Description("Stereo <20> swap mode")] WKSStereoSwapMode = 0x11333333,
/// <summary>
/// Ambient Occlusion
/// </summary>
[Description("Ambient Occlusion")] AmbientOcclusionMode = 0x667329,
/// <summary>
/// NVIDIA Predefined Ambient Occlusion Usage
/// </summary>
[Description("NVIDIA Predefined Ambient Occlusion Usage")]
AmbientOcclusionModeActive = 0x664339,
/// <summary>
/// Texture filtering - Driver Controlled LOD Bias
/// </summary>
[Description("Texture filtering - Driver Controlled LOD Bias")]
AutoLODBiasAdjust = 0x638E8F,
/// <summary>
/// Export Performance Counters for DX9 only
/// </summary>
[Description("Export Performance Counters for DX9 only")]
ExportPerformanceCountersDX9Only = 0xB65E72,
/// <summary>
/// ICafe Settings
/// </summary>
[Description("ICafe Settings")] ICafeLogoConfig = 0xDB1337,
/// <summary>
/// Texture filtering - LOD Bias
/// </summary>
[Description("Texture filtering - LOD Bias")]
LODBiasAdjust = 0x738E8F,
/// <summary>
/// Enable sample interleaving (MFAA)
/// </summary>
[Description("Enable sample interleaving (MFAA)")]
MaxwellBSampleInterleave = 0x98C1AC,
/// <summary>
/// Maximum pre-rendered frames
/// </summary>
[Description("Maximum pre-rendered frames")]
PreRenderLimit = 0x7BA09E,
/// <summary>
/// Shader Cache
/// </summary>
[Description("Shader Cache")] PerformanceStateShaderDiskCache = 0x198FFF,
/// <summary>
/// Texture filtering - Anisotropic sample optimization
/// </summary>
[Description("Texture filtering - Anisotropic sample optimization")]
PerformanceStateTextureFilteringAnisotropicOptimization = 0xE73211,
/// <summary>
/// Texture filtering - Anisotropic filter optimization
/// </summary>
[Description("Texture filtering - Anisotropic filter optimization")]
PerformanceStateTextureFilteringBiLinearInAnisotropic = 0x84CD70,
/// <summary>
/// Texture filtering - Trilinear optimization
/// </summary>
[Description("Texture filtering - Trilinear optimization")]
PerformanceStateTextureFilteringDisableTrilinearSlope = 0x2ECAF2,
/// <summary>
/// Texture filtering - Negative LOD bias
/// </summary>
[Description("Texture filtering - Negative LOD bias")]
PerformanceStateTextureFilteringNoNegativeLODBias = 0x19BB68,
/// <summary>
/// Texture filtering - Quality
/// </summary>
[Description("Texture filtering - Quality")]
QualityEnhancements = 0xCE2691,
/// <summary>
/// Preferred refresh rate
/// </summary>
[Description("Preferred refresh rate")]
RefreshRateOverride = 0x64B541,
/// <summary>
/// PowerThrottle
/// </summary>
[Description("PowerThrottle")] SetPowerThrottleForPCIeCompliance = 0xAE785C,
/// <summary>
/// VAB Default Data
/// </summary>
[Description("VAB Default Data")] SetVABData = 0xAB8687,
/// <summary>
/// Vertical Sync
/// </summary>
[Description("Vertical Sync")] VSyncMode = 0xA879CF,
/// <summary>
/// Vertical Sync Tear Control
/// </summary>
[Description("Vertical Sync Tear Control")]
VSyncTearControl = 0x5A375C,
InvalidSetting = 0xFFFFFFFF
}
#pragma warning restore 1591
}

View File

@@ -1,424 +0,0 @@
using System;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.DRS.Structures;
using NvAPIWrapper.Native.Exceptions;
using NvAPIWrapper.Native.Interfaces.DRS;
namespace NvAPIWrapper.DRS
{
/// <summary>
/// Represents an application rule registered in a profile
/// </summary>
public class ProfileApplication
{
private IDRSApplication _application;
internal ProfileApplication(IDRSApplication application, DriverSettingsProfile profile)
{
Profile = profile;
_application = application;
}
/// <summary>
/// Gets the application name
/// </summary>
public string ApplicationName
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
return _application.ApplicationName;
}
}
/// <summary>
/// Gets the application command line
/// </summary>
public string CommandLine
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
if (_application is DRSApplicationV4 applicationV4)
{
return applicationV4.ApplicationCommandLine;
}
return null;
}
}
/// <summary>
/// Gets a list of files that are necessary to be present inside the application parent directory
/// </summary>
public string[] FilesInFolder
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
if (_application is DRSApplicationV2 applicationV2)
{
return applicationV2.FilesInFolder;
}
if (_application is DRSApplicationV3 applicationV3)
{
return applicationV3.FilesInFolder;
}
if (_application is DRSApplicationV4 applicationV4)
{
return applicationV4.FilesInFolder;
}
return null;
}
}
/// <summary>
/// Gets the application friendly name
/// </summary>
public string FriendlyName
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
return _application.FriendlyName;
}
}
/// <summary>
/// Gets a boolean value indicating if this application rule needs a specific command line; or <see langword="null" />
/// if this information is not available.
/// </summary>
public bool? HasCommandLine
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
if (_application is DRSApplicationV3 applicationV3)
{
return applicationV3.HasCommandLine;
}
if (_application is DRSApplicationV4 applicationV4)
{
return applicationV4.HasCommandLine;
}
return null;
}
}
/// <summary>
/// Gets a boolean value indicating if this application is a metro application; or <see langword="null" /> if this
/// information is not available.
/// </summary>
public bool? IsMetroApplication
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
if (_application is DRSApplicationV3 applicationV3)
{
return applicationV3.IsMetroApplication;
}
if (_application is DRSApplicationV4 applicationV4)
{
return applicationV4.IsMetroApplication;
}
return null;
}
}
/// <summary>
/// Gets a boolean value indicating if this application is predefined by the NVIDIA driver
/// </summary>
public bool IsPredefined
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
return _application.IsPredefined;
}
}
/// <summary>
/// Gets a boolean value indicating if this instance of <see cref="ProfileApplication" /> is a valid instance
/// representing an application in a profile
/// </summary>
public bool IsValid
{
get => _application != null && Profile.IsValid;
}
/// <summary>
/// Gets the application launcher name
/// </summary>
public string LauncherName
{
get
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
return _application.LauncherName;
}
}
/// <summary>
/// Gets the parent profile instance
/// </summary>
public DriverSettingsProfile Profile { get; }
/// <summary>
/// Creates a new application
/// </summary>
/// <param name="profile">The profile to create the new application in.</param>
/// <param name="applicationName">The application name (with extension).</param>
/// <param name="friendlyName">The application friendly name.</param>
/// <param name="launcherName">The application launcher name.</param>
/// <param name="fileInFolders">An array of files necessary to be present inside 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 command line string.</param>
/// <returns>A new instance of <see cref="ProfileApplication" /> representing the newly created application.</returns>
// ReSharper disable once TooManyArguments
// ReSharper disable once FunctionComplexityOverflow
public static ProfileApplication CreateApplication(
DriverSettingsProfile profile,
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
var createDelegates = new Func<string, string, string, string[], bool, string, IDRSApplication>[]
{
CreateApplicationInstanceV4,
CreateApplicationInstanceV3,
CreateApplicationInstanceV2,
CreateApplicationInstanceV1
};
Exception lastException = null;
IDRSApplication application = null;
foreach (var func in createDelegates)
{
try
{
// ReSharper disable once EventExceptionNotDocumented
application = func(
applicationName,
friendlyName,
launcherName,
fileInFolders,
isMetro,
commandLine
);
break;
}
catch (NVIDIANotSupportedException e)
{
// ignore
lastException = e;
}
}
if (application == null)
{
// ReSharper disable once ThrowingSystemException
throw lastException;
}
application = DRSApi.CreateApplication(profile.Session.Handle, profile.Handle, application);
return new ProfileApplication(application, profile);
}
// ReSharper disable once TooManyArguments
private static IDRSApplication CreateApplicationInstanceV1(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
if (!string.IsNullOrWhiteSpace(commandLine))
{
throw new NotSupportedException(
"CommandLine is not supported with the current execution environment."
);
}
if (fileInFolders?.Length > 0)
{
throw new NotSupportedException(
"Same folder file presence check is not supported with the current execution environment."
);
}
return new DRSApplicationV1(
applicationName,
friendlyName,
launcherName
);
}
// ReSharper disable once TooManyArguments
private static IDRSApplication CreateApplicationInstanceV2(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
if (!string.IsNullOrWhiteSpace(commandLine))
{
throw new NotSupportedException(
"CommandLine is not supported with the current execution environment."
);
}
return new DRSApplicationV2(
applicationName,
friendlyName,
launcherName,
fileInFolders
);
}
// ReSharper disable once TooManyArguments
private static IDRSApplication CreateApplicationInstanceV3(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
if (!string.IsNullOrWhiteSpace(commandLine))
{
throw new NotSupportedException(
"CommandLine is not supported with the current execution environment."
);
}
return new DRSApplicationV3(
applicationName,
friendlyName,
launcherName,
fileInFolders,
isMetro
);
}
// ReSharper disable once TooManyArguments
private static IDRSApplication CreateApplicationInstanceV4(
string applicationName,
string friendlyName = null,
string launcherName = null,
string[] fileInFolders = null,
bool isMetro = false,
string commandLine = null
)
{
return new DRSApplicationV4(
applicationName,
friendlyName,
launcherName,
fileInFolders,
isMetro,
commandLine
);
}
/// <inheritdoc />
public override string ToString()
{
if (!IsValid)
{
return "[Invalid]";
}
if (IsPredefined)
{
return $"{ApplicationName} (Predefined)";
}
return ApplicationName;
}
/// <summary>
/// Deletes this application and makes this instance invalid
/// </summary>
public void Delete()
{
if (!IsValid)
{
throw new InvalidOperationException(
"Can not perform this operation with an invalid application instance."
);
}
DRSApi.DeleteApplication(Profile.Session.Handle, Profile.Handle, _application);
_application = null;
}
}
}

View File

@@ -1,126 +0,0 @@
using System;
using NvAPIWrapper.Native.DRS;
using NvAPIWrapper.Native.DRS.Structures;
namespace NvAPIWrapper.DRS
{
/// <summary>
/// Represents a profile setting and its value
/// </summary>
public class ProfileSetting
{
private readonly DRSSettingV1 _setting;
internal ProfileSetting(DRSSettingV1 setting)
{
_setting = setting;
}
/// <summary>
/// Gets the current value of the setting
/// </summary>
public object CurrentValue
{
get
{
if (IsPredefinedValueValid && IsCurrentValuePredefined)
{
return _setting.PredefinedValue;
}
return _setting.CurrentValue;
}
}
/// <summary>
/// Gets a boolean value indicating if the current value is the predefined value.
/// </summary>
public bool IsCurrentValuePredefined
{
get => _setting.IsCurrentValuePredefined;
}
/// <summary>
/// Gets a boolean value indicating if this setting had a predefined valid value.
/// </summary>
public bool IsPredefinedValueValid
{
get => _setting.IsPredefinedValueValid;
}
/// <summary>
/// Gets the predefined value of this setting.
/// </summary>
public object PredefinedValue
{
get
{
if (!IsPredefinedValueValid)
{
throw new InvalidOperationException("Predefined value is not valid.");
}
return _setting.PredefinedValue;
}
}
/// <summary>
/// Gets the setting identification number
/// </summary>
public uint SettingId
{
get => _setting.Id;
}
/// <summary>
/// Gets additional information regarding this setting including possible valid values
/// </summary>
public SettingInfo SettingInfo
{
get => SettingInfo.FromId(SettingId);
}
/// <summary>
/// Gets the profile location of this setting
/// </summary>
public DRSSettingLocation SettingLocation
{
get => _setting.SettingLocation;
}
/// <summary>
/// Gets the value type of this setting
/// </summary>
public DRSSettingType SettingType
{
get => _setting.SettingType;
}
/// <inheritdoc />
public override string ToString()
{
string settingName = null;
try
{
settingName = SettingInfo.Name;
}
catch
{
// ignore;
}
if (string.IsNullOrWhiteSpace(settingName))
{
settingName = $"#{SettingId:X}";
}
if (IsCurrentValuePredefined)
{
return $"{settingName} = {CurrentValue ?? "[NULL]"} (Predefined)";
}
return $"{settingName} = {CurrentValue ?? "[NULL]"}";
}
}
}

View File

@@ -1,360 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.DRS;
namespace NvAPIWrapper.DRS
{
/// <summary>
/// Contains information about a setting
/// </summary>
public class SettingInfo
{
private static uint[] _availableSettingIds;
private SettingInfo(uint settingId)
{
SettingId = settingId;
}
/// <summary>
/// Gets an array of available possible valid values.
/// </summary>
public object[] AvailableValues
{
get
{
if (!IsAvailable)
{
return null;
}
return DRSApi.EnumAvailableSettingValues(SettingId).Values;
}
}
/// <summary>
/// Gets the default value of this setting
/// </summary>
public object DefaultValue
{
get
{
if (!IsAvailable)
{
return null;
}
var values = DRSApi.EnumAvailableSettingValues(SettingId);
return values.DefaultValue;
}
}
/// <summary>
/// Gets a boolean value indicating if this setting is available on this machine and with the current version of NVIDIA
/// driver
/// </summary>
public bool IsAvailable
{
get => GetAvailableSetting().Any(info => info.SettingId == SettingId);
}
/// <summary>
/// Gets a boolean value indicating if this setting is know by this library
/// </summary>
public bool IsKnown
{
get => IsSettingKnown(SettingId);
}
/// <summary>
/// Gets the description of this setting from the library or <see langword="null" /> if this setting is not known by
/// the library.
/// </summary>
public string KnownDescription
{
get
{
if (!IsKnown || KnownSettingId == null)
{
return null;
}
return GetSettingDescription(KnownSettingId.Value);
}
}
/// <summary>
/// Gets the known identification number of this setting from the library or <see langword="null" /> if this setting is
/// not known by the library.
/// </summary>
public KnownSettingId? KnownSettingId
{
get
{
if (!IsKnown)
{
return null;
}
return GetKnownSettingId(SettingId);
}
}
/// <summary>
/// Gets the type of a static class or an enum containing possible known values for this setting from the library or
/// <see langword="null" /> if this setting is not known by the library
/// </summary>
public Type KnownValueType
{
get
{
if (!IsKnown || !IsAvailable)
{
return null;
}
var name = KnownSettingId.ToString();
var nameSpace = typeof(SettingInfo).Namespace + ".SettingValues";
if (SettingType == DRSSettingType.Integer)
{
return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
type.IsEnum &&
type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
}
if (SettingType == DRSSettingType.String || SettingType == DRSSettingType.UnicodeString)
{
return Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type =>
type.IsClass &&
type.Namespace?.Equals(nameSpace, StringComparison.InvariantCultureIgnoreCase) == true &&
type.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
}
return null;
}
}
/// <summary>
/// Gets the name of the setting from NVIDIA driver or <see langword="null" /> if the setting is not available on this
/// machine.
/// </summary>
public string Name
{
get
{
if (!IsAvailable)
{
return null;
}
return DRSApi.GetSettingNameFromId(SettingId);
}
}
/// <summary>
/// Gets the setting identification number
/// </summary>
public uint SettingId { get; }
/// <summary>
/// Gets the value type of the setting from NVIDIA driver or <see langword="null" /> if the setting is not available on
/// this machine.
/// </summary>
public DRSSettingType? SettingType
{
get
{
if (!IsAvailable)
{
return null;
}
var values = DRSApi.EnumAvailableSettingValues(SettingId);
return values.SettingType;
}
}
/// <summary>
/// Gets information regarding a setting from its identification number.
/// </summary>
/// <param name="settingId">The identification number of the setting to get information about.</param>
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
public static SettingInfo FromId(uint settingId)
{
return new SettingInfo(settingId);
}
/// <summary>
/// Gets information regarding a setting from its known identification number.
/// </summary>
/// <param name="settingId">The known identification number of the setting to get information about.</param>
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
public static SettingInfo FromKnownSettingId(KnownSettingId settingId)
{
return FromId(GetSettingId(settingId));
}
/// <summary>
/// Gets information regarding a setting from its name.
/// </summary>
/// <param name="settingName">The name of the setting to get information about.</param>
/// <returns>An instance of <see cref="SettingInfo" /> containing information about the setting.</returns>
public static SettingInfo FromName(string settingName)
{
var settingId = DRSApi.GetSettingIdFromName(settingName);
return FromId(settingId);
}
/// <summary>
/// Gets a list of all available setting on this machine
/// </summary>
/// <returns>Instances of <see cref="SettingInfo" /> each representing a available setting on this machine.</returns>
public static SettingInfo[] GetAvailableSetting()
{
if (_availableSettingIds == null)
{
_availableSettingIds = DRSApi.EnumAvailableSettingIds();
}
return _availableSettingIds.Select(FromId).ToArray();
}
/// <summary>
/// Gets the known identification number of a setting from its identification number
/// </summary>
/// <param name="settingId">The setting identification number.</param>
/// <returns>The known setting identification number if the setting is known; otherwise <see langword="null" />.</returns>
public static KnownSettingId? GetKnownSettingId(uint settingId)
{
if (!IsSettingKnown(settingId))
{
return null;
}
return (KnownSettingId) settingId;
}
/// <summary>
/// Gets the known setting description from its identification number
/// </summary>
/// <param name="knownSettingId">The known setting identification number.</param>
/// <returns>The known setting description if available; otherwise <see langword="null" />.</returns>
public static string GetSettingDescription(KnownSettingId knownSettingId)
{
var enumName = Enum.GetName(typeof(KnownSettingId), knownSettingId);
if (enumName == null)
{
return null;
}
var enumField = typeof(KnownSettingId).GetField(enumName);
if (enumField == null)
{
return null;
}
var descriptionAttribute = enumField
.GetCustomAttributes(typeof(DescriptionAttribute), false)
.OfType<DescriptionAttribute>()
.FirstOrDefault();
if (string.IsNullOrWhiteSpace(descriptionAttribute?.Description))
{
return null;
}
return descriptionAttribute.Description;
}
/// <summary>
/// Gets the identification number of a setting from its known identification number
/// </summary>
/// <param name="knownSettingId">The known setting identification number.</param>
/// <returns>The setting identification number.</returns>
public static uint GetSettingId(KnownSettingId knownSettingId)
{
return (uint) knownSettingId;
}
/// <summary>
/// Checks if a setting is known by this library.
/// </summary>
/// <param name="settingId">The setting identification number.</param>
/// <returns>true if setting is known by this library; otherwise false.</returns>
public static bool IsSettingKnown(uint settingId)
{
return Enum.IsDefined(typeof(KnownSettingId), settingId);
}
/// <inheritdoc />
public override string ToString()
{
try
{
var settingName = Name;
if (!string.IsNullOrWhiteSpace(settingName))
{
return settingName;
}
}
catch
{
// ignore;
}
return $"#{SettingId:X}";
}
/// <summary>
/// Tries to resolve the name of a known value using its actual value
/// </summary>
/// <param name="value">The actual value</param>
/// <returns>The name of the known value member.</returns>
public string ResolveKnownValueName(object value)
{
if (!IsKnown)
{
return null;
}
var valueType = KnownValueType;
if (valueType == null)
{
return null;
}
if (valueType.IsEnum)
{
return Enum.GetName(valueType, value);
}
var comparerType = typeof(EqualityComparer<>).MakeGenericType(value.GetType());
var comparer = comparerType.GetProperty(nameof(EqualityComparer<object>.Default))?.GetValue(null);
if (!(comparer is IEqualityComparer equalityComparer))
{
return null;
}
return valueType.GetFields()
.FirstOrDefault(info =>
info.IsStatic &&
equalityComparer.Equals(info.GetValue(null), value)
)?.Name;
}
}
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AmbientOcclusionMode : uint
{
Off = 0x0,
Low = 0x1,
Medium = 0x2,
High = 0x3,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AmbientOcclusionModeActive : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AnisotropicModeLevel : uint
{
Mask = 0xFFFF,
NonePoint = 0x0,
NoneLinear = 0x1,
Maximum = 0x10,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AnisotropicModeSelector : uint
{
Mask = 0xF,
Application = 0x0,
User = 0x1,
Condition = 0x2,
Maximum = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AnselAllow : uint
{
Disallowed = 0x0,
Allowed = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AnselEnable : uint
{
Off = 0x0,
On = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AnselWhiteListed : uint
{
Disallowed = 0x0,
Allowed = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,43 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingBehaviorFlags : uint
{
None = 0x0,
TreatOverrideAsApplicationControlled = 0x1,
TreatOverrideAsEnhance = 0x2,
DisableOverride = 0x3,
TreatEnhanceAsApplicationControlled = 0x4,
TreatEnhanceAsOverride = 0x8,
DisableEnhance = 0xC,
MapVCAAToMultiSampling = 0x10000,
SLIDisableTransparencySupersampling = 0x20000,
DisableCplaa = 0x40000,
SkipRTDIMCheckForEnhance = 0x80000,
DisableSLIAntiAliasing = 0x100000,
Default = 0x0,
AntiAliasingRTBPPDIV4 = 0xF0000000,
AntiAliasingRTBPPDIV4Shift = 0x1C,
NonAntiAliasingRTBPPDIV4 = 0xF000000,
NonAntiAliasingRTBPPDIV4Shift = 0x18,
Mask = 0xFF1F000F
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeAlphaToCoverage : uint
{
ModeMask = 0x4,
ModeOff = 0x0,
ModeOn = 0x4,
ModeMaximum = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,23 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeGammaCorrection : uint
{
Mask = 0x3,
Off = 0x0,
OnIfFOS = 0x1,
OnAlways = 0x2,
Maximum = 0x2,
Default = 0x0,
DefaultTesla = 0x2,
DefaultFermi = 0x2
}
#pragma warning restore 1591
}

View File

@@ -1,109 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeMethod : uint
{
None = 0x0,
SuperSample2XHorizontal = 0x1,
SuperSample2XVertical = 0x2,
SuperSample15X15 = 0x2,
Free0X03 = 0x3,
Free0X04 = 0x4,
SuperSample4X = 0x5,
SuperSample4XBias = 0x6,
SuperSample4XGaussian = 0x7,
Free0X08 = 0x8,
Free0X09 = 0x9,
SuperSample9X = 0xA,
SuperSample9XBias = 0xB,
SuperSample16X = 0xC,
SuperSample16XBias = 0xD,
MultiSample2XDiagonal = 0xE,
MultiSample2XQuincunx = 0xF,
MultiSample4X = 0x10,
Free0X11 = 0x11,
MultiSample4XGaussian = 0x12,
MixedSample4XSkewed4Tap = 0x13,
Free0X14 = 0x14,
Free0X15 = 0x15,
MixedSample6X = 0x16,
MixedSample6XSkewed6Tap = 0x17,
MixedSample8X = 0x18,
MixedSample8XSkewed8Tap = 0x19,
MixedSample16X = 0x1A,
MultiSample4XGamma = 0x1B,
MultiSample16X = 0x1C,
VCAA32X8V24 = 0x1D,
CorruptionCheck = 0x1E,
_6XCT = 0x1F,
MultiSample2XDiagonalGamma = 0x20,
SuperSample4XGamma = 0x21,
MultiSample4XFosgamma = 0x22,
MultiSample2XDiagonalFosgamma = 0x23,
SuperSample4XFosgamma = 0x24,
MultiSample8X = 0x25,
VCAA8X4V4 = 0x26,
VCAA16X4V12 = 0x27,
VCAA16X8V8 = 0x28,
MixedSample32X = 0x29,
SuperVCAA64X4V12 = 0x2A,
SuperVCAA64X8V8 = 0x2B,
MixedSample64X = 0x2C,
MixedSample128X = 0x2D,
Count = 0x2E,
MethodMask = 0xFFFF,
MethodMaximum = 0xF1C57815,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,49 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeReplay : uint
{
SamplesMask = 0x70,
SamplesOne = 0x0,
SamplesTwo = 0x10,
SamplesFour = 0x20,
SamplesEight = 0x30,
SamplesMaximum = 0x30,
ModeMask = 0xF,
ModeOff = 0x0,
ModeAlphaTest = 0x1,
ModePixelKill = 0x2,
ModeDynamicBranch = 0x4,
ModeOptimal = 0x4,
ModeAll = 0x8,
ModeMaximum = 0xF,
Transparency = 0x23,
DisAllowTraa = 0x100,
TransparencyDefault = 0x0,
TransparencyDefaultTesla = 0x0,
TransparencyDefaultFermi = 0x0,
Mask = 0x17F,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeSelector : uint
{
Mask = 0x3,
ApplicationControl = 0x0,
Override = 0x1,
Enhance = 0x2,
Maximum = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AntiAliasingModeSelectorSLIAntiAliasing : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ApplicationProfileNotificationTimeOut : uint
{
Disabled = 0x0,
NineSeconds = 0x9,
FifteenSeconds = 0xF,
ThirtySeconds = 0x1E,
OneMinute = 0x3C,
TwoMinutes = 0x78,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum AutoLODBiasAdjust : uint
{
Off = 0x0,
On = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum BatteryBoost : uint
{
Minimum = 0x1,
Maximum = 0xFF,
Enabled = 0x10000000,
Disabled = 0x0,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,10 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public static class CUDAExcludedGPUs
{
public const string Default = "none";
public const string None = "none";
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ControlPanelHiddenProfile : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,10 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public static class D3DOpenGLGPUMaximumPower
{
public const string Default = "0";
public const string DefaultPower = "0";
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ExportPerformanceCounters : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ExportPerformanceCountersDX9Only : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum FXAAAllow : uint
{
Disallowed = 0x0,
Allowed = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum FXAAEnable : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum FXAAIndicatorEnable : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum LODBiasAdjust : uint
{
Minimum = 0xFFFFFF80,
Maximum = 0x80,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum MCSFRShowSplit : uint
{
Disabled = 0x34534064,
Enabled = 0x24545582,
Default = 0x34534064
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum MaxwellBSampleInterleave : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum NvidiaQualityUpScaling : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLAntiAliasingLineGamma : uint
{
Disabled = 0x10,
Enabled = 0x23,
Minimum = 0x1,
Maximum = 0x64,
Default = 0x10
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLDeepColorScanOut : uint
{
Disable = 0x0,
Enable = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,27 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLDefaultSwapInterval : uint
{
Tear = 0x0,
VSyncOne = 0x1,
VSync = 0x1,
ValueMask = 0xFFFF,
ForceMask = 0xF0000000,
ForceOff = 0xF0000000,
ForceOn = 0x10000000,
ApplicationControlled = 0x0,
Disable = 0xFFFFFFFF,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLDefaultSwapIntervalFractional : uint
{
ZeroScanLines = 0x0,
OneFullFrameOfScanLines = 0x64,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLDefaultSwapIntervalSign : uint
{
Positive = 0x0,
Negative = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLEventLogSeverityThreshold : uint
{
Disable = 0x0,
Critical = 0x1,
Warning = 0x2,
Information = 0x3,
All = 0x4,
Default = 0x4
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLForceBlit : uint
{
On = 0x1,
Off = 0x0,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLForceStereo : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,12 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public static class OpenGLImplicitGPUAffinity
{
public const string AutoSelect = "autoselect";
public const string Default = "autoselect";
public const string EnvironmentVariable = "OGL_DEFAULT_RENDERING_GPU";
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLOverlayPixelType : uint
{
None = 0x0,
CI = 0x1,
RGBA = 0x2,
CIAndRGBA = 0x3,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLOverlaySupport : uint
{
Off = 0x0,
On = 0x1,
ForceSoftware = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLQualityEnhancements : uint
{
HighQuality = 0xFFFFFFF6,
Quality = 0x0,
Performance = 0xA,
HighPerformance = 0x14,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLSLIMulticast : uint
{
Disable = 0x0,
Enable = 0x1,
ForceDisable = 0x2,
AllowMosaic = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLSingleBackDepthBuffer : uint
{
Disable = 0x0,
Enable = 0x1,
UseHardwareDefault = 0xFFFFFFFF,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLTMONLevel : uint
{
Disable = 0x0,
Critical = 0x1,
Warning = 0x2,
Information = 0x3,
Most = 0x4,
Verbose = 0x5,
Default = 0x4
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLThreadControl : uint
{
Enable = 0x1,
Disable = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OpenGLTripleBuffer : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum OptimusMaximumAntiAliasing : uint
{
Minimum = 0x0,
Maximum = 0x10,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,47 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateFrameRateLimiter : uint
{
Disabled = 0x0,
FPS20 = 0x14,
FPS30 = 0x1E,
FPS40 = 0x28,
Fpsmask = 0xFF,
NoAlign = 0x4000,
BBQM = 0x8000,
LowerFPSToAlign = 0x20000,
ForceVSyncOff = 0x40000,
GpsWeb = 0x80000,
Disallowed = 0x200000,
UseCPUWait = 0x400000,
NoLagOffset = 0x800000,
Accurate = 0x10000000,
AllowWindowed = 0x20000000,
ForceOn = 0x40000000,
Enabled = 0x80000000,
OpenGLRemoteDesktop = 0xE000003C,
Mask = 0xF0EEC0FF,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,27 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateFrameRateLimiter2Control : uint
{
DelayCE = 0x0,
Delay3D = 0x1,
AvoidNoop = 0x2,
DelayCEPresent3D = 0x8,
AllowAllMaxwell = 0x10,
AllowAll = 0x20,
ForceOff = 0x40,
EnableVCE = 0x80,
DefaultForGM10X = 0x11,
Default = 0x88
}
#pragma warning restore 1591
}

View File

@@ -1,31 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateFrameRateLimiterGpsControl : uint
{
Disabled = 0x0,
DecreaseFilterMask = 0x1FF,
PauseTimeMask = 0xFE00,
PauseTimeShift = 0x9,
TargetRenderTimeMask = 0xFF0000,
TargetRenderTimeShift = 0x10,
PerformanceStepSizeMask = 0x1F000000,
PerformanceStepSizeShift = 0x18,
IncreaseFilterMask = 0xE0000000,
IncreaseFilterShift = 0x1D,
OptimalSetting = 0x4A5A3219,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,39 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateFrameRateMonitorControl : uint
{
Disabled = 0x0,
ThresholdPctMask = 0xFF,
MovingAverageXMask = 0xF00,
MovingAverageXShift = 0x8,
EnableFineGrained = 0x400000,
EnableOnVSync = 0x800000,
VSyncOffsetMask = 0xF000,
VSyncOffsetShift = 0xC,
FPSUseFrl = 0x0,
FPS30 = 0x1E000000,
FPS60 = 0x3C000000,
FPSMask = 0xFF000000,
FPSShift = 0x18,
OptimalSetting = 0x364,
VSyncOptimalSetting = 0x80F364,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateShaderDiskCache : uint
{
Off = 0x0,
On = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateTextureFilteringAnisotropicOptimization : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateTextureFilteringBiLinearInAnisotropic : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateTextureFilteringDisableTrilinearSlope : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PerformanceStateTextureFilteringNoNegativeLODBias : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PhysxIndicator : uint
{
Disabled = 0x34534064,
Enabled = 0x24545582,
Default = 0x34534064
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PreRenderLimit : uint
{
Minimum = 0x0,
Maximum = 0xFF,
ApplicationControlled = 0x0,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,25 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PreferredPerformanceState : uint
{
Adaptive = 0x0,
PreferMaximum = 0x1,
DriverControlled = 0x2,
PreferConsistentPerformance = 0x3,
PreferMinimum = 0x4,
OptimalPower = 0x5,
Minimum = 0x0,
Maximum = 0x5,
Default = 0x5
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum PreventUiAnisotropicOverride : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum QualityEnhancements : uint
{
HighQuality = 0xFFFFFFF6,
Quality = 0x0,
Performance = 0xA,
HighPerformance = 0x14,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum RefreshRateOverride : uint
{
ApplicationControlled = 0x0,
HighestAvailable = 0x1,
LowLatencyRefreshRateMask = 0xFF0,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIGPUCount : uint
{
AutoSelect = 0x0,
One = 0x1,
Two = 0x2,
Three = 0x3,
Four = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIPredefinedGPUCount : uint
{
AutoSelect = 0x0,
One = 0x1,
Two = 0x2,
Three = 0x3,
Four = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIPredefinedGPUCountDX10 : uint
{
AutoSelect = 0x0,
One = 0x1,
Two = 0x2,
Three = 0x3,
Four = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIPredefinedMode : uint
{
AutoSelect = 0x0,
ForceSingle = 0x1,
ForceAFR = 0x2,
ForceAFR2 = 0x3,
ForceSFR = 0x4,
ForceAFROfSFRFallback3AFR = 0x5,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIPredefinedModeDX10 : uint
{
AutoSelect = 0x0,
ForceSingle = 0x1,
ForceAFR = 0x2,
ForceAFR2 = 0x3,
ForceSFR = 0x4,
ForceAFROfSFRFallback3AFR = 0x5,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SLIRenderingMode : uint
{
AutoSelect = 0x0,
ForceSingle = 0x1,
ForceAFR = 0x2,
ForceAFR2 = 0x3,
ForceSFR = 0x4,
ForceAFROfSFRFallback3AFR = 0x5,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SetPowerThrottleForPCIeCompliance : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,21 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum SetVABData : uint
{
Zero = 0x0,
UIntOne = 0x1,
FloatOne = 0x3F800000,
FloatPosInf = 0x7F800000,
FloatNan = 0x7FC00000,
UseAPIDefaults = 0xFFFFFFFF,
Default = 0xFFFFFFFF
}
#pragma warning restore 1591
}

View File

@@ -1,25 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ShimMCCOMPAT : uint
{
Integrated = 0x0,
Enable = 0x1,
UserEditable = 0x2,
Mask = 0x3,
VideoMask = 0x4,
VaryingBit = 0x8,
AutoSelect = 0x10,
OverrideBit = 0x80000000,
Default = 0x10
}
#pragma warning restore 1591
}

View File

@@ -1,25 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ShimRenderingMode : uint
{
Integrated = 0x0,
Enable = 0x1,
UserEditable = 0x2,
Mask = 0x3,
VideoMask = 0x4,
VaryingBit = 0x8,
AutoSelect = 0x10,
OverrideBit = 0x80000000,
Default = 0x10
}
#pragma warning restore 1591
}

View File

@@ -1,59 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum ShimRenderingOptions : uint
{
DefaultRenderingMode = 0x0,
DisableAsyncPresent = 0x1,
EHShellDetect = 0x2,
FlashplayerHostDetect = 0x4,
VideoDRMApplicationDetect = 0x8,
IgnoreOverrides = 0x10,
Reserved1 = 0x20,
EnableDWMAsyncPresent = 0x40,
Reserved2 = 0x80,
AllowInheritance = 0x100,
DisableWrappers = 0x200,
DisableDxgiWrappers = 0x400,
PruneUnsupportedFormats = 0x800,
EnableAlphaFormat = 0x1000,
IGPUTranscoding = 0x2000,
DisableCUDA = 0x4000,
AllowCpCapabilitiesForVideo = 0x8000,
IGPUTranscodingFwdOptimus = 0x10000,
DisableDuringSecureBoot = 0x20000,
InvertForQuadro = 0x40000,
InvertForMSHybrid = 0x80000,
RegisterProcessEnableGold = 0x100000,
HandleWindowedModePerformanceOptimal = 0x200000,
HandleWin7AsyncRuntimeBug = 0x400000,
ExplicitAdapterOptedByApplication = 0x800000,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRPreRenderLimit : uint
{
Minimum = 0x0,
Maximum = 0xFF,
ApplicationControlled = 0x0,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRRApplicationOverride : uint
{
Allow = 0x0,
ForceOff = 0x1,
DisAllow = 0x2,
ULMB = 0x3,
FixedRefresh = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,19 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRRApplicationOverrideRequestState : uint
{
Allow = 0x0,
ForceOff = 0x1,
DisAllow = 0x2,
ULMB = 0x3,
FixedRefresh = 0x4,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRRFeatureIndicator : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRRMode : uint
{
Disabled = 0x0,
FullScreenOnly = 0x1,
FullScreenAndWindowed = 0x2,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRROverlayIndicator : uint
{
Disabled = 0x0,
Enabled = 0x1,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VRRRequestState : uint
{
Disabled = 0x0,
FullScreenOnly = 0x1,
FullScreenAndWindowed = 0x2,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VSyncBehaviorFlags : uint
{
None = 0x0,
Default = 0x0,
IgnoreFlipIntervalMultiple = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,23 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VSyncMode : uint
{
Passive = 0x60925292,
ForceOff = 0x8416747,
ForceOn = 0x47814940,
FlipInterval2 = 0x32610244,
FlipInterval3 = 0x71271021,
FlipInterval4 = 0x13245256,
Virtual = 0x18888888,
Default = 0x60925292
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VSyncSmoothAFR : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VSyncTearControl : uint
{
Disable = 0x96861077,
Enable = 0x99941284,
Default = 0x96861077
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum VSyncVRRControl : uint
{
Disable = 0x0,
Enable = 0x1,
NotSupported = 0x9F95128E,
Default = 0x1
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSAPIStereoEyesExchange : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,59 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSAPIStereoMode : uint
{
ShutterGlasses = 0x0,
VerticalInterlaced = 0x1,
Twinview = 0x2,
NV17ShutterGlassesAuto = 0x3,
NV17ShutterGlassesDAC0 = 0x4,
NV17ShutterGlassesDAC1 = 0x5,
ColorLine = 0x6,
ColorInterleaved = 0x7,
Anaglyph = 0x8,
HorizontalInterlaced = 0x9,
SideField = 0xA,
SubField = 0xB,
CheckerBoard = 0xC,
InverseCheckerBoard = 0xD,
TridelitySL = 0xE,
TridelityMV = 0xF,
SeeFront = 0x10,
StereoMirror = 0x11,
FrameSequential = 0x12,
AutodetectPassiveMode = 0x13,
AegisDTFrameSequential = 0x14,
OEMEmitterFrameSequential = 0x15,
DPInBand = 0x16,
UseHardwareDefault = 0xFFFFFFFF,
DefaultGL = 0x3,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSMemoryAllocationPolicy : uint
{
AsNeeded = 0x0,
ModeratePreAllocation = 0x1,
AggressivePreAllocation = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,15 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSStereoDongleSupport : uint
{
Off = 0x0,
DAC = 0x1,
DLP = 0x2,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,13 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSStereoSupport : uint
{
Off = 0x0,
On = 0x1,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,17 +0,0 @@
namespace NvAPIWrapper.DRS.SettingValues
{
#pragma warning disable 1591
public enum WKSStereoSwapMode : uint
{
ApplicationControl = 0x0,
PerEye = 0x1,
PerEyePair = 0x2,
LegacyBehavior = 0x3,
Default = 0x0
}
#pragma warning restore 1591
}

View File

@@ -1,373 +0,0 @@
using System;
using System.Linq;
using NvAPIWrapper.Native;
using NvAPIWrapper.Native.Display.Structures;
using NvAPIWrapper.Native.Exceptions;
using NvAPIWrapper.Native.General;
using NvAPIWrapper.Native.Interfaces.Mosaic;
using NvAPIWrapper.Native.Mosaic;
using NvAPIWrapper.Native.Mosaic.Structures;
namespace NvAPIWrapper.Mosaic
{
/// <summary>
/// Represents a mosaic grid topology
/// </summary>
public class GridTopology : IEquatable<GridTopology>
{
/// <summary>
/// Creates a new GridTopology
/// </summary>
/// <param name="rows">Mosaic rows</param>
/// <param name="columns">Mosaic columns</param>
/// <param name="displays">Topology displays</param>
public GridTopology(int rows, int columns, GridTopologyDisplay[] displays)
{
SetDisplays(rows, columns, displays);
var possibleDisplaySettings = GetPossibleDisplaySettings();
if (possibleDisplaySettings.Any())
{
SetDisplaySettings(
possibleDisplaySettings.OrderByDescending(
settings => (long) settings.Width *
settings.Height *
settings.BitsPerPixel *
settings.Frequency)
.First());
}
}
/// <summary>
/// Creates a new GridTopology
/// </summary>
/// <param name="gridTopology">A IGridTopology implamented object</param>
public GridTopology(IGridTopology gridTopology)
{
Rows = gridTopology.Rows;
Columns = gridTopology.Columns;
Displays = gridTopology.Displays.Select(display => new GridTopologyDisplay(display)).ToArray();
SetDisplaySettings(gridTopology.DisplaySettings);
ApplyWithBezelCorrectedResolution = gridTopology.ApplyWithBezelCorrectedResolution;
ImmersiveGaming = gridTopology.ImmersiveGaming;
BaseMosaicPanoramic = gridTopology.BaseMosaicPanoramic;
DriverReloadAllowed = gridTopology.DriverReloadAllowed;
AcceleratePrimaryDisplay = gridTopology.AcceleratePrimaryDisplay;
}
/// <summary>
/// Gets or sets a boolean value enabling SLI acceleration on the primary display while in single-wide mode (For
/// Immersive Gaming only).
/// </summary>
public bool AcceleratePrimaryDisplay { get; set; }
/// <summary>
/// Gets or sets a boolean value forcing to the bezel-corrected resolution when enabling and doing the modeset
/// </summary>
public bool ApplyWithBezelCorrectedResolution { get; set; }
/// <summary>
/// Gets or sets a boolean value enabling the Base Mosaic (Panoramic) instead of Mosaic SLI (for NVS and Quadro-boards
/// only)
/// </summary>
public bool BaseMosaicPanoramic { get; set; }
/// <summary>
/// Gets the mosaic columns
/// </summary>
public int Columns { get; private set; }
/// <summary>
/// Gets topology displays
/// </summary>
public GridTopologyDisplay[] Displays { get; private set; }
/// <summary>
/// Gets or sets a boolean value allowing the API to, if necessary, realod the driver (for Vista and above only). Will
/// not be persisted. Value undefined on get.
/// </summary>
public bool DriverReloadAllowed { get; set; }
/// <summary>
/// Gets the topology Frequency
/// </summary>
public int Frequency { get; private set; }
/// <summary>
/// Gets or sets a boolean value enabling as immersive gaming instead of Mosaic SLI (for Quadro-boards only)
/// </summary>
public bool ImmersiveGaming { get; set; }
/// <summary>
/// Gets the topology resolution
/// </summary>
public Resolution Resolution { get; private set; }
/// <summary>
/// Gets the mosaic rows
/// </summary>
public int Rows { get; private set; }
/// <inheritdoc />
public bool Equals(GridTopology other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return Resolution.Equals(other.Resolution) &&
Frequency == other.Frequency &&
Rows == other.Rows &&
Columns == other.Columns &&
Displays.SequenceEqual(other.Displays) &&
ApplyWithBezelCorrectedResolution == other.ApplyWithBezelCorrectedResolution &&
ImmersiveGaming == other.ImmersiveGaming &&
BaseMosaicPanoramic == other.BaseMosaicPanoramic &&
AcceleratePrimaryDisplay == other.AcceleratePrimaryDisplay;
}
/// <summary>
/// Retrieves a list of currently active mosaic grid topologies
/// </summary>
/// <returns>An array of GridTopology objects</returns>
public static GridTopology[] GetGridTopologies()
{
return MosaicApi.EnumDisplayGrids().Select(topology => new GridTopology(topology)).ToArray();
}
/// <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 ==(GridTopology left, GridTopology right)
{
return right?.Equals(left) ?? ReferenceEquals(left, null);
}
/// <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 !=(GridTopology left, GridTopology right)
{
return !(left == right);
}
/// <summary>
/// Applies the requested grid topologies
/// </summary>
/// <param name="grids">An array of grid topologies to apply</param>
/// <param name="flags">SetDisplayTopologyFlag flag</param>
public static void SetGridTopologies(
GridTopology[] grids,
SetDisplayTopologyFlag flags = SetDisplayTopologyFlag.NoFlag)
{
var gridTopologyV2 = grids.Select(grid => grid.GetGridTopologyV2()).Cast<IGridTopology>().ToArray();
try
{
MosaicApi.SetDisplayGrids(gridTopologyV2, flags);
}
catch (NVIDIAApiException ex)
{
if (ex.Status != Status.IncompatibleStructureVersion)
{
throw;
}
}
catch (NVIDIANotSupportedException)
{
// ignore
}
var gridTopologyV1 = grids.Select(grid => grid.GetGridTopologyV1()).Cast<IGridTopology>().ToArray();
MosaicApi.SetDisplayGrids(gridTopologyV1, flags);
}
/// <summary>
/// Validates a list of grid topologies
/// </summary>
/// <param name="grids">An array of grid topologies to validate</param>
/// <param name="flags">SetDisplayTopologyFlag flag</param>
/// <returns>An array of DisplayTopologyStatus object containing the result of the validation</returns>
public static DisplayTopologyStatus[] ValidateGridTopologies(
GridTopology[] grids,
SetDisplayTopologyFlag flags = SetDisplayTopologyFlag.AllowInvalid)
{
var gridTopologyV2 = grids.Select(grid => grid.GetGridTopologyV2()).Cast<IGridTopology>().ToArray();
try
{
return MosaicApi.ValidateDisplayGrids(gridTopologyV2, flags);
}
catch (NVIDIAApiException ex)
{
if (ex.Status != Status.IncompatibleStructureVersion)
{
throw;
}
}
catch (NVIDIANotSupportedException)
{
// ignore
}
var gridTopologyV1 = grids.Select(grid => grid.GetGridTopologyV1()).Cast<IGridTopology>().ToArray();
return MosaicApi.ValidateDisplayGrids(gridTopologyV1, flags);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((GridTopology) obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = Resolution.GetHashCode();
hashCode = (hashCode * 397) ^ Frequency;
hashCode = (hashCode * 397) ^ Rows;
hashCode = (hashCode * 397) ^ Columns;
hashCode = (hashCode * 397) ^ (Displays?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ ApplyWithBezelCorrectedResolution.GetHashCode();
hashCode = (hashCode * 397) ^ ImmersiveGaming.GetHashCode();
hashCode = (hashCode * 397) ^ BaseMosaicPanoramic.GetHashCode();
hashCode = (hashCode * 397) ^ AcceleratePrimaryDisplay.GetHashCode();
return hashCode;
}
}
/// <summary>
/// Creates and fills a DisplaySettingsV1 object
/// </summary>
/// <returns>The newly created DisplaySettingsV1 object</returns>
public DisplaySettingsV1 GetDisplaySettingsV1()
{
return new DisplaySettingsV1(Resolution.Width, Resolution.Height, Resolution.ColorDepth, Frequency);
}
/// <summary>
/// Creates and fills a GridTopologyV1 object
/// </summary>
/// <returns>The newly created GridTopologyV1 object</returns>
public GridTopologyV1 GetGridTopologyV1()
{
var displaySettings = GetDisplaySettingsV1();
return new GridTopologyV1(Rows, Columns,
Displays.Select(display => display.GetGridTopologyDisplayV1()).ToArray(), displaySettings,
ApplyWithBezelCorrectedResolution, ImmersiveGaming, BaseMosaicPanoramic, DriverReloadAllowed,
AcceleratePrimaryDisplay);
}
/// <summary>
/// Creates and fills a GridTopologyV2 object
/// </summary>
/// <returns>The newly created GridTopologyV2 object</returns>
public GridTopologyV2 GetGridTopologyV2()
{
var displaySettings = GetDisplaySettingsV1();
return new GridTopologyV2(Rows, Columns,
Displays.Select(display => display.GetGridTopologyDisplayV2()).ToArray(), displaySettings,
ApplyWithBezelCorrectedResolution, ImmersiveGaming, BaseMosaicPanoramic, DriverReloadAllowed,
AcceleratePrimaryDisplay,
Displays.Any(display => display.PixelShiftType != PixelShiftType.NoPixelShift));
}
/// <summary>
/// Retrieves a list of possible display settings for this topology
/// </summary>
/// <returns>An array of IDisplaySettings implamented objects</returns>
public IDisplaySettings[] GetPossibleDisplaySettings()
{
var gridTopologyV2 = GetGridTopologyV2();
try
{
return MosaicApi.EnumDisplayModes(gridTopologyV2);
}
catch (NVIDIAApiException ex)
{
if (ex.Status != Status.IncompatibleStructureVersion)
{
throw;
}
}
catch (NVIDIANotSupportedException)
{
// ignore
}
var gridTopologyV1 = GetGridTopologyV1();
return MosaicApi.EnumDisplayModes(gridTopologyV1);
}
/// <summary>
/// Changes topology arrangement and displays
/// </summary>
/// <param name="rows">Mosaic rows</param>
/// <param name="columns">Mosaic columns</param>
/// <param name="displays">Topology displays</param>
/// <exception cref="ArgumentOutOfRangeException">Invalid display arrangement.</exception>
/// <exception cref="ArgumentException">Number of displays should match the arrangement.</exception>
public void SetDisplays(int rows, int columns, GridTopologyDisplay[] displays)
{
if (rows * columns <= 0)
{
throw new ArgumentOutOfRangeException($"{nameof(rows)}, {nameof(columns)}",
"Invalid display arrangement.");
}
if (displays.Length != rows * columns)
{
throw new ArgumentException("Number of displays should match the arrangement.", nameof(displays));
}
Rows = rows;
Columns = columns;
Displays = displays;
}
/// <summary>
/// Changes display settings for the topology
/// </summary>
/// <param name="displaySettings">Display settings to use</param>
public void SetDisplaySettings(IDisplaySettings displaySettings)
{
Resolution = new Resolution(displaySettings.Width, displaySettings.Height, displaySettings.BitsPerPixel);
Frequency = displaySettings.Frequency;
}
}
}

View File

@@ -1,192 +0,0 @@
using System;
using NvAPIWrapper.Display;
using NvAPIWrapper.Native.Display;
using NvAPIWrapper.Native.Interfaces.Mosaic;
using NvAPIWrapper.Native.Mosaic;
using NvAPIWrapper.Native.Mosaic.Structures;
namespace NvAPIWrapper.Mosaic
{
/// <summary>
/// Represents a display in a mosaic grid topology
/// </summary>
public class GridTopologyDisplay : IEquatable<GridTopologyDisplay>
{
/// <summary>
/// Creates a mew GridTopologyDisplay
/// </summary>
/// <param name="displayId">Corresponding display identification</param>
/// <param name="overlap">The overlap values</param>
/// <param name="rotation">The display rotation</param>
/// <param name="cloneGroup">The display clone group</param>
/// <param name="pixelShiftType">The display pixel shift type</param>
public GridTopologyDisplay(
uint displayId,
Overlap overlap = default(Overlap),
Rotate rotation = Rotate.Degree0,
uint cloneGroup = 0,
PixelShiftType pixelShiftType = PixelShiftType.NoPixelShift)
: this(new DisplayDevice(displayId), overlap, rotation, cloneGroup, pixelShiftType)
{
}
/// <summary>
/// Creates a mew GridTopologyDisplay
/// </summary>
/// <param name="display">Corresponding display device</param>
/// <param name="overlap">The overlap values</param>
/// <param name="rotation">The display rotation</param>
/// <param name="cloneGroup">The display clone group</param>
/// <param name="pixelShiftType">The display pixel shift type</param>
public GridTopologyDisplay(
DisplayDevice display,
Overlap overlap = default(Overlap),
Rotate rotation = Rotate.Degree0,
uint cloneGroup = 0,
PixelShiftType pixelShiftType = PixelShiftType.NoPixelShift)
{
DisplayDevice = display;
Overlap = overlap;
Rotation = rotation;
CloneGroup = cloneGroup;
PixelShiftType = pixelShiftType;
}
/// <summary>
/// Creates a mew GridTopologyDisplay
/// </summary>
/// <param name="gridTopologyDisplay">IGridTopologyDisplay implamented object</param>
public GridTopologyDisplay(IGridTopologyDisplay gridTopologyDisplay)
: this(
new DisplayDevice(gridTopologyDisplay.DisplayId),
new Overlap(gridTopologyDisplay.OverlapX, gridTopologyDisplay.OverlapY),
gridTopologyDisplay.Rotation, gridTopologyDisplay.CloneGroup, gridTopologyDisplay.PixelShiftType)
{
}
/// <summary>
/// Gets the clone group identification; Reserved, must be 0
/// </summary>
public uint CloneGroup { get; set; }
/// <summary>
/// Gets the corresponding DisplayDevice
/// </summary>
public DisplayDevice DisplayDevice { get; }
/// <summary>
/// Gets the overlap values
/// </summary>
public Overlap Overlap { get; set; }
/// <summary>
/// Gets the type of display pixel shift
/// </summary>
public PixelShiftType PixelShiftType { get; set; }
/// <summary>
/// Gets the rotation of the display
/// </summary>
public Rotate Rotation { get; set; }
/// <inheritdoc />
public bool Equals(GridTopologyDisplay other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return DisplayDevice.Equals(other.DisplayDevice) &&
Overlap.Equals(other.Overlap) &&
Rotation == other.Rotation &&
CloneGroup == other.CloneGroup &&
PixelShiftType == other.PixelShiftType;
}
/// <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 ==(GridTopologyDisplay left, GridTopologyDisplay right)
{
return right?.Equals(left) ?? ReferenceEquals(left, null);
}
/// <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 !=(GridTopologyDisplay left, GridTopologyDisplay right)
{
return !(left == right);
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((GridTopologyDisplay) obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
var hashCode = DisplayDevice?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ Overlap.GetHashCode();
hashCode = (hashCode * 397) ^ (int) Rotation;
hashCode = (hashCode * 397) ^ (int) CloneGroup;
hashCode = (hashCode * 397) ^ (int) PixelShiftType;
return hashCode;
}
}
/// <summary>
/// Creates and fills a GridTopologyDisplayV1 object
/// </summary>
/// <returns>The newly created GridTopologyDisplayV1 object</returns>
public GridTopologyDisplayV1 GetGridTopologyDisplayV1()
{
return new GridTopologyDisplayV1(DisplayDevice.DisplayId, Overlap.HorizontalOverlap,
Overlap.VerticalOverlap,
Rotation, CloneGroup);
}
/// <summary>
/// Creates and fills a GridTopologyDisplayV2 object
/// </summary>
/// <returns>The newly created GridTopologyDisplayV2 object</returns>
public GridTopologyDisplayV2 GetGridTopologyDisplayV2()
{
return new GridTopologyDisplayV2(DisplayDevice.DisplayId, Overlap.HorizontalOverlap,
Overlap.VerticalOverlap,
Rotation, CloneGroup, PixelShiftType);
}
}
}

View File

@@ -1,85 +0,0 @@
using System;
namespace NvAPIWrapper.Mosaic
{
/// <summary>
/// Holds mosaic overlap values
/// </summary>
public struct Overlap : IEquatable<Overlap>
{
/// <summary>
/// Creates a new Overlap
/// </summary>
/// <param name="overlapX">Horizontal overlap</param>
/// <param name="overlapY">Vertical overlap</param>
public Overlap(int overlapX, int overlapY)
{
HorizontalOverlap = overlapX;
VerticalOverlap = overlapY;
}
/// <summary>
/// Gets or sets horizontal overlap (OverlapX)
/// </summary>
public int HorizontalOverlap { get; }
/// <summary>
/// Gets or sets vertical overlap (OverlapY)
/// </summary>
public int VerticalOverlap { get; }
/// <inheritdoc />
public bool Equals(Overlap other)
{
return HorizontalOverlap == other.HorizontalOverlap && VerticalOverlap == other.VerticalOverlap;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is Overlap && Equals((Overlap) obj);
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (HorizontalOverlap * 397) ^ VerticalOverlap;
}
}
/// <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 ==(Overlap left, Overlap 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 !=(Overlap left, Overlap right)
{
return !left.Equals(right);
}
/// <inheritdoc />
public override string ToString()
{
return $"({HorizontalOverlap}, {VerticalOverlap})";
}
}
}

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