namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
{
///
/// Result of a shader cache load operation.
///
enum DiskCacheLoadResult
{
///
/// No error.
///
Success,
///
/// File can't be accessed.
///
NoAccess,
///
/// The constant buffer 1 data length is too low for the translation of the guest shader.
///
InvalidCb1DataLength,
///
/// The cache is missing the length of a texture array used by the shader.
///
MissingTextureArrayLength,
///
/// The cache is missing the descriptor of a texture used by the shader.
///
MissingTextureDescriptor,
///
/// File is corrupted.
///
FileCorruptedGeneric,
///
/// File is corrupted, detected by magic value check.
///
FileCorruptedInvalidMagic,
///
/// File is corrupted, detected by length check.
///
FileCorruptedInvalidLength,
///
/// File might be valid, but is incompatible with the current emulator version.
///
IncompatibleVersion,
}
static class DiskCacheLoadResultExtensions
{
///
/// Gets an error message from a result code.
///
/// Result code
/// Error message
public static string GetMessage(this DiskCacheLoadResult result)
{
return result switch
{
DiskCacheLoadResult.Success => "No error.",
DiskCacheLoadResult.NoAccess => "Could not access the cache file.",
DiskCacheLoadResult.InvalidCb1DataLength => "Constant buffer 1 data length is too low.",
DiskCacheLoadResult.MissingTextureArrayLength => "Texture array length missing from the cache file.",
DiskCacheLoadResult.MissingTextureDescriptor => "Texture descriptor missing from the cache file.",
DiskCacheLoadResult.FileCorruptedGeneric => "The cache file is corrupted.",
DiskCacheLoadResult.FileCorruptedInvalidMagic => "Magic check failed, the cache file is corrupted.",
DiskCacheLoadResult.FileCorruptedInvalidLength => "Length check failed, the cache file is corrupted.",
DiskCacheLoadResult.IncompatibleVersion => "The version of the disk cache is not compatible with this version of the emulator.",
_ => "Unknown error.",
};
}
}
}