Archived
1
0
Fork 0
forked from Mirror/Ryujinx

Use driver name instead of vendor name in the status bar for Vulkan. (#6146)

* Replace vendor id lookup with driver name

* Create separate field for driver name, handle OpenGL

* Document changes in VulkanPhysicalDevice.cs

* Always display driver over vendor

* Replace Vulkan 1.2 requirement with VK_KHR_driver_properties

* Remove empty line

* Remove redundant unsafe block

* Apply suggestions from code review

---------

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
Elijah 2024-01-25 16:07:20 -08:00 committed by GitHub
parent fbdd390f90
commit d7ec4308b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 47 additions and 14 deletions

View file

@ -978,7 +978,7 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
LocaleManager.Instance[LocaleKeys.Game] + $": {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)",
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %",
$"GPU: {_renderer.GetHardwareInfo().GpuVendor}"));
$"GPU: {_renderer.GetHardwareInfo().GpuDriver}"));
}
public async Task ShowExitPrompt()

View file

@ -4,11 +4,13 @@ namespace Ryujinx.Graphics.GAL
{
public string GpuVendor { get; }
public string GpuModel { get; }
public string GpuDriver { get; }
public HardwareInfo(string gpuVendor, string gpuModel)
public HardwareInfo(string gpuVendor, string gpuModel, string gpuDriver)
{
GpuVendor = gpuVendor;
GpuModel = gpuModel;
GpuDriver = gpuDriver;
}
}
}

View file

@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.OpenGL
public HardwareInfo GetHardwareInfo()
{
return new HardwareInfo(GpuVendor, GpuRenderer);
return new HardwareInfo(GpuVendor, GpuRenderer, GpuVendor); // OpenGL does not provide a driver name, vendor name is closest analogue.
}
public PinnedSpan<byte> GetBufferData(BufferHandle buffer, int offset, int size)

View file

@ -58,6 +58,33 @@ namespace Ryujinx.Graphics.Vulkan
public bool IsDeviceExtensionPresent(string extension) => DeviceExtensions.Contains(extension);
public unsafe bool TryGetPhysicalDeviceDriverPropertiesKHR(Vk api, out PhysicalDeviceDriverPropertiesKHR res)
{
if (!IsDeviceExtensionPresent("VK_KHR_driver_properties"))
{
res = default;
return false;
}
PhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties = new()
{
SType = StructureType.PhysicalDeviceDriverPropertiesKhr
};
PhysicalDeviceProperties2 physicalDeviceProperties2 = new()
{
SType = StructureType.PhysicalDeviceProperties2,
PNext = &physicalDeviceDriverProperties
};
api.GetPhysicalDeviceProperties2(PhysicalDevice, &physicalDeviceProperties2);
res = physicalDeviceDriverProperties;
return true;
}
public DeviceInfo ToDeviceInfo()
{
return new DeviceInfo(

View file

@ -84,6 +84,7 @@ namespace Ryujinx.Graphics.Vulkan
internal bool IsTBDR { get; private set; }
internal bool IsSharedMemory { get; private set; }
public string GpuVendor { get; private set; }
public string GpuDriver { get; private set; }
public string GpuRenderer { get; private set; }
public string GpuVersion { get; private set; }
@ -636,7 +637,7 @@ namespace Ryujinx.Graphics.Vulkan
public HardwareInfo GetHardwareInfo()
{
return new HardwareInfo(GpuVendor, GpuRenderer);
return new HardwareInfo(GpuVendor, GpuRenderer, GpuDriver);
}
/// <summary>
@ -693,6 +694,8 @@ namespace Ryujinx.Graphics.Vulkan
{
var properties = _physicalDevice.PhysicalDeviceProperties;
var hasDriverProperties = _physicalDevice.TryGetPhysicalDeviceDriverPropertiesKHR(Api, out var driverProperties);
string vendorName = VendorUtils.GetNameFromId(properties.VendorID);
Vendor = VendorUtils.FromId(properties.VendorID);
@ -707,6 +710,7 @@ namespace Ryujinx.Graphics.Vulkan
Vendor == Vendor.ImgTec;
GpuVendor = vendorName;
GpuDriver = hasDriverProperties ? Marshal.PtrToStringAnsi((IntPtr)driverProperties.DriverName) : vendorName; // Fall back to vendor name if driver name isn't available.
GpuRenderer = Marshal.PtrToStringAnsi((IntPtr)properties.DeviceName);
GpuVersion = $"Vulkan v{ParseStandardVulkanVersion(properties.ApiVersion)}, Driver v{ParseDriverVersion(ref properties)}";

View file

@ -80,7 +80,7 @@ namespace Ryujinx.Headless.SDL2
private bool _isStopped;
private uint _windowId;
private string _gpuVendorName;
private string _gpuDriverName;
private readonly AspectRatio _aspectRatio;
private readonly bool _enableMouse;
@ -241,9 +241,9 @@ namespace Ryujinx.Headless.SDL2
public abstract SDL_WindowFlags GetWindowFlags();
private string GetGpuVendorName()
private string GetGpuDriverName()
{
return Renderer.GetHardwareInfo().GpuVendor;
return Renderer.GetHardwareInfo().GpuDriver;
}
private void SetAntiAliasing()
@ -269,7 +269,7 @@ namespace Ryujinx.Headless.SDL2
SetScalingFilter();
_gpuVendorName = GetGpuVendorName();
_gpuDriverName = GetGpuDriverName();
Device.Gpu.Renderer.RunLoop(() =>
{
@ -314,7 +314,7 @@ namespace Ryujinx.Headless.SDL2
Device.Configuration.AspectRatio.ToText(),
$"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)",
$"FIFO: {Device.Statistics.GetFifoPercent():0.00} %",
$"GPU: {_gpuVendorName}"));
$"GPU: {_gpuDriverName}"));
_ticks = Math.Min(_ticks - _ticksPerFrame, _ticksPerFrame);
}

View file

@ -77,7 +77,7 @@ namespace Ryujinx.Ui
private readonly IKeyboard _keyboardInterface;
private readonly GraphicsDebugLevel _glLogLevel;
private string _gpuBackendName;
private string _gpuVendorName;
private string _gpuDriverName;
private bool _isMouseInClient;
public RendererWidgetBase(InputManager inputManager, GraphicsDebugLevel glLogLevel)
@ -141,9 +141,9 @@ namespace Ryujinx.Ui
protected abstract string GetGpuBackendName();
private string GetGpuVendorName()
private string GetGpuDriverName()
{
return Renderer.GetHardwareInfo().GpuVendor;
return Renderer.GetHardwareInfo().GpuDriver;
}
private void HideCursorStateChanged(object sender, ReactiveEventArgs<HideCursorMode> state)
@ -443,7 +443,7 @@ namespace Ryujinx.Ui
Renderer.Window.SetScalingFilterLevel(ConfigurationState.Instance.Graphics.ScalingFilterLevel.Value);
_gpuBackendName = GetGpuBackendName();
_gpuVendorName = GetGpuVendorName();
_gpuDriverName = GetGpuDriverName();
Device.Gpu.Renderer.RunLoop(() =>
{
@ -494,7 +494,7 @@ namespace Ryujinx.Ui
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
$"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)",
$"FIFO: {Device.Statistics.GetFifoPercent():0.00} %",
$"GPU: {_gpuVendorName}"));
$"GPU: {_gpuDriverName}"));
_ticks = Math.Min(_ticks - _ticksPerFrame, _ticksPerFrame);
}