Flutter Impeller
impeller::DriverInfoVK Class Reference

Get information about the Vulkan driver. More...

#include <driver_info_vk.h>

Public Member Functions

 DriverInfoVK (const vk::PhysicalDevice &device)
 
 ~DriverInfoVK ()
 
 DriverInfoVK (const DriverInfoVK &)=delete
 
DriverInfoVKoperator= (const DriverInfoVK &)=delete
 
const VersionGetAPIVersion () const
 Gets the Vulkan API version. Should be at or above Vulkan 1.1 which is the Impeller baseline. More...
 
const VendorVKGetVendor () const
 Get the vendor of the Vulkan implementation. This is a broad check and includes multiple drivers and platforms. More...
 
const DeviceTypeVKGetDeviceType () const
 Get the device type. Typical use might be to check if the device is a CPU implementation. More...
 
const std::string & GetDriverName () const
 Get the self-reported name of the graphics driver. More...
 

Detailed Description

Get information about the Vulkan driver.

Warning
Be extremely cautious about the information reported here. This is self-reported information (by the driver) and may be inaccurate and or inconsistent.

Before gating features behind any of the information reported by the driver, consider alternatives (extensions checks perhaps) and try to get a reviewer buddy to convince you to avoid using this.

Definition at line 69 of file driver_info_vk.h.

Constructor & Destructor Documentation

◆ DriverInfoVK() [1/2]

impeller::DriverInfoVK::DriverInfoVK ( const vk::PhysicalDevice &  device)
explicit

Definition at line 61 of file driver_info_vk.cc.

61  {
62  auto props = device.getProperties();
63  api_version_ = Version{VK_API_VERSION_MAJOR(props.apiVersion),
64  VK_API_VERSION_MINOR(props.apiVersion),
65  VK_API_VERSION_PATCH(props.apiVersion)};
66  vendor_ = IdentifyVendor(props.vendorID);
67  if (vendor_ == VendorVK::kUnknown) {
68  FML_LOG(WARNING) << "Unknown GPU Driver Vendor: " << props.vendorID
69  << ". This is not an error.";
70  }
71  type_ = ToDeviceType(props.deviceType);
72  if (props.deviceName.data() != nullptr) {
73  driver_name_ = props.deviceName.data();
74  }
75 }

References impeller::IdentifyVendor(), impeller::kUnknown, and impeller::ToDeviceType().

◆ ~DriverInfoVK()

impeller::DriverInfoVK::~DriverInfoVK ( )
default

◆ DriverInfoVK() [2/2]

impeller::DriverInfoVK::DriverInfoVK ( const DriverInfoVK )
delete

Member Function Documentation

◆ GetAPIVersion()

const Version & impeller::DriverInfoVK::GetAPIVersion ( ) const

Gets the Vulkan API version. Should be at or above Vulkan 1.1 which is the Impeller baseline.

Returns
The Vulkan API version.

Definition at line 79 of file driver_info_vk.cc.

79  {
80  return api_version_;
81 }

◆ GetDeviceType()

const DeviceTypeVK & impeller::DriverInfoVK::GetDeviceType ( ) const

Get the device type. Typical use might be to check if the device is a CPU implementation.

Returns
The device type.

Definition at line 87 of file driver_info_vk.cc.

87  {
88  return type_;
89 }

◆ GetDriverName()

const std::string & impeller::DriverInfoVK::GetDriverName ( ) const

Get the self-reported name of the graphics driver.

Returns
The driver name.

Definition at line 91 of file driver_info_vk.cc.

91  {
92  return driver_name_;
93 }

◆ GetVendor()

const VendorVK & impeller::DriverInfoVK::GetVendor ( ) const

Get the vendor of the Vulkan implementation. This is a broad check and includes multiple drivers and platforms.

Returns
The vendor.

Definition at line 83 of file driver_info_vk.cc.

83  {
84  return vendor_;
85 }

◆ operator=()

DriverInfoVK& impeller::DriverInfoVK::operator= ( const DriverInfoVK )
delete

The documentation for this class was generated from the following files:
impeller::VendorVK::kUnknown
@ kUnknown
impeller::IdentifyVendor
constexpr VendorVK IdentifyVendor(uint32_t vendor)
Definition: driver_info_vk.cc:9
impeller::ToDeviceType
constexpr DeviceTypeVK ToDeviceType(const vk::PhysicalDeviceType &type)
Definition: driver_info_vk.cc:44