1 // 2 // Copyright (c) 2013-2017 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // SystemInfo.h: gathers information available without starting a GPU driver. 8 9 #ifndef GPU_INFO_UTIL_SYSTEM_INFO_H_ 10 #define GPU_INFO_UTIL_SYSTEM_INFO_H_ 11 12 #include <cstdint> 13 #include <string> 14 #include <vector> 15 16 namespace angle 17 { 18 19 using VendorID = uint32_t; 20 using DeviceID = uint32_t; 21 22 constexpr VendorID kVendorID_AMD = 0x1002; 23 constexpr VendorID kVendorID_Intel = 0x8086; 24 constexpr VendorID kVendorID_Nvidia = 0x10DE; 25 constexpr VendorID kVendorID_Qualcomm = 0x5143; 26 27 struct GPUDeviceInfo 28 { 29 GPUDeviceInfo(); 30 ~GPUDeviceInfo(); 31 32 GPUDeviceInfo(const GPUDeviceInfo &other); 33 34 VendorID vendorId = 0; 35 DeviceID deviceId = 0; 36 37 std::string driverVendor; 38 std::string driverVersion; 39 std::string driverDate; 40 }; 41 42 struct SystemInfo 43 { 44 SystemInfo(); 45 ~SystemInfo(); 46 47 SystemInfo(const SystemInfo &other); 48 49 std::vector<GPUDeviceInfo> gpus; 50 int primaryGPUIndex = -1; 51 int activeGPUIndex = -1; 52 53 bool isOptimus = false; 54 bool isAMDSwitchable = false; 55 56 // Only available on macOS 57 std::string machineModelName; 58 std::string machineModelVersion; 59 60 // Only available on Windows, set even on failure. 61 std::string primaryDisplayDeviceId; 62 }; 63 64 bool GetSystemInfo(SystemInfo *info); 65 66 bool IsAMD(VendorID vendorId); 67 bool IsIntel(VendorID vendorId); 68 bool IsNvidia(VendorID vendorId); 69 bool IsQualcomm(VendorID vendorId); 70 71 } // namespace angle 72 73 #endif // GPU_INFO_UTIL_SYSTEM_INFO_H_ 74