Update disk cache code generation version and use HashSet for processed pipelines
Use a hashset to compare against all generated pipelines vs only against the most recent one.
This commit is contained in:
parent
7cc334b894
commit
6216566166
2 changed files with 10 additions and 9 deletions
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
private const ushort FileFormatVersionMajor = 1;
|
||||
private const ushort FileFormatVersionMinor = 2;
|
||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||
private const uint CodeGenVersion = 7332;
|
||||
private const uint CodeGenVersion = 6877;
|
||||
|
||||
private const string SharedTocFileName = "shared.toc";
|
||||
private const string SharedDataFileName = "shared.data";
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
private readonly CancellationToken _cancellationToken;
|
||||
private readonly Action<ShaderCacheState, int, int> _stateChangeCallback;
|
||||
|
||||
private readonly HashSet<ProgramPipelineState> _pipelineStateSet = new();
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the cache should be loaded.
|
||||
/// </summary>
|
||||
|
@ -302,7 +304,6 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
using var streams = _hostStorage.GetOutputStreams(_context);
|
||||
|
||||
int packagedShaders = 0;
|
||||
ProgramPipelineState previousPipelineState = default;
|
||||
ProgramPipelineState currentPipelineState = default;
|
||||
|
||||
foreach (var kv in _programList)
|
||||
|
@ -333,7 +334,6 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
currentPipelineState.PrimitiveRestartEnable = false;
|
||||
currentPipelineState.BiasEnable = 0;
|
||||
currentPipelineState.RasterizerDiscard = false;
|
||||
|
||||
}
|
||||
|
||||
if (_context.Capabilities.SupportsLogicOpDynamicState)
|
||||
|
@ -347,19 +347,20 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||
}
|
||||
}
|
||||
|
||||
if (!currentPipelineState.Equals(previousPipelineState) || !_context.Capabilities.SupportsExtendedDynamicState || !program.SpecializationState.PipelineState.HasValue)
|
||||
if (!_pipelineStateSet.Contains(currentPipelineState) ||
|
||||
!_context.Capabilities.SupportsExtendedDynamicState ||
|
||||
!program.SpecializationState.PipelineState.HasValue)
|
||||
{
|
||||
_hostStorage.AddShader(_context, program, binaryCode, streams);
|
||||
|
||||
_stateChangeCallback(ShaderCacheState.Packaging, ++packagedShaders, _programList.Count);
|
||||
}
|
||||
|
||||
if (_context.Capabilities.SupportsExtendedDynamicState)
|
||||
{
|
||||
previousPipelineState = currentPipelineState;
|
||||
_pipelineStateSet.Add(currentPipelineState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.Gpu, $"Rebuilt {packagedShaders} shaders successfully.");
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue