Hardware/Nvidia/NVAPI.cs
author moel.mich
Sun, 08 Aug 2010 13:57:26 +0000
changeset 165 813d8bc3192f
parent 140 04a5155c9c1a
child 167 b7cc9d09aefe
permissions -rw-r--r--
Refactored the hardware monitoring code into a library (Issue 101).
moel@1
     1
/*
moel@1
     2
  
moel@1
     3
  Version: MPL 1.1/GPL 2.0/LGPL 2.1
moel@1
     4
moel@1
     5
  The contents of this file are subject to the Mozilla Public License Version
moel@1
     6
  1.1 (the "License"); you may not use this file except in compliance with
moel@1
     7
  the License. You may obtain a copy of the License at
moel@1
     8
 
moel@1
     9
  http://www.mozilla.org/MPL/
moel@1
    10
moel@1
    11
  Software distributed under the License is distributed on an "AS IS" basis,
moel@1
    12
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
moel@1
    13
  for the specific language governing rights and limitations under the License.
moel@1
    14
moel@1
    15
  The Original Code is the Open Hardware Monitor code.
moel@1
    16
moel@1
    17
  The Initial Developer of the Original Code is 
moel@1
    18
  Michael Möller <m.moeller@gmx.ch>.
moel@1
    19
  Portions created by the Initial Developer are Copyright (C) 2009-2010
moel@1
    20
  the Initial Developer. All Rights Reserved.
moel@1
    21
moel@1
    22
  Contributor(s):
moel@1
    23
moel@1
    24
  Alternatively, the contents of this file may be used under the terms of
moel@1
    25
  either the GNU General Public License Version 2 or later (the "GPL"), or
moel@1
    26
  the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
moel@1
    27
  in which case the provisions of the GPL or the LGPL are applicable instead
moel@1
    28
  of those above. If you wish to allow use of your version of this file only
moel@1
    29
  under the terms of either the GPL or the LGPL, and not to allow others to
moel@1
    30
  use your version of this file under the terms of the MPL, indicate your
moel@1
    31
  decision by deleting the provisions above and replace them with the notice
moel@1
    32
  and other provisions required by the GPL or the LGPL. If you do not delete
moel@1
    33
  the provisions above, a recipient may use your version of this file under
moel@1
    34
  the terms of any one of the MPL, the GPL or the LGPL.
moel@1
    35
 
moel@1
    36
*/
moel@1
    37
moel@1
    38
using System;
moel@1
    39
using System.Collections.Generic;
moel@1
    40
using System.Runtime.InteropServices;
moel@1
    41
using System.Text;
moel@1
    42
moel@1
    43
namespace OpenHardwareMonitor.Hardware.Nvidia {
moel@1
    44
moel@165
    45
  internal enum NvStatus {
moel@1
    46
    OK = 0,
moel@1
    47
    ERROR = -1,
moel@1
    48
    LIBRARY_NOT_FOUND = -2,
moel@1
    49
    NO_IMPLEMENTATION = -3,
moel@1
    50
    API_NOT_INTIALIZED = -4,
moel@1
    51
    INVALID_ARGUMENT = -5,
moel@1
    52
    NVIDIA_DEVICE_NOT_FOUND = -6,
moel@1
    53
    END_ENUMERATION = -7,
moel@1
    54
    INVALID_HANDLE = -8,
moel@1
    55
    INCOMPATIBLE_STRUCT_VERSION = -9,
moel@1
    56
    HANDLE_INVALIDATED = -10,
moel@1
    57
    OPENGL_CONTEXT_NOT_CURRENT = -11,
moel@1
    58
    NO_GL_EXPERT = -12,
moel@1
    59
    INSTRUMENTATION_DISABLED = -13,
moel@1
    60
    EXPECTED_LOGICAL_GPU_HANDLE = -100,
moel@1
    61
    EXPECTED_PHYSICAL_GPU_HANDLE = -101,
moel@1
    62
    EXPECTED_DISPLAY_HANDLE = -102,
moel@1
    63
    INVALID_COMBINATION = -103,
moel@1
    64
    NOT_SUPPORTED = -104,
moel@1
    65
    PORTID_NOT_FOUND = -105,
moel@1
    66
    EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106,
moel@1
    67
    INVALID_PERF_LEVEL = -107,
moel@1
    68
    DEVICE_BUSY = -108,
moel@1
    69
    NV_PERSIST_FILE_NOT_FOUND = -109,
moel@1
    70
    PERSIST_DATA_NOT_FOUND = -110,
moel@1
    71
    EXPECTED_TV_DISPLAY = -111,
moel@1
    72
    EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112,
moel@1
    73
    NO_ACTIVE_SLI_TOPOLOGY = -113,
moel@1
    74
    SLI_RENDERING_MODE_NOTALLOWED = -114,
moel@1
    75
    EXPECTED_DIGITAL_FLAT_PANEL = -115,
moel@1
    76
    ARGUMENT_EXCEED_MAX_SIZE = -116,
moel@1
    77
    DEVICE_SWITCHING_NOT_ALLOWED = -117,
moel@1
    78
    TESTING_CLOCKS_NOT_SUPPORTED = -118,
moel@1
    79
    UNKNOWN_UNDERSCAN_CONFIG = -119,
moel@1
    80
    TIMEOUT_RECONFIGURING_GPU_TOPO = -120,
moel@1
    81
    DATA_NOT_FOUND = -121,
moel@1
    82
    EXPECTED_ANALOG_DISPLAY = -122,
moel@1
    83
    NO_VIDLINK = -123,
moel@1
    84
    REQUIRES_REBOOT = -124,
moel@1
    85
    INVALID_HYBRID_MODE = -125,
moel@1
    86
    MIXED_TARGET_TYPES = -126,
moel@1
    87
    SYSWOW64_NOT_SUPPORTED = -127,
moel@1
    88
    IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128,
moel@1
    89
    REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129,
moel@1
    90
    OUT_OF_MEMORY = -130,
moel@1
    91
    WAS_STILL_DRAWING = -131,
moel@1
    92
    FILE_NOT_FOUND = -132,
moel@1
    93
    TOO_MANY_UNIQUE_STATE_OBJECTS = -133,
moel@1
    94
    INVALID_CALL = -134,
moel@1
    95
    D3D10_1_LIBRARY_NOT_FOUND = -135,
moel@1
    96
    FUNCTION_NOT_FOUND = -136
moel@165
    97
  }
moel@1
    98
moel@165
    99
  internal enum NvThermalController {
moel@1
   100
    NONE = 0,
moel@1
   101
    GPU_INTERNAL,  
moel@1
   102
    ADM1032,
moel@1
   103
    MAX6649,       
moel@1
   104
    MAX1617,      
moel@1
   105
    LM99,      
moel@1
   106
    LM89,         
moel@1
   107
    LM64,         
moel@1
   108
    ADT7473,
moel@1
   109
    SBMAX6649,
moel@1
   110
    VBIOSEVT,  
moel@1
   111
    OS,    
moel@1
   112
    UNKNOWN = -1,
moel@165
   113
  }
moel@1
   114
moel@165
   115
  internal enum NvThermalTarget {
moel@1
   116
    NONE = 0,
moel@1
   117
    GPU = 1,
moel@1
   118
    MEMORY = 2,
moel@1
   119
    POWER_SUPPLY = 4,
moel@1
   120
    BOARD = 8,
moel@1
   121
    ALL = 15,
moel@1
   122
    UNKNOWN = -1
moel@1
   123
  };
moel@1
   124
moel@61
   125
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   126
  internal struct NvSensor {
moel@1
   127
    public NvThermalController Controller;
moel@140
   128
    public uint DefaultMinTemp;
moel@140
   129
    public uint DefaultMaxTemp;
moel@140
   130
    public uint CurrentTemp;
moel@1
   131
    public NvThermalTarget Target;     
moel@1
   132
  }
moel@1
   133
moel@61
   134
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   135
  internal struct NvGPUThermalSettings {
moel@140
   136
    public uint Version;
moel@140
   137
    public uint Count;
moel@1
   138
    [MarshalAs(UnmanagedType.ByValArray, 
moel@1
   139
      SizeConst = NVAPI.MAX_THERMAL_SENSORS_PER_GPU)]
moel@1
   140
    public NvSensor[] Sensor;
moel@1
   141
  }
moel@1
   142
moel@61
   143
  [StructLayout(LayoutKind.Sequential)]
moel@165
   144
  internal struct NvDisplayHandle {
moel@61
   145
    private IntPtr ptr;
moel@1
   146
  }
moel@1
   147
moel@61
   148
  [StructLayout(LayoutKind.Sequential)]
moel@165
   149
  internal struct NvPhysicalGpuHandle {
moel@61
   150
    private IntPtr ptr;
moel@1
   151
  }
moel@1
   152
moel@140
   153
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   154
  internal struct NvClocks {
moel@140
   155
    public uint Version;
moel@140
   156
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_CLOCKS_PER_GPU)]
moel@140
   157
    public uint[] Clock;
moel@140
   158
  }
moel@140
   159
moel@140
   160
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   161
  internal struct NvPState {
moel@140
   162
    public bool Present;
moel@140
   163
    public int Percentage;
moel@140
   164
  }
moel@140
   165
moel@140
   166
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   167
  internal struct NvPStates {
moel@140
   168
    public uint Version;
moel@140
   169
    public uint Flags;
moel@140
   170
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_PSTATES_PER_GPU)]
moel@140
   171
    public NvPState[] PStates;
moel@140
   172
  }
moel@140
   173
moel@140
   174
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   175
  internal struct NvUsages {
moel@140
   176
    public uint Version;
moel@140
   177
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_USAGES_PER_GPU)]
moel@140
   178
    public uint[] Usage;
moel@140
   179
  }
moel@140
   180
moel@140
   181
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   182
  internal struct NvCooler {
moel@140
   183
    public int Type;
moel@140
   184
    public int Controller;
moel@140
   185
    public int DefaultMin;
moel@140
   186
    public int DefaultMax;
moel@140
   187
    public int CurrentMin;
moel@140
   188
    public int CurrentMax;
moel@140
   189
    public int CurrentLevel;
moel@140
   190
    public int DefaultPolicy;
moel@140
   191
    public int CurrentPolicy;
moel@140
   192
    public int Target;
moel@140
   193
    public int ControlType;
moel@140
   194
    public int Active;
moel@140
   195
  }
moel@140
   196
moel@140
   197
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   198
  internal struct NvGPUCoolerSettings {
moel@140
   199
    public uint Version;
moel@140
   200
    public uint Count;
moel@140
   201
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.MAX_COOLER_PER_GPU)]
moel@140
   202
    public NvCooler[] Cooler;
moel@140
   203
  }
moel@140
   204
moel@140
   205
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   206
  internal struct NvMemoryInfo {
moel@140
   207
    public uint Version;
moel@140
   208
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 
moel@140
   209
      NVAPI.MAX_MEMORY_VALUES_PER_GPU)]
moel@140
   210
    public uint[] Values;
moel@140
   211
  }
moel@140
   212
moel@140
   213
  [StructLayout(LayoutKind.Sequential, Pack = 8)]
moel@165
   214
  internal struct NvDisplayDriverVersion {
moel@140
   215
    public uint Version;
moel@140
   216
    public uint DriverVersion;
moel@140
   217
    public uint BldChangeListNum;
moel@140
   218
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   219
    public string BuildBranch;
moel@140
   220
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = NVAPI.SHORT_STRING_MAX)]
moel@140
   221
    public string Adapter;
moel@165
   222
  }
moel@140
   223
moel@165
   224
  internal class NVAPI {
moel@1
   225
moel@1
   226
    public const int MAX_PHYSICAL_GPUS = 64;
moel@140
   227
    public const int SHORT_STRING_MAX = 64;
moel@140
   228
moel@140
   229
    public const int MAX_THERMAL_SENSORS_PER_GPU = 3;    
moel@140
   230
    public const int MAX_CLOCKS_PER_GPU = 0x120;
moel@140
   231
    public const int MAX_PSTATES_PER_GPU = 8;
moel@140
   232
    public const int MAX_USAGES_PER_GPU = 33;
moel@140
   233
    public const int MAX_COOLER_PER_GPU = 20;
moel@140
   234
    public const int MAX_MEMORY_VALUES_PER_GPU = 5;
moel@140
   235
moel@140
   236
    public static readonly uint GPU_THERMAL_SETTINGS_VER = (uint)
moel@1
   237
      Marshal.SizeOf(typeof(NvGPUThermalSettings)) | 0x10000;
moel@140
   238
    public static readonly uint GPU_CLOCKS_VER = (uint)
moel@140
   239
      Marshal.SizeOf(typeof(NvClocks)) | 0x20000;
moel@140
   240
    public static readonly uint GPU_PSTATES_VER = (uint)
moel@140
   241
      Marshal.SizeOf(typeof(NvPStates)) | 0x10000;
moel@140
   242
    public static readonly uint GPU_USAGES_VER = (uint)
moel@140
   243
      Marshal.SizeOf(typeof(NvUsages)) | 0x10000;
moel@140
   244
    public static readonly uint GPU_COOLER_SETTINGS_VER = (uint)
moel@140
   245
      Marshal.SizeOf(typeof(NvGPUCoolerSettings)) | 0x20000;
moel@140
   246
    public static readonly uint GPU_MEMORY_INFO_VER = (uint) 
moel@140
   247
      Marshal.SizeOf(typeof(NvMemoryInfo)) | 0x20000;
moel@140
   248
    public static readonly uint DISPLAY_DRIVER_VERSION_VER = (uint)
moel@140
   249
      Marshal.SizeOf(typeof(NvDisplayDriverVersion)) | 0x10000;
moel@140
   250
      
moel@1
   251
    private delegate IntPtr nvapi_QueryInterfaceDelegate(uint id);
moel@1
   252
    private delegate NvStatus NvAPI_InitializeDelegate();
moel@1
   253
    private delegate NvStatus NvAPI_GPU_GetFullNameDelegate(
moel@1
   254
      NvPhysicalGpuHandle gpuHandle, StringBuilder name);
moel@1
   255
moel@1
   256
    public delegate NvStatus NvAPI_GPU_GetThermalSettingsDelegate(
moel@1
   257
      NvPhysicalGpuHandle gpuHandle, int sensorIndex, 
moel@1
   258
      ref NvGPUThermalSettings nvGPUThermalSettings);
moel@1
   259
    public delegate NvStatus NvAPI_EnumNvidiaDisplayHandleDelegate(int thisEnum,
moel@1
   260
      ref NvDisplayHandle displayHandle);
moel@1
   261
    public delegate NvStatus NvAPI_GetPhysicalGPUsFromDisplayDelegate(
moel@1
   262
      NvDisplayHandle displayHandle, [Out] NvPhysicalGpuHandle[] gpuHandles, 
moel@140
   263
      out uint gpuCount);
moel@1
   264
    public delegate NvStatus NvAPI_EnumPhysicalGPUsDelegate(
moel@1
   265
      [Out] NvPhysicalGpuHandle[] gpuHandles, out int gpuCount);
moel@38
   266
    public delegate NvStatus NvAPI_GPU_GetTachReadingDelegate(
moel@38
   267
      NvPhysicalGpuHandle gpuHandle, out int value);
moel@140
   268
    public delegate NvStatus NvAPI_GPU_GetAllClocksDelegate(
moel@140
   269
      NvPhysicalGpuHandle gpuHandle, ref NvClocks nvClocks);
moel@140
   270
    public delegate NvStatus NvAPI_GPU_GetPStatesDelegate(
moel@140
   271
      NvPhysicalGpuHandle gpuHandle, ref NvPStates nvPStates);
moel@140
   272
    public delegate NvStatus NvAPI_GPU_GetUsagesDelegate(
moel@140
   273
      NvPhysicalGpuHandle gpuHandle, ref NvUsages nvUsages);
moel@140
   274
    public delegate NvStatus NvAPI_GPU_GetCoolerSettingsDelegate(
moel@140
   275
      NvPhysicalGpuHandle gpuHandle, int coolerIndex,
moel@140
   276
      ref NvGPUCoolerSettings nvGPUCoolerSettings);
moel@140
   277
    public delegate NvStatus NvAPI_GPU_GetMemoryInfoDelegate(
moel@140
   278
      NvDisplayHandle displayHandle, ref NvMemoryInfo nvMemoryInfo);
moel@140
   279
    public delegate NvStatus NvAPI_GetDisplayDriverVersionDelegate(
moel@140
   280
      NvDisplayHandle displayHandle, [In, Out] ref NvDisplayDriverVersion
moel@140
   281
      nvDisplayDriverVersion);
moel@140
   282
    public delegate NvStatus NvAPI_GetInterfaceVersionStringDelegate(
moel@140
   283
      StringBuilder version);
moel@1
   284
moel@1
   285
    private static bool available = false;
moel@1
   286
    private static nvapi_QueryInterfaceDelegate nvapi_QueryInterface;
moel@1
   287
    private static NvAPI_InitializeDelegate NvAPI_Initialize;
moel@1
   288
    private static NvAPI_GPU_GetFullNameDelegate _NvAPI_GPU_GetFullName;
moel@140
   289
    private static NvAPI_GetInterfaceVersionStringDelegate
moel@140
   290
      _NvAPI_GetInterfaceVersionString;
moel@1
   291
moel@140
   292
    public static readonly NvAPI_GPU_GetThermalSettingsDelegate 
moel@1
   293
      NvAPI_GPU_GetThermalSettings;
moel@140
   294
    public static readonly NvAPI_EnumNvidiaDisplayHandleDelegate
moel@1
   295
      NvAPI_EnumNvidiaDisplayHandle;
moel@140
   296
    public static readonly NvAPI_GetPhysicalGPUsFromDisplayDelegate
moel@1
   297
      NvAPI_GetPhysicalGPUsFromDisplay;
moel@140
   298
    public static readonly NvAPI_EnumPhysicalGPUsDelegate
moel@1
   299
      NvAPI_EnumPhysicalGPUs;
moel@140
   300
    public static readonly NvAPI_GPU_GetTachReadingDelegate
moel@38
   301
      NvAPI_GPU_GetTachReading;
moel@140
   302
    public static readonly NvAPI_GPU_GetAllClocksDelegate
moel@140
   303
      NvAPI_GPU_GetAllClocks;
moel@140
   304
    public static readonly NvAPI_GPU_GetPStatesDelegate
moel@140
   305
      NvAPI_GPU_GetPStates;
moel@140
   306
    public static readonly NvAPI_GPU_GetUsagesDelegate
moel@140
   307
      NvAPI_GPU_GetUsages;
moel@140
   308
    public static readonly NvAPI_GPU_GetCoolerSettingsDelegate
moel@140
   309
      NvAPI_GPU_GetCoolerSettings;
moel@140
   310
    public static readonly NvAPI_GPU_GetMemoryInfoDelegate
moel@140
   311
      NvAPI_GPU_GetMemoryInfo;
moel@140
   312
    public static readonly NvAPI_GetDisplayDriverVersionDelegate
moel@140
   313
      NvAPI_GetDisplayDriverVersion;    
moel@1
   314
moel@1
   315
    public static NvStatus NvAPI_GPU_GetFullName(NvPhysicalGpuHandle gpuHandle,
moel@1
   316
      out string name) {
moel@1
   317
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@101
   318
      NvStatus status;
moel@101
   319
      if (_NvAPI_GPU_GetFullName != null)
moel@101
   320
        status = _NvAPI_GPU_GetFullName(gpuHandle, builder);
moel@101
   321
      else
moel@101
   322
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@1
   323
      name = builder.ToString();
moel@1
   324
      return status;
moel@1
   325
    }
moel@1
   326
moel@140
   327
    public static NvStatus NvAPI_GetInterfaceVersionString(out string version) {
moel@140
   328
      StringBuilder builder = new StringBuilder(SHORT_STRING_MAX);
moel@140
   329
      NvStatus status;
moel@140
   330
      if (_NvAPI_GetInterfaceVersionString != null)
moel@140
   331
        status = _NvAPI_GetInterfaceVersionString(builder);
moel@140
   332
      else
moel@140
   333
        status = NvStatus.FUNCTION_NOT_FOUND;
moel@140
   334
      version = builder.ToString();
moel@140
   335
      return status;
moel@140
   336
    }
moel@140
   337
moel@1
   338
    private static string GetDllName() {
moel@1
   339
      if (IntPtr.Size == 4) {
moel@1
   340
        return "nvapi.dll";
moel@1
   341
      } else {
moel@1
   342
        return "nvapi64.dll";
moel@1
   343
      }
moel@1
   344
    }
moel@1
   345
moel@1
   346
    private static void GetDelegate<T>(uint id, out T newDelegate) 
moel@1
   347
      where T : class 
moel@1
   348
    {
moel@1
   349
      IntPtr ptr = nvapi_QueryInterface(id);
moel@38
   350
      if (ptr != IntPtr.Zero) {
moel@38
   351
        newDelegate =
moel@38
   352
          Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
moel@38
   353
      } else {
moel@38
   354
        newDelegate = null;
moel@38
   355
      }
moel@1
   356
    }
moel@1
   357
moel@1
   358
    static NVAPI() { 
moel@1
   359
      DllImportAttribute attribute = new DllImportAttribute(GetDllName());
moel@1
   360
      attribute.CallingConvention = CallingConvention.Cdecl;
moel@1
   361
      attribute.PreserveSig = true;
moel@1
   362
      attribute.EntryPoint = "nvapi_QueryInterface";
moel@1
   363
      PInvokeDelegateFactory.CreateDelegate(attribute,
moel@1
   364
        out nvapi_QueryInterface);
moel@1
   365
moel@1
   366
      try {
moel@1
   367
        GetDelegate(0x0150E828, out NvAPI_Initialize);
moel@1
   368
      } catch (DllNotFoundException) { return; } 
moel@121
   369
        catch (EntryPointNotFoundException) { return; } 
moel@1
   370
        catch (ArgumentNullException) { return; }
moel@1
   371
moel@1
   372
      if (NvAPI_Initialize() == NvStatus.OK) {
moel@1
   373
        GetDelegate(0xE3640A56, out NvAPI_GPU_GetThermalSettings);
moel@1
   374
        GetDelegate(0xCEEE8E9F, out _NvAPI_GPU_GetFullName);
moel@1
   375
        GetDelegate(0x9ABDD40D, out NvAPI_EnumNvidiaDisplayHandle);
moel@1
   376
        GetDelegate(0x34EF9506, out NvAPI_GetPhysicalGPUsFromDisplay);
moel@1
   377
        GetDelegate(0xE5AC921F, out NvAPI_EnumPhysicalGPUs);
moel@140
   378
        GetDelegate(0x5F608315, out NvAPI_GPU_GetTachReading);
moel@140
   379
        GetDelegate(0x1BD69F49, out NvAPI_GPU_GetAllClocks);
moel@140
   380
        GetDelegate(0x60DED2ED, out NvAPI_GPU_GetPStates);
moel@140
   381
        GetDelegate(0x189A1FDF, out NvAPI_GPU_GetUsages);
moel@140
   382
        GetDelegate(0xDA141340, out NvAPI_GPU_GetCoolerSettings);
moel@140
   383
        GetDelegate(0x774AA982, out NvAPI_GPU_GetMemoryInfo);
moel@140
   384
        GetDelegate(0xF951A4D1, out NvAPI_GetDisplayDriverVersion);
moel@140
   385
        GetDelegate(0x01053FA5, out _NvAPI_GetInterfaceVersionString);
moel@140
   386
moel@1
   387
        available = true;
moel@1
   388
      }
moel@1
   389
    }
moel@1
   390
moel@1
   391
    public static bool IsAvailable {
moel@1
   392
      get { return available; }
moel@1
   393
    }
moel@1
   394
moel@1
   395
  }
moel@1
   396
}