0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 04:35:46 +00:00

Implement SetDepthClamp

This commit is contained in:
Isaac Marovitz 2024-05-18 21:29:46 -04:00 committed by Isaac Marovitz
parent f98d9bae24
commit 20e1d1cd33
3 changed files with 21 additions and 1 deletions

View file

@ -29,6 +29,7 @@ namespace Ryujinx.Graphics.Metal
public MTLDepthStencilState? DepthStencilState = null; public MTLDepthStencilState? DepthStencilState = null;
public MTLDepthClipMode DepthClipMode = MTLDepthClipMode.Clip;
public MTLCompareFunction DepthCompareFunction = MTLCompareFunction.Always; public MTLCompareFunction DepthCompareFunction = MTLCompareFunction.Always;
public bool DepthWriteEnabled = false; public bool DepthWriteEnabled = false;

View file

@ -153,6 +153,7 @@ namespace Ryujinx.Graphics.Metal
_currentState.BlendColor.Alpha); _currentState.BlendColor.Alpha);
SetDepthStencilState(renderCommandEncoder, _currentState.DepthStencilState); SetDepthStencilState(renderCommandEncoder, _currentState.DepthStencilState);
SetDepthClamp(renderCommandEncoder, _currentState.DepthClipMode);
SetScissors(renderCommandEncoder, _currentState.Scissors); SetScissors(renderCommandEncoder, _currentState.Scissors);
SetViewports(renderCommandEncoder, _currentState.Viewports); SetViewports(renderCommandEncoder, _currentState.Viewports);
SetBuffers(renderCommandEncoder, _currentState.VertexBuffers); SetBuffers(renderCommandEncoder, _currentState.VertexBuffers);
@ -341,6 +342,19 @@ namespace Ryujinx.Graphics.Metal
} }
} }
// Inlineable
public void UpdateDepthClamp(bool clamp)
{
_currentState.DepthClipMode = clamp ? MTLDepthClipMode.Clamp : MTLDepthClipMode.Clip;
// Inline Update
if (_pipeline.CurrentEncoderType == EncoderType.Render && _pipeline.CurrentEncoder != null)
{
var renderCommandEncoder = new MTLRenderCommandEncoder(_pipeline.CurrentEncoder.Value);
}
}
// Inlineable // Inlineable
public void UpdateScissors(ReadOnlySpan<Rectangle<int>> regions) public void UpdateScissors(ReadOnlySpan<Rectangle<int>> regions)
{ {
@ -552,6 +566,11 @@ namespace Ryujinx.Graphics.Metal
} }
} }
private static void SetDepthClamp(MTLRenderCommandEncoder renderCommandEncoder, MTLDepthClipMode depthClipMode)
{
renderCommandEncoder.SetDepthClipMode(depthClipMode);
}
private unsafe static void SetScissors(MTLRenderCommandEncoder renderCommandEncoder, MTLScissorRect[] scissors) private unsafe static void SetScissors(MTLRenderCommandEncoder renderCommandEncoder, MTLScissorRect[] scissors)
{ {
if (scissors.Length > 0) if (scissors.Length > 0)

View file

@ -321,7 +321,7 @@ namespace Ryujinx.Graphics.Metal
public void SetDepthClamp(bool clamp) public void SetDepthClamp(bool clamp)
{ {
Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); _encoderStateManager.UpdateDepthClamp(clamp);
} }
public void SetDepthMode(DepthMode mode) public void SetDepthMode(DepthMode mode)