WIP V2: Experimental: Metal backend #441

Merged
GreemDev merged 369 commits from new-metal into master 2024-12-24 06:55:16 +00:00
Showing only changes of commit 881ab59177 - Show all commits

View File

@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Metal
private readonly DepthStencilCache _depthStencilCache;
private EncoderState _currentState = new();
private List<EncoderState> _backStates = new();
private readonly Stack<EncoderState> _backStates = [];
public readonly MTLBuffer IndexBuffer => _currentState.IndexBuffer;
public readonly MTLIndexType IndexType => _currentState.IndexType;
@ -44,17 +44,16 @@ namespace Ryujinx.Graphics.Metal
_depthStencilCache.Dispose();
}
public void SaveState()
public readonly void SaveState()
{
_backStates.Add(_currentState);
_backStates.Push(_currentState);
}
public void RestoreState()
{
if (_backStates.Count > 0)
{
_currentState = _backStates[_backStates.Count - 1];
_backStates.RemoveAt(_backStates.Count - 1);
_currentState = _backStates.Pop();
// Set all the inline state, since it might have changed
var renderCommandEncoder = _pipeline.GetOrCreateRenderEncoder();