From 17200214dfbd60ba075f106e558d4f563a1bbe98 Mon Sep 17 00:00:00 2001 From: HorrorTroll Date: Wed, 25 Mar 2020 04:54:09 +0700 Subject: [PATCH] Add GPU name in status bar (#984) * Add GPU name in status bar * Fixed like Ac_K suggest * Nit. * Minor fix * Minor change. * Nit. * Fixed for ATI vendor * Minor fix, again... --- Ryujinx.Graphics.OpenGL/Renderer.cs | 14 ++++++++++---- Ryujinx/Ui/GLRenderer.cs | 9 ++++++++- Ryujinx/Ui/MainWindow.cs | 2 ++ Ryujinx/Ui/MainWindow.glade | 29 ++++++++++++++++++++++++++-- Ryujinx/Ui/StatusUpdatedEventArgs.cs | 4 +++- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/Ryujinx.Graphics.OpenGL/Renderer.cs b/Ryujinx.Graphics.OpenGL/Renderer.cs index ccb53397d..6ff3c36c7 100644 --- a/Ryujinx.Graphics.OpenGL/Renderer.cs +++ b/Ryujinx.Graphics.OpenGL/Renderer.cs @@ -19,6 +19,12 @@ namespace Ryujinx.Graphics.OpenGL internal TextureCopy TextureCopy { get; } + public string GpuVendor { get; private set; } + + public string GpuRenderer { get; private set; } + + public string GpuVersion { get; private set; } + public Renderer() { _pipeline = new Pipeline(); @@ -78,11 +84,11 @@ namespace Ryujinx.Graphics.OpenGL private void PrintGpuInformation() { - string gpuVendor = GL.GetString(StringName.Vendor); - string gpuRenderer = GL.GetString(StringName.Renderer); - string gpuVersion = GL.GetString(StringName.Version); + GpuVendor = GL.GetString(StringName.Vendor); + GpuRenderer = GL.GetString(StringName.Renderer); + GpuVersion = GL.GetString(StringName.Version); - Logger.PrintInfo(LogClass.Gpu, $"{gpuVendor} {gpuRenderer} ({gpuVersion})"); + Logger.PrintInfo(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})"); } public void ResetCounter(CounterType type) diff --git a/Ryujinx/Ui/GLRenderer.cs b/Ryujinx/Ui/GLRenderer.cs index 5d0d19085..160608eb8 100644 --- a/Ryujinx/Ui/GLRenderer.cs +++ b/Ryujinx/Ui/GLRenderer.cs @@ -335,10 +335,17 @@ namespace Ryujinx.Ui _device.Statistics.RecordSystemFrameTime(); + string gpuVendor = "Unknown"; + + if (_renderer.GpuVendor.ToLower().Contains("nvidia")) gpuVendor = "NVIDIA"; + if (_renderer.GpuVendor.ToLower().Contains("amd") || _renderer.GpuVendor.ToLower().Contains("ati")) gpuVendor = "AMD"; + if (_renderer.GpuVendor.ToLower().Contains("intel")) gpuVendor = "Intel"; + StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs( _device.EnableDeviceVsync, $"Host: {_device.Statistics.GetSystemFrameRate():00.00} FPS", - $"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS")); + $"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS", + $"GPU: {gpuVendor}")); _device.System.SignalVsync(); diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index eaa0a7cdf..f658bea46 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -71,6 +71,7 @@ namespace Ryujinx.Ui [GUI] TreeView _gameTable; [GUI] ScrolledWindow _gameTableWindow; [GUI] TreeSelection _gameTableSelection; + [GUI] Label _gpuName; [GUI] Label _progressLabel; [GUI] Label _firmwareVersionLabel; [GUI] LevelBar _progressBar; @@ -605,6 +606,7 @@ namespace Ryujinx.Ui { _hostStatus.Text = args.HostStatus; _gameStatus.Text = args.GameStatus; + _gpuName.Text = args.GpuName; if (args.VSyncEnabled) { diff --git a/Ryujinx/Ui/MainWindow.glade b/Ryujinx/Ui/MainWindow.glade index f8b39529e..931cd2a59 100644 --- a/Ryujinx/Ui/MainWindow.glade +++ b/Ryujinx/Ui/MainWindow.glade @@ -475,7 +475,7 @@ True False start - 10 + 5 5 VSync @@ -527,11 +527,36 @@ False start 5 + 5 + + + False + True + 4 + + + + + True + False + + + False + True + 5 + + + + + True + False + start + 5 True True - 4 + 6 diff --git a/Ryujinx/Ui/StatusUpdatedEventArgs.cs b/Ryujinx/Ui/StatusUpdatedEventArgs.cs index 850938058..3d0cc3007 100644 --- a/Ryujinx/Ui/StatusUpdatedEventArgs.cs +++ b/Ryujinx/Ui/StatusUpdatedEventArgs.cs @@ -7,12 +7,14 @@ namespace Ryujinx.Ui public bool VSyncEnabled; public string HostStatus; public string GameStatus; + public string GpuName; - public StatusUpdatedEventArgs(bool vSyncEnabled, string hostStatus, string gameStatus) + public StatusUpdatedEventArgs(bool vSyncEnabled, string hostStatus, string gameStatus, string gpuName) { VSyncEnabled = vSyncEnabled; HostStatus = hostStatus; GameStatus = gameStatus; + GpuName = gpuName; } } } \ No newline at end of file