diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-01-12 13:02:13 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-01-13 10:08:23 +0100 |
commit | 042cd97884bb86dfd0bedaa63480d99846ab06bb (patch) | |
tree | 14095c34b735179ad60135b1a53c6fb77a6d189e /src/gui/rhi/qrhivulkan.cpp | |
parent | 04f11f9935453a3db6bc5e5064a187fa25e85d90 (diff) |
rhi: Expose device name, type, and IDs
...to the extent it is sensible. We have to make compromises still,
meaning some fields will only be applicable with certain APIs.
Most of this is already shown upon QRhi::create() as info debug
prints, when enabled. Now expose it all through the QRhi API as
well.
This is useful for printing in qtdiag, and, while it should be
avoided as much as possible, to make decisions about disabling
3D rendering features depending on the driver and GPU in use.
Change-Id: Iebe1e192965c928b82a094d1c7c50ddf4b38b9a2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index aa287ce1b9..cb76851d1e 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -361,6 +361,24 @@ static bool qvk_debug_filter(VkDebugReportFlagsEXT flags, VkDebugReportObjectTyp return false; } +static inline QRhiDriverInfo::DeviceType toRhiDeviceType(VkPhysicalDeviceType type) +{ + switch (type) { + case VK_PHYSICAL_DEVICE_TYPE_OTHER: + return QRhiDriverInfo::UnknownDevice; + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: + return QRhiDriverInfo::IntegratedDevice; + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: + return QRhiDriverInfo::DiscreteDevice; + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: + return QRhiDriverInfo::VirtualDevice; + case VK_PHYSICAL_DEVICE_TYPE_CPU: + return QRhiDriverInfo::CpuDevice; + default: + return QRhiDriverInfo::UnknownDevice; + } +} + bool QRhiVulkan::create(QRhi::Flags flags) { Q_UNUSED(flags); @@ -454,6 +472,11 @@ bool QRhiVulkan::create(QRhi::Flags flags) physDevProperties.deviceType); } + driverInfoStruct.deviceName = QByteArray(physDevProperties.deviceName); + driverInfoStruct.deviceId = physDevProperties.deviceID; + driverInfoStruct.vendorId = physDevProperties.vendorID; + driverInfoStruct.deviceType = toRhiDeviceType(physDevProperties.deviceType); + f->vkGetPhysicalDeviceFeatures(physDev, &physDevFeatures); // Choose queue and create device, unless the device was specified in importParams. @@ -4224,6 +4247,11 @@ const QRhiNativeHandles *QRhiVulkan::nativeHandles() return &nativeHandlesStruct; } +QRhiDriverInfo QRhiVulkan::driverInfo() const +{ + return driverInfoStruct; +} + void QRhiVulkan::sendVMemStatsToProfiler() { QRhiProfilerPrivate *rhiP = profilerPrivateOrNull(); |