| 435 | } |
| 436 | |
| 437 | bool GPUDeviceDX11::Init() |
| 438 | { |
| 439 | HRESULT result; |
| 440 | |
| 441 | // Driver extensions |
| 442 | #if COMPILE_WITH_NVAPI |
| 443 | if (_adapter->IsNVIDIA()) |
| 444 | { |
| 445 | NvAPI_Status status = NvAPI_Initialize(); |
| 446 | if (status == NVAPI_OK) |
| 447 | { |
| 448 | EnableNvapi = true; |
| 449 | |
| 450 | NvU32 driverVersion; |
| 451 | NvAPI_ShortString buildBranch(""); |
| 452 | if (NvAPI_SYS_GetDriverAndBranchVersion(&driverVersion, buildBranch) == NVAPI_OK) |
| 453 | { |
| 454 | LOG(Info, "NvApi driver version: {}, {}", driverVersion, TO_UTF16(buildBranch)); |
| 455 | } |
| 456 | } |
| 457 | else |
| 458 | { |
| 459 | NvAPI_ShortString desc; |
| 460 | NvAPI_GetErrorMessage(status, desc); |
| 461 | LOG(Warning, "NvAPI_Initialize failed with result {} ({})", (int32)status, String(desc)); |
| 462 | } |
| 463 | } |
| 464 | #endif |
| 465 | #if COMPILE_WITH_AGS |
| 466 | if (_adapter->IsAMD()) |
| 467 | { |
| 468 | AGSGPUInfo gpuInfo = {}; |
| 469 | AGSConfiguration config = {}; |
| 470 | AGSReturnCode returnCode = agsInitialize(AGS_CURRENT_VERSION, &config, &AgsContext, &gpuInfo); |
| 471 | if (returnCode == AGS_SUCCESS) |
| 472 | { |
| 473 | LOG(Info, "AMD driver version: {}, Radeon Software Version {}", TO_UTF16(gpuInfo.driverVersion), TO_UTF16(gpuInfo.radeonSoftwareVersion)); |
| 474 | const Char* asicFamily[] = |
| 475 | { |
| 476 | TEXT("Unknown"), |
| 477 | TEXT("Pre GCN"), |
| 478 | TEXT("GCN Gen1"), |
| 479 | TEXT("GCN Gen2"), |
| 480 | TEXT("GCN Gen3"), |
| 481 | TEXT("GCN Gen4"), |
| 482 | TEXT("Vega"), |
| 483 | TEXT("RDNA"), |
| 484 | TEXT("RDNA2"), |
| 485 | TEXT("RDNA3"), |
| 486 | TEXT("RDNA4"), |
| 487 | }; |
| 488 | for (int32 i = 0; i < gpuInfo.numDevices; i++) |
| 489 | { |
| 490 | AGSDeviceInfo& deviceInfo = gpuInfo.devices[i]; |
| 491 | LOG(Info, " > GPU {}: {} ({})", i, TO_UTF16(deviceInfo.adapterString), asicFamily[deviceInfo.asicFamily <= AGSAsicFamily_RDNA4 ? deviceInfo.asicFamily : 0]); |
| 492 | LOG(Info, " CUs: {}, WGPs: {}, ROPs: {}", deviceInfo.numCUs, deviceInfo.numWGPs, deviceInfo.numROPs); |
| 493 | LOG(Info, " Core clock: {} MHz, Memory clock: {} MHz, {:.2f} Tflops", deviceInfo.coreClock, deviceInfo.memoryClock, deviceInfo.teraFlops); |
| 494 | LOG(Info, " Local memory: {} MB ({:.2f} GB/s), Shared memory: {} MB", (int32)(deviceInfo.localMemoryInBytes / (1024ull * 1024ull)), (float)deviceInfo.memoryBandwidth / 1024.0f, (int32)(deviceInfo.sharedMemoryInBytes / (1024ull * 1024ull))); |
no test coverage detected