mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 09:35:27 +00:00
shader cache: Fix possible race causing crashes on manifest at startup (#1718)
* shader cache: Fix possible race causing crashes on manifest at startup This fix a misplace function call ending up causing possibly two write on the cache.info at the same time. * shader cache: Make RemoveManifestEntries async too to be sure all operations are perform before starting the game
This commit is contained in:
parent
383c039037
commit
cc60ba9d22
|
@ -33,6 +33,11 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SaveManifest,
|
SaveManifest,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove entries from the hash manifest and save it.
|
||||||
|
/// </summary>
|
||||||
|
RemoveManifestEntries,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flush temporary cache to archive.
|
/// Flush temporary cache to archive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -227,11 +232,24 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
|
||||||
FlushToArchive();
|
FlushToArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Queue a task to remove entries from the hash manifest.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entries">Entries to remove from the manifest</param>
|
||||||
|
public void RemoveManifestEntriesAsync(HashSet<Hash128> entries)
|
||||||
|
{
|
||||||
|
_fileWriterWorkerQueue.Add(new CacheFileOperationTask
|
||||||
|
{
|
||||||
|
Type = CacheFileOperation.RemoveManifestEntries,
|
||||||
|
Data = entries
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove given entries from the manifest.
|
/// Remove given entries from the manifest.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entries">Entries to remove from the manifest</param>
|
/// <param name="entries">Entries to remove from the manifest</param>
|
||||||
public void RemoveManifestEntries(HashSet<Hash128> entries)
|
private void RemoveManifestEntries(HashSet<Hash128> entries)
|
||||||
{
|
{
|
||||||
lock (_hashTable)
|
lock (_hashTable)
|
||||||
{
|
{
|
||||||
|
@ -488,6 +506,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
|
||||||
case CacheFileOperation.SaveManifest:
|
case CacheFileOperation.SaveManifest:
|
||||||
SaveManifest();
|
SaveManifest();
|
||||||
break;
|
break;
|
||||||
|
case CacheFileOperation.RemoveManifestEntries:
|
||||||
|
RemoveManifestEntries((HashSet<Hash128>)task.Data);
|
||||||
|
break;
|
||||||
case CacheFileOperation.FlushToArchive:
|
case CacheFileOperation.FlushToArchive:
|
||||||
FlushToArchive();
|
FlushToArchive();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -58,8 +58,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
|
||||||
/// <param name="entries">Entries to remove from the manifest of all caches</param>
|
/// <param name="entries">Entries to remove from the manifest of all caches</param>
|
||||||
public void RemoveManifestEntries(HashSet<Hash128> entries)
|
public void RemoveManifestEntries(HashSet<Hash128> entries)
|
||||||
{
|
{
|
||||||
_guestProgramCache.RemoveManifestEntries(entries);
|
_guestProgramCache.RemoveManifestEntriesAsync(entries);
|
||||||
_hostProgramCache.RemoveManifestEntries(entries);
|
_hostProgramCache.RemoveManifestEntriesAsync(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue