mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 10:33:05 +00:00
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 FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
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 SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||||
private readonly CancellationToken _cancellationToken;
|
private readonly CancellationToken _cancellationToken;
|
||||||
private readonly Action<ShaderCacheState, int, int> _stateChangeCallback;
|
private readonly Action<ShaderCacheState, int, int> _stateChangeCallback;
|
||||||
|
|
||||||
|
private readonly HashSet<ProgramPipelineState> _pipelineStateSet = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if the cache should be loaded.
|
/// Indicates if the cache should be loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -302,7 +304,6 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||||
using var streams = _hostStorage.GetOutputStreams(_context);
|
using var streams = _hostStorage.GetOutputStreams(_context);
|
||||||
|
|
||||||
int packagedShaders = 0;
|
int packagedShaders = 0;
|
||||||
ProgramPipelineState previousPipelineState = default;
|
|
||||||
ProgramPipelineState currentPipelineState = default;
|
ProgramPipelineState currentPipelineState = default;
|
||||||
|
|
||||||
foreach (var kv in _programList)
|
foreach (var kv in _programList)
|
||||||
|
@ -333,7 +334,6 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||||
currentPipelineState.PrimitiveRestartEnable = false;
|
currentPipelineState.PrimitiveRestartEnable = false;
|
||||||
currentPipelineState.BiasEnable = 0;
|
currentPipelineState.BiasEnable = 0;
|
||||||
currentPipelineState.RasterizerDiscard = false;
|
currentPipelineState.RasterizerDiscard = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_context.Capabilities.SupportsLogicOpDynamicState)
|
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);
|
_hostStorage.AddShader(_context, program, binaryCode, streams);
|
||||||
|
|
||||||
_stateChangeCallback(ShaderCacheState.Packaging, ++packagedShaders, _programList.Count);
|
_stateChangeCallback(ShaderCacheState.Packaging, ++packagedShaders, _programList.Count);
|
||||||
}
|
|
||||||
|
|
||||||
if (_context.Capabilities.SupportsExtendedDynamicState)
|
if (_context.Capabilities.SupportsExtendedDynamicState)
|
||||||
{
|
{
|
||||||
previousPipelineState = currentPipelineState;
|
_pipelineStateSet.Add(currentPipelineState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Gpu, $"Rebuilt {packagedShaders} shaders successfully.");
|
Logger.Info?.Print(LogClass.Gpu, $"Rebuilt {packagedShaders} shaders successfully.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue