|
24 | 24 | #endif
|
25 | 25 |
|
26 | 26 | namespace cortex::hw {
|
| 27 | +constexpr const uint32_t NVIDIA_VENDOR = 0x10DE; |
| 28 | +constexpr const uint32_t AMD_VENDOR = 0x1002; |
| 29 | +constexpr const uint32_t INTEL_VENDOR = 0x8086; |
| 30 | +constexpr const uint32_t ARM_VENDOR = 0x13B5; |
| 31 | + |
27 | 32 | inline std::string GetVendorStr(uint32_t vendor_id) {
|
28 | 33 | switch (vendor_id) {
|
29 |
| - case 0x1002: |
| 34 | + case AMD_VENDOR: |
30 | 35 | return "AMD";
|
31 |
| - case 0x10DE: |
| 36 | + case NVIDIA_VENDOR: |
32 | 37 | return "NVIDIA";
|
33 |
| - case 0x8086: |
| 38 | + case INTEL_VENDOR: |
34 | 39 | return "INTEL";
|
35 |
| - case 0x13B5: |
| 40 | + case ARM_VENDOR: |
36 | 41 | return "ARM";
|
37 | 42 | default:
|
38 | 43 | return std::to_string(vendor_id);
|
@@ -441,16 +446,19 @@ class VulkanGpu {
|
441 | 446 | #endif
|
442 | 447 | int free_vram_MiB =
|
443 | 448 | total_vram_MiB > used_vram_MiB ? total_vram_MiB - used_vram_MiB : 0;
|
444 |
| - gpus.emplace_back(cortex::hw::GPU{ |
445 |
| - .id = std::to_string(id), |
446 |
| - .device_id = device_properties.deviceID, |
447 |
| - .name = device_properties.deviceName, |
448 |
| - .version = std::to_string(device_properties.driverVersion), |
449 |
| - .add_info = cortex::hw::AmdAddInfo{}, |
450 |
| - .free_vram = free_vram_MiB, |
451 |
| - .total_vram = total_vram_MiB, |
452 |
| - .uuid = uuid_to_string(device_id_properties.deviceUUID), |
453 |
| - .vendor = GetVendorStr(device_properties.vendorID)}); |
| 449 | + if (device_properties.vendorID == NVIDIA_VENDOR || |
| 450 | + device_properties.vendorID == AMD_VENDOR) { |
| 451 | + gpus.emplace_back(cortex::hw::GPU{ |
| 452 | + .id = std::to_string(id), |
| 453 | + .device_id = device_properties.deviceID, |
| 454 | + .name = device_properties.deviceName, |
| 455 | + .version = std::to_string(device_properties.driverVersion), |
| 456 | + .add_info = cortex::hw::AmdAddInfo{}, |
| 457 | + .free_vram = free_vram_MiB, |
| 458 | + .total_vram = total_vram_MiB, |
| 459 | + .uuid = uuid_to_string(device_id_properties.deviceUUID), |
| 460 | + .vendor = GetVendorStr(device_properties.vendorID)}); |
| 461 | + } |
454 | 462 | id++;
|
455 | 463 | }
|
456 | 464 |
|
|
0 commit comments