salieri: Fix missing guest GPU accessor missing on hashes (#1759)

This adds the guest GPU accessor to hashes computation.
As this change all the hashes from the cache, I added some migration
logic.

This is required for #1755.
This commit is contained in:
Mary 2020-12-01 22:48:31 +01:00 committed by GitHub
parent 5e6dc37aed
commit f6d88558b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 672 additions and 322 deletions

View file

@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
/// <summary>
/// Version of the guest cache shader (to increment when guest cache structure change).
/// </summary>
private const ulong GuestCacheVersion = 1717;
private const ulong GuestCacheVersion = 1759;
/// <summary>
/// Create a new cache manager instance
@ -45,7 +45,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
_hashType = hashType;
_shaderProvider = shaderProvider;
string baseCacheDirectory = Path.Combine(AppDataManager.GamesDirPath, titleId, "cache", "shader");
string baseCacheDirectory = CacheHelper.GetBaseCacheDirectory(titleId);
CacheMigration.Run(baseCacheDirectory, graphicsApi, hashType, shaderProvider);
_guestProgramCache = new CacheCollection(baseCacheDirectory, _hashType, CacheGraphicsApi.Guest, "", "program", GuestCacheVersion);
_hostProgramCache = new CacheCollection(baseCacheDirectory, _hashType, _graphicsApi, _shaderProvider, "host", shaderCodeGenVersion);
@ -80,16 +82,6 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
_hostProgramCache.Synchronize();
}
/// <summary>
/// Computes the hash of some data using the current cache hashing algorithm.
/// </summary>
/// <param name="data">Some data to generate a hash for.</param>
/// <returns>The hash of some data using the current hashing algorithm of the cache</returns>
public Hash128 ComputeHash(ReadOnlySpan<byte> data)
{
return XXHash128.ComputeHash(data);
}
/// <summary>
/// Save a shader program not present in the program cache.
/// </summary>