| 2491 | |
| 2492 | #if defined(_WIN32) |
| 2493 | void LogGPUCapabilities() |
| 2494 | { |
| 2495 | Console.WriteLn(Color_StrongBlack, "Graphics Adapters Detected:"); |
| 2496 | #if defined(_WIN32) |
| 2497 | wil::com_ptr_nothrow<IDXGIFactory1> pFactory; |
| 2498 | if (FAILED(CreateDXGIFactory1(IID_PPV_ARGS(pFactory.put())))) |
| 2499 | return; |
| 2500 | |
| 2501 | UINT i = 0; |
| 2502 | wil::com_ptr_nothrow<IDXGIAdapter> pAdapter; |
| 2503 | while (pFactory->EnumAdapters(i, pAdapter.put()) != DXGI_ERROR_NOT_FOUND) |
| 2504 | { |
| 2505 | DXGI_ADAPTER_DESC desc; |
| 2506 | LARGE_INTEGER umdver; |
| 2507 | if (SUCCEEDED(pAdapter->GetDesc(&desc)) && SUCCEEDED(pAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &umdver))) |
| 2508 | { |
| 2509 | Console.WriteLnFmt( |
| 2510 | " GPU = {}\n" |
| 2511 | " Driver Version = {}.{}.{}.{}\n", |
| 2512 | StringUtil::WideStringToUTF8String(desc.Description), |
| 2513 | umdver.QuadPart >> 48, |
| 2514 | (umdver.QuadPart >> 32) & 0xFFFF, |
| 2515 | (umdver.QuadPart >> 16) & 0xFFFF, |
| 2516 | umdver.QuadPart & 0xFFFF); |
| 2517 | |
| 2518 | i++; |
| 2519 | } |
| 2520 | else |
| 2521 | { |
| 2522 | break; |
| 2523 | } |
| 2524 | } |
| 2525 | #else |
| 2526 | // Credits to neofetch for the following (modified) script |
| 2527 | std::string gpu_script = R"gpu_script( |
| 2528 | lspci -mm | |
| 2529 | awk -F '\"|\" \"|\\(' \ |
| 2530 | '/"Display|"3D|"VGA/ { |
| 2531 | a[$0] = $1 "" $3 " " ($(NF-1) ~ /^$|^Device [[:xdigit:]]+$/ ? $4 : $(NF-1)) |
| 2532 | } |
| 2533 | END { for (i in a) { |
| 2534 | if (!seen[a[i]]++) { |
| 2535 | sub("^[^ ]+ ", "", a[i]); |
| 2536 | print a[i] |
| 2537 | } |
| 2538 | }}' |
| 2539 | )gpu_script"; |
| 2540 | |
| 2541 | FILE* f = popen(gpu_script.c_str(), "r"); |
| 2542 | if (f) |
| 2543 | { |
| 2544 | char buffer[1024]; |
| 2545 | while (fgets(buffer, sizeof(buffer), f)) |
| 2546 | { |
| 2547 | std::string card(buffer); |
| 2548 | std::string version = "Unknown\n"; |
| 2549 | if (card.find("NVIDIA") != std::string::npos) |
| 2550 | { |
no test coverage detected