10 #include <unordered_map>
12 #include "flutter/fml/build_config.h"
110 auto paren_pos = version.find(
"Adreno (TM) ");
111 if (paren_pos == std::string::npos) {
114 auto version_string = version.substr(paren_pos + 12);
119 return result->second;
124 if (version.find(
"DXT") != std::string::npos) {
127 if (version.find(
"CXT") != std::string::npos) {
135 auto dash_pos = version.find(
"Mali-");
136 if (dash_pos == std::string::npos) {
139 auto version_string_with_trailing = version.substr(dash_pos + 5);
141 auto more_dash_pos = version_string_with_trailing.find(
"-");
142 if (more_dash_pos != std::string::npos) {
143 version_string_with_trailing =
144 version_string_with_trailing.substr(0, more_dash_pos);
147 const auto& result =
kMaliVersions.find(version_string_with_trailing);
151 return result->second;
185 case VK_VENDOR_ID_MESA:
204 return "ImgTec PowerVR";
228 return "Integrated GPU";
230 return "Discrete GPU";
232 return "Virtual GPU";
241 case vk::PhysicalDeviceType::eOther:
243 case vk::PhysicalDeviceType::eIntegratedGpu:
245 case vk::PhysicalDeviceType::eDiscreteGpu:
247 case vk::PhysicalDeviceType::eVirtualGpu:
249 case vk::PhysicalDeviceType::eCpu:
257 auto props = device.getProperties();
258 api_version_ =
Version{VK_API_VERSION_MAJOR(props.apiVersion),
259 VK_API_VERSION_MINOR(props.apiVersion),
260 VK_API_VERSION_PATCH(props.apiVersion)};
263 FML_LOG(WARNING) <<
"Unknown GPU Driver Vendor: " << props.vendorID
264 <<
". This is not an error.";
267 if (props.deviceName.data() !=
nullptr) {
268 driver_name_ = props.deviceName.data();
305 std::vector<std::pair<std::string, std::string>> items;
306 items.emplace_back(
"Name", driver_name_);
307 items.emplace_back(
"API Version", api_version_.
ToString());
310 items.emplace_back(
"Is Emulator", std::to_string(
IsEmulator()));
314 for (
const auto& item : items) {
320 std::stringstream stream;
324 stream <<
"--- Driver Information ------------------------------------------";
328 for (
const auto& item : items) {
329 stream <<
"| " << std::setw(
static_cast<int>(
padding)) << item.first
330 << std::setw(0) <<
": " << item.second << std::endl;
333 stream <<
"-----------------------------------------------------------------";
335 FML_LOG(IMPORTANT) << stream.str();
342 driver_name_.find(
"SwiftShader") != std::string::npos) {
const VendorVK & GetVendor() const
Get the vendor of the Vulkan implementation. This is a broad check and includes multiple drivers and ...
DriverInfoVK(const vk::PhysicalDevice &device)
std::optional< PowerVRGPU > GetPowerVRGPUInfo() const
Returns PowerVR GPU info if this is a PowerVR GPU, otherwise std::nullopt.
bool IsKnownBadDriver() const
Determines if the driver has been tested and determined to be non-functional.
const std::string & GetDriverName() const
Get the self-reported name of the graphics driver.
std::optional< AdrenoGPU > GetAdrenoGPUInfo() const
Returns Adreno GPU info if this is a Adreno GPU, otherwise std::nullopt.
void DumpToLog() const
Dumps the current driver info to the log.
std::optional< MaliGPU > GetMaliGPUInfo() const
Returns Mali GPU info if this is a Mali GPU, otherwise std::nullopt.
bool IsEmulator() const
Determines if the driver represents an emulator. There is no definitive way to tell if a driver is an...
const DeviceTypeVK & GetDeviceType() const
Get the device type. Typical use might be to check if the device is a CPU implementation.
const Version & GetAPIVersion() const
Gets the Vulkan API version. Should be at or above Vulkan 1.1 which is the Impeller baseline.
Vector2 padding
The halo padding in source space.
const std::unordered_map< std::string_view, MaliGPU > kMaliVersions
constexpr VendorVK IdentifyVendor(uint32_t vendor)
MaliGPU GetMaliVersion(std::string_view version)
AdrenoGPU GetAdrenoVersion(std::string_view version)
constexpr const char * VendorToString(VendorVK vendor)
constexpr const char * DeviceTypeToString(DeviceTypeVK type)
const std::unordered_map< std::string_view, AdrenoGPU > kAdrenoVersions
PowerVRGPU GetPowerVRVersion(std::string_view version)
constexpr DeviceTypeVK ToDeviceType(const vk::PhysicalDeviceType &type)
constexpr bool IsAtLeast(const Version &other) const
std::string ToString() const