mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-06 05:26:26 +02:00
2 unmerged PRs from original Ryujinx:
Implement shader compile counter (currently not translated, will change, need to pull changes.) Remove event logic in favor of a single init function. Thanks @MutantAura
This commit is contained in:
parent
7618ef134d
commit
a01a06cd3f
10 changed files with 101 additions and 36 deletions
|
@ -103,6 +103,10 @@ namespace Ryujinx.Ava
|
|||
private CursorStates _cursorState = !ConfigurationState.Instance.Hid.EnableMouse.Value ?
|
||||
CursorStates.CursorIsVisible : CursorStates.CursorIsHidden;
|
||||
|
||||
private DateTime _lastShaderReset;
|
||||
private uint _displayCount;
|
||||
private uint _previousCount = 0;
|
||||
|
||||
private bool _isStopped;
|
||||
private bool _isActive;
|
||||
private bool _renderingStarted;
|
||||
|
@ -120,7 +124,6 @@ namespace Ryujinx.Ava
|
|||
private readonly object _lockObject = new();
|
||||
|
||||
public event EventHandler AppExit;
|
||||
public event EventHandler<StatusInitEventArgs> StatusInitEvent;
|
||||
public event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
|
||||
|
||||
public VirtualFileSystem VirtualFileSystem { get; }
|
||||
|
@ -511,8 +514,7 @@ namespace Ryujinx.Ava
|
|||
}
|
||||
|
||||
_isStopped = true;
|
||||
_isActive = false;
|
||||
DiscordIntegrationModule.SwitchToMainState();
|
||||
Stop();
|
||||
}
|
||||
|
||||
public void DisposeContext()
|
||||
|
@ -1043,14 +1045,14 @@ namespace Ryujinx.Ava
|
|||
|
||||
public void InitStatus()
|
||||
{
|
||||
StatusInitEvent?.Invoke(this, new StatusInitEventArgs(
|
||||
ConfigurationState.Instance.Graphics.GraphicsBackend.Value switch
|
||||
{
|
||||
GraphicsBackend.Vulkan => "Vulkan",
|
||||
GraphicsBackend.OpenGl => "OpenGL",
|
||||
_ => throw new NotImplementedException()
|
||||
},
|
||||
$"GPU: {_renderer.GetHardwareInfo().GpuDriver}"));
|
||||
_viewModel.BackendText = ConfigurationState.Instance.Graphics.GraphicsBackend.Value switch
|
||||
{
|
||||
GraphicsBackend.Vulkan => "Vulkan",
|
||||
GraphicsBackend.OpenGl => "OpenGL",
|
||||
_ => throw new NotImplementedException()
|
||||
};
|
||||
|
||||
_viewModel.GpuNameText = $"GPU: {_renderer.GetHardwareInfo().GpuDriver}";
|
||||
}
|
||||
|
||||
public void UpdateStatus()
|
||||
|
@ -1058,6 +1060,8 @@ namespace Ryujinx.Ava
|
|||
// Run a status update only when a frame is to be drawn. This prevents from updating the ui and wasting a render when no frame is queued.
|
||||
string dockedMode = ConfigurationState.Instance.System.EnableDockedMode ? LocaleManager.Instance[LocaleKeys.Docked] : LocaleManager.Instance[LocaleKeys.Handheld];
|
||||
|
||||
UpdateShaderCount();
|
||||
|
||||
if (GraphicsConfig.ResScale != 1)
|
||||
{
|
||||
dockedMode += $" ({GraphicsConfig.ResScale}x)";
|
||||
|
@ -1069,7 +1073,8 @@ namespace Ryujinx.Ava
|
|||
dockedMode,
|
||||
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} %"));
|
||||
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %",
|
||||
_displayCount));
|
||||
}
|
||||
|
||||
public async Task ShowExitPrompt()
|
||||
|
@ -1095,6 +1100,24 @@ namespace Ryujinx.Ava
|
|||
}
|
||||
}
|
||||
|
||||
private void UpdateShaderCount()
|
||||
{
|
||||
// If there is a mismatch between total program compile and previous count
|
||||
// this means new shaders have been compiled and should be displayed.
|
||||
if (_renderer.ProgramCount != _previousCount)
|
||||
{
|
||||
_displayCount += _renderer.ProgramCount - _previousCount;
|
||||
_lastShaderReset = DateTime.Now;
|
||||
_previousCount = _renderer.ProgramCount;
|
||||
}
|
||||
// Check if 5s has passed since any new shaders were compiled.
|
||||
// If yes, reset the counter.
|
||||
else if (_lastShaderReset.AddSeconds(5) <= DateTime.Now)
|
||||
{
|
||||
_displayCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private bool UpdateFrame()
|
||||
{
|
||||
if (!_isActive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue