mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-23 02:51:13 +02:00
feature: Add GpuDriverVersion to GPU info logging
- The Vulkan backend now reports the driver name and version using VK_KHR_driver_properties when available, with fallbacks for raw Vulkan driverVersion parsing. Intel Windows drivers also get the full package-style version from the driver UUID when exposed by the driver. OpenGL now carries its existing OpenGL version string through HardwareInfo.GpuDriverVersion.
This commit is contained in:
@@ -105,6 +105,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
public string GpuDriver { get; private set; }
|
||||
public string GpuRenderer { get; private set; }
|
||||
public string GpuVersion { get; private set; }
|
||||
public string GpuDriverVersion { get; private set; }
|
||||
|
||||
public bool PreferThreading => true;
|
||||
|
||||
@@ -177,6 +178,14 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
SType = StructureType.PhysicalDeviceProperties2,
|
||||
};
|
||||
|
||||
PhysicalDeviceIDProperties propertiesId = new()
|
||||
{
|
||||
SType = StructureType.PhysicalDeviceIDProperties,
|
||||
PNext = properties2.PNext,
|
||||
};
|
||||
|
||||
properties2.PNext = &propertiesId;
|
||||
|
||||
PhysicalDeviceSubgroupProperties propertiesSubgroup = new()
|
||||
{
|
||||
SType = StructureType.PhysicalDeviceSubgroupProperties,
|
||||
@@ -367,13 +376,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
GpuVendor = VendorUtils.GetNameFromId(properties.VendorID);
|
||||
GpuDriver = hasDriverProperties && !OperatingSystem.IsMacOS() ?
|
||||
VendorUtils.GetFriendlyDriverName(driverProperties.DriverID) : GpuVendor; // Fallback to vendor name if driver is unavailable or on MacOS where vendor is preferred.
|
||||
GpuDriverVersion = TryGetIntelWindowsDriverVersionFromUuid(ref propertiesId, out string intelDriverVersion) ? intelDriverVersion :
|
||||
hasDriverProperties ?
|
||||
GetDriverInfo(ref driverProperties) ?? ParseDriverVersion(ref properties) :
|
||||
ParseDriverVersion(ref properties);
|
||||
|
||||
fixed (byte* deviceName = properties.DeviceName)
|
||||
{
|
||||
GpuRenderer = Marshal.PtrToStringAnsi((nint)deviceName);
|
||||
}
|
||||
|
||||
GpuVersion = $"Vulkan v{ParseStandardVulkanVersion(properties.ApiVersion)}, Driver v{ParseDriverVersion(ref properties)}";
|
||||
GpuVersion = $"Vulkan v{ParseStandardVulkanVersion(properties.ApiVersion)}";
|
||||
|
||||
IsAmdGcn = !IsMoltenVk && Vendor == Vendor.Amd && VendorUtils.AmdGcnRegex().IsMatch(GpuRenderer);
|
||||
|
||||
@@ -824,7 +837,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
public HardwareInfo GetHardwareInfo()
|
||||
{
|
||||
return new HardwareInfo(GpuVendor, GpuRenderer, GpuDriver);
|
||||
return new HardwareInfo(GpuVendor, GpuRenderer, GpuDriver, GpuDriverVersion);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -874,9 +887,55 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return $"{(driverVersionRaw >> 22) & 0x3FF}.{(driverVersionRaw >> 14) & 0xFF}.{(driverVersionRaw >> 6) & 0xFF}.{driverVersionRaw & 0x3F}";
|
||||
}
|
||||
|
||||
// Intel's Windows Vulkan driver exposes the 101.xxxx build portion in a custom layout.
|
||||
if (properties.VendorID == 0x8086 && OperatingSystem.IsWindows())
|
||||
{
|
||||
return $"{driverVersionRaw >> 14}.{driverVersionRaw & 0x3FFF}";
|
||||
}
|
||||
|
||||
return ParseStandardVulkanVersion(driverVersionRaw);
|
||||
}
|
||||
|
||||
private static unsafe string GetDriverInfo(ref PhysicalDeviceDriverPropertiesKHR driverProperties)
|
||||
{
|
||||
fixed (byte* driverInfo = driverProperties.DriverInfo)
|
||||
{
|
||||
string driverInfoString = Marshal.PtrToStringAnsi((nint)driverInfo);
|
||||
|
||||
return string.IsNullOrWhiteSpace(driverInfoString) ? null : driverInfoString;
|
||||
}
|
||||
}
|
||||
|
||||
private static unsafe bool TryGetIntelWindowsDriverVersionFromUuid(ref PhysicalDeviceIDProperties propertiesId, out string driverVersion)
|
||||
{
|
||||
driverVersion = null;
|
||||
|
||||
if (!OperatingSystem.IsWindows())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
fixed (byte* driverUuid = propertiesId.DriverUuid)
|
||||
{
|
||||
string driverUuidString = Marshal.PtrToStringAnsi((nint)driverUuid, (int)Vk.UuidSize);
|
||||
int terminatorIndex = driverUuidString.IndexOf('\0');
|
||||
|
||||
if (terminatorIndex >= 0)
|
||||
{
|
||||
driverUuidString = driverUuidString[..terminatorIndex];
|
||||
}
|
||||
|
||||
if (VendorUtils.IntelWindowsDriverVersionRegex().IsMatch(driverUuidString))
|
||||
{
|
||||
driverVersion = driverUuidString;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal PrimitiveTopology TopologyRemap(PrimitiveTopology topology)
|
||||
{
|
||||
return topology switch
|
||||
@@ -902,7 +961,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
|
||||
private void PrintGpuInformation()
|
||||
{
|
||||
Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})");
|
||||
Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion}, Driver: {GpuDriver} {GpuDriverVersion})");
|
||||
Logger.Notice.Print(LogClass.Gpu, $"GPU Memory: {GetTotalGPUMemory() / (1024 * 1024)} MiB");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user