Salieri: shader cache (#1701)

Here come Salieri, my implementation of a disk shader cache!

"I'm sure you know why I named it that."
"It doesn't really mean anything."

This implementation collects shaders at runtime and cache them to be later compiled when starting a game.
This commit is contained in:
Mary 2020-11-13 00:15:34 +01:00 committed by GitHub
parent 7166e82c3c
commit 48f6570557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 3589 additions and 396 deletions

View file

@ -39,6 +39,7 @@ namespace Ryujinx.Ui
public static GlRenderer GlWidget => _glWidget;
private static AutoResetEvent _deviceExitStatus = new AutoResetEvent(false);
private static AutoResetEvent _widgetInitEvent = new AutoResetEvent(false);
private static ListStore _tableStore;
@ -433,6 +434,30 @@ namespace Ryujinx.Ui
}
}
_widgetInitEvent.Reset();
#if MACOS_BUILD
CreateGameWindow(device);
#else
Thread windowThread = new Thread(() =>
{
CreateGameWindow(device);
})
{
Name = "GUI.WindowThread"
};
windowThread.Start();
#endif
_widgetInitEvent.WaitOne();
// Make sure the widget get initialized by forcing an update of GTK
while (Application.EventsPending())
{
Application.RunIteration();
}
Logger.Notice.Print(LogClass.Application, $"Using Firmware Version: {firmwareVersion?.VersionString}");
if (Directory.Exists(path))
@ -493,25 +518,24 @@ namespace Ryujinx.Ui
return;
}
string titleNameSection = string.IsNullOrWhiteSpace(device.Application.TitleName) ? string.Empty
: $" - {device.Application.TitleName}";
string titleVersionSection = string.IsNullOrWhiteSpace(device.Application.DisplayVersion) ? string.Empty
: $" v{device.Application.DisplayVersion}";
string titleIdSection = string.IsNullOrWhiteSpace(device.Application.TitleIdText) ? string.Empty
: $" ({device.Application.TitleIdText.ToUpper()})";
string titleArchSection = device.Application.TitleIs64Bit ? " (64-bit)" : " (32-bit)";
Title = $"Ryujinx {Program.Version}{titleNameSection}{titleVersionSection}{titleIdSection}{titleArchSection}";
_emulationContext = device;
_gamePath = path;
_deviceExitStatus.Reset();
#if MACOS_BUILD
CreateGameWindow(device);
#else
Thread windowThread = new Thread(() =>
{
CreateGameWindow(device);
})
{
Name = "GUI.WindowThread"
};
windowThread.Start();
#endif
_gameLoaded = true;
_stopEmulation.Sensitive = true;
@ -534,7 +558,7 @@ namespace Ryujinx.Ui
_windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
}
_glWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel);
_glWidget = new GlRenderer(device, ConfigurationState.Instance.Logger.GraphicsDebugLevel);
Application.Invoke(delegate
{
@ -551,6 +575,8 @@ namespace Ryujinx.Ui
}
});
_widgetInitEvent.Set();
_glWidget.WaitEvent.WaitOne();
_glWidget.Start();
@ -658,6 +684,7 @@ namespace Ryujinx.Ui
Graphics.Gpu.GraphicsConfig.ResScale = (resScale == -1) ? resScaleCustom : resScale;
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
Graphics.Gpu.GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
}
public static void SaveConfig()