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 b1e5262893 - Show all commits

View File

@ -21,6 +21,7 @@ namespace Ryujinx.Graphics.Metal
private readonly BufferManager _bufferManager;
private readonly DepthStencilCache _depthStencilCache;
private readonly MTLDepthStencilState _defaultState;
private readonly EncoderState _mainState = new();
private EncoderState _currentState;
@ -44,6 +45,8 @@ namespace Ryujinx.Graphics.Metal
_depthStencilCache = new(device);
_currentState = _mainState;
_defaultState = _depthStencilCache.GetOrCreate(_currentState.DepthStencilUid);
// Zero buffer
byte[] zeros = new byte[ZeroBufferSize];
fixed (byte* ptr = zeros)
@ -951,11 +954,18 @@ namespace Ryujinx.Graphics.Metal
}
private readonly void SetDepthStencilState(MTLRenderCommandEncoder renderCommandEncoder)
{
if (DepthStencil != null)
{
MTLDepthStencilState state = _depthStencilCache.GetOrCreate(_currentState.DepthStencilUid);
renderCommandEncoder.SetDepthStencilState(state);
}
else
{
renderCommandEncoder.SetDepthStencilState(_defaultState);
}
}
private readonly void SetDepthClamp(MTLRenderCommandEncoder renderCommandEncoder)
{