mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
GPU: support driver version detection
This commit is contained in:
@@ -12,6 +12,8 @@ Features:
|
||||
* Support `--localip-compact-type` option (#408)
|
||||
* Terminator terminal font detection (@Zerogiven, #415)
|
||||
* Windows 32bit compatibility
|
||||
* Support global configuration in MSYS2 environment (Windows)
|
||||
* Support GPU driver version detection on Windows 11
|
||||
|
||||
Bugfixes:
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ typedef struct FFGPUResult
|
||||
FFstrbuf name;
|
||||
FFstrbuf driver;
|
||||
double temperature;
|
||||
uint64_t memory;
|
||||
int coreCount;
|
||||
} FFGPUResult;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ extern "C" {
|
||||
|
||||
#include <dxgi.h>
|
||||
#include <wchar.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
static const char* detectWithRegistry(FFlist* gpus)
|
||||
{
|
||||
@@ -13,11 +14,11 @@ static const char* detectWithRegistry(FFlist* gpus)
|
||||
|
||||
FF_HKEY_AUTO_DESTROY hKey = NULL;
|
||||
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectX", &hKey, nullptr))
|
||||
return "Open \"SOFTWARE\\Microsoft\\DirectX\" failed";
|
||||
return "Open \"HKLM\\SOFTWARE\\Microsoft\\DirectX\" failed";
|
||||
|
||||
uint64_t lastSeen;
|
||||
if(!ffRegReadUint64(hKey, L"LastSeen", &lastSeen, nullptr))
|
||||
return "Read \"SOFTWARE\\Microsoft\\DirectX\\LastSeen\" failed";
|
||||
return "Read \"HKLM\\SOFTWARE\\Microsoft\\DirectX\\LastSeen\" failed";
|
||||
|
||||
DWORD index = 0;
|
||||
wchar_t subKeyName[64];
|
||||
@@ -55,9 +56,11 @@ static const char* detectWithRegistry(FFlist* gpus)
|
||||
|
||||
uint64_t dedicatedVideoMemory;
|
||||
if(ffRegReadUint64(hSubKey, L"DedicatedVideoMemory", &dedicatedVideoMemory, nullptr))
|
||||
{
|
||||
gpu->type = dedicatedVideoMemory >= 1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||
}
|
||||
|
||||
uint64_t driverVersion;
|
||||
if(ffRegReadUint64(hSubKey, L"DriverVersion", &driverVersion, nullptr))
|
||||
ffStrbufSetF(&gpu->driver, "%" PRIu64 ".%" PRIu64, (driverVersion >> 16) & 0xFFFF, driverVersion & 0xFFFF);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user