Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Bogacki <krzysztof.bogacki@leancode.pl>2022-06-06 03:42:37 +0300
committerJens Peters <jp7677@gmail.com>2022-06-25 01:53:54 +0300
commit7e73fbaa1824aebad8ecc3ade4d05f854e34c86f (patch)
tree3ba1c770a86b1fc95254bd556127dc67742c45d1
parentccb4f6c615bcd6407c3746c0837616aaad5fc521 (diff)
nvml: Apply some macro magic to reduce boilerplate
-rw-r--r--src/sysinfo/nvml.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/sysinfo/nvml.cpp b/src/sysinfo/nvml.cpp
index 066c1c3..e1ef64a 100644
--- a/src/sysinfo/nvml.cpp
+++ b/src/sysinfo/nvml.cpp
@@ -14,16 +14,20 @@ namespace dxvk {
return;
}
- m_nvmlInit_v2 = GetProcAddress<PFN_nvmlInit_v2>("nvmlInit_v2");
- m_nvmlShutdown = GetProcAddress<PFN_nvmlShutdown>("nvmlShutdown");
- m_nvmlErrorString = GetProcAddress<PFN_nvmlErrorString>("nvmlErrorString");
- m_nvmlDeviceGetHandleByPciBusId_v2 = GetProcAddress<PFN_nvmlDeviceGetHandleByPciBusId_v2>("nvmlDeviceGetHandleByPciBusId_v2");
- m_nvmlDeviceGetPciInfo_v3 = GetProcAddress<PFN_nvmlDeviceGetPciInfo_v3>("nvmlDeviceGetPciInfo_v3");
- m_nvmlDeviceGetTemperature = GetProcAddress<PFN_nvmlDeviceGetTemperature>("nvmlDeviceGetTemperature");
- m_nvmlDeviceGetUtilizationRates = GetProcAddress<PFN_nvmlDeviceGetUtilizationRates>("nvmlDeviceGetUtilizationRates");
- m_nvmlDeviceGetVbiosVersion = GetProcAddress<PFN_nvmlDeviceGetVbiosVersion>("nvmlDeviceGetVbiosVersion");
- m_nvmlDeviceGetPerformanceState = GetProcAddress<PFN_nvmlDeviceGetPerformanceState>("nvmlDeviceGetPerformanceState");
- m_nvmlDeviceGetClockInfo = GetProcAddress<PFN_nvmlDeviceGetClockInfo>("nvmlDeviceGetClockInfo");
+#define GETPROCADDR(x) m_##x = GetProcAddress<PFN_##x>(#x)
+
+ GETPROCADDR(nvmlInit_v2);
+ GETPROCADDR(nvmlShutdown);
+ GETPROCADDR(nvmlErrorString);
+ GETPROCADDR(nvmlDeviceGetHandleByPciBusId_v2);
+ GETPROCADDR(nvmlDeviceGetPciInfo_v3);
+ GETPROCADDR(nvmlDeviceGetTemperature);
+ GETPROCADDR(nvmlDeviceGetUtilizationRates);
+ GETPROCADDR(nvmlDeviceGetVbiosVersion);
+ GETPROCADDR(nvmlDeviceGetPerformanceState);
+ GETPROCADDR(nvmlDeviceGetClockInfo);
+
+#undef GETPROCADDR
if (m_nvmlInit_v2 == nullptr
|| m_nvmlShutdown == nullptr