blob: cc7e0995a84c67fa5fac33e69e547661d314b8db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#pragma once
#include "../nvapi_private.h"
namespace dxvk {
class Nvml {
public:
Nvml();
virtual ~Nvml();
[[nodiscard]] virtual bool IsAvailable() const;
[[nodiscard]] virtual const char* ErrorString(nvmlReturn_t result) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetHandleByPciBusId_v2(const char* pciBusId, nvmlDevice_t* device) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t* pci) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int* temp) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t* utilization) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetVbiosVersion(nvmlDevice_t device, char* version, unsigned int length) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t* pState) const;
[[nodiscard]] virtual nvmlReturn_t DeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int* clock) const;
private:
typedef decltype(&nvmlInit_v2) PFN_nvmlInit_v2;
typedef decltype(&nvmlShutdown) PFN_nvmlShutdown;
typedef decltype(&nvmlErrorString) PFN_nvmlErrorString;
typedef decltype(&nvmlDeviceGetHandleByPciBusId_v2) PFN_nvmlDeviceGetHandleByPciBusId_v2;
typedef decltype(&nvmlDeviceGetPciInfo_v3) PFN_nvmlDeviceGetPciInfo_v3;
typedef decltype(&nvmlDeviceGetTemperature) PFN_nvmlDeviceGetTemperature;
typedef decltype(&nvmlDeviceGetUtilizationRates) PFN_nvmlDeviceGetUtilizationRates;
typedef decltype(&nvmlDeviceGetVbiosVersion) PFN_nvmlDeviceGetVbiosVersion;
typedef decltype(&nvmlDeviceGetPerformanceState) PFN_nvmlDeviceGetPerformanceState;
typedef decltype(&nvmlDeviceGetClockInfo) PFN_nvmlDeviceGetClockInfo;
HMODULE m_nvmlModule{};
PFN_nvmlInit_v2 m_nvmlInit_v2{};
PFN_nvmlShutdown m_nvmlShutdown{};
PFN_nvmlErrorString m_nvmlErrorString{};
PFN_nvmlDeviceGetHandleByPciBusId_v2 m_nvmlDeviceGetHandleByPciBusId_v2{};
PFN_nvmlDeviceGetPciInfo_v3 m_nvmlDeviceGetPciInfo_v3{};
PFN_nvmlDeviceGetTemperature m_nvmlDeviceGetTemperature{};
PFN_nvmlDeviceGetUtilizationRates m_nvmlDeviceGetUtilizationRates{};
PFN_nvmlDeviceGetVbiosVersion m_nvmlDeviceGetVbiosVersion{};
PFN_nvmlDeviceGetPerformanceState m_nvmlDeviceGetPerformanceState{};
PFN_nvmlDeviceGetClockInfo m_nvmlDeviceGetClockInfo{};
template <typename T>
T GetProcAddress(const char* name);
};
}
|