Depth Bias
This commit is contained in:
parent
e97c9bc959
commit
9a6759d1e5
3 changed files with 27 additions and 1 deletions
|
@ -79,6 +79,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
// Set all the inline state, since it might have changed
|
||||
var renderCommandEncoder = _pipeline.GetOrCreateRenderEncoder();
|
||||
SetDepthClamp(renderCommandEncoder);
|
||||
SetDepthBias(renderCommandEncoder);
|
||||
SetScissors(renderCommandEncoder);
|
||||
SetViewports(renderCommandEncoder);
|
||||
SetVertexBuffers(renderCommandEncoder, _currentState.VertexBuffers);
|
||||
|
@ -165,6 +166,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
// Rebind all the state
|
||||
SetDepthClamp(renderCommandEncoder);
|
||||
SetDepthBias(renderCommandEncoder);
|
||||
SetCullMode(renderCommandEncoder);
|
||||
SetFrontFace(renderCommandEncoder);
|
||||
SetStencilRefValue(renderCommandEncoder);
|
||||
|
@ -561,6 +563,21 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
// Inlineable
|
||||
public void UpdateDepthBias(float depthBias, float slopeScale, float clamp)
|
||||
{
|
||||
_currentState.DepthBias = depthBias;
|
||||
_currentState.SlopeScale = slopeScale;
|
||||
_currentState.Clamp = clamp;
|
||||
|
||||
// Inline update
|
||||
if (_pipeline.CurrentEncoderType == EncoderType.Render && _pipeline.CurrentEncoder != null)
|
||||
{
|
||||
var renderCommandEncoder = new MTLRenderCommandEncoder(_pipeline.CurrentEncoder.Value);
|
||||
SetDepthBias(renderCommandEncoder);
|
||||
}
|
||||
}
|
||||
|
||||
// Inlineable
|
||||
public void UpdateScissors(ReadOnlySpan<Rectangle<int>> regions)
|
||||
{
|
||||
|
@ -839,6 +856,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
renderCommandEncoder.SetDepthClipMode(_currentState.DepthClipMode);
|
||||
}
|
||||
|
||||
private readonly void SetDepthBias(MTLRenderCommandEncoder renderCommandEncoder)
|
||||
{
|
||||
renderCommandEncoder.SetDepthBias(_currentState.DepthBias, _currentState.SlopeScale, _currentState.Clamp);
|
||||
}
|
||||
|
||||
private unsafe void SetScissors(MTLRenderCommandEncoder renderCommandEncoder)
|
||||
{
|
||||
if (_currentState.Scissors.Length > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue