mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 11:03:04 +00:00
Cleanup
This commit is contained in:
parent
7983bc062b
commit
684e025d61
2 changed files with 95 additions and 91 deletions
|
@ -16,6 +16,12 @@ namespace Ryujinx.Graphics.Metal
|
|||
Pipeline = true;
|
||||
DepthStencil = true;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Pipeline = false;
|
||||
DepthStencil = false;
|
||||
}
|
||||
}
|
||||
|
||||
[SupportedOSPlatform("macos")]
|
||||
|
|
|
@ -43,9 +43,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
public MTLRenderCommandEncoder CreateRenderCommandEncoder()
|
||||
{
|
||||
// Initialise Pass & State
|
||||
|
||||
var renderPassDescriptor = new MTLRenderPassDescriptor();
|
||||
var renderPipelineDescriptor = new MTLRenderPipelineDescriptor();
|
||||
|
||||
for (int i = 0; i < EncoderState.MaxColorAttachments; i++)
|
||||
{
|
||||
|
@ -95,7 +93,6 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
|
||||
// Initialise Encoder
|
||||
|
||||
var renderCommandEncoder = _pipeline.CommandBuffer.RenderCommandEncoder(renderPassDescriptor);
|
||||
|
||||
// Mark all state as dirty to ensure it is set on the encoder
|
||||
|
@ -117,16 +114,21 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
|
||||
public void RebindState(MTLRenderCommandEncoder renderCommandEncoder)
|
||||
{
|
||||
if (_currentState.Dirty.Pipeline)
|
||||
{
|
||||
SetPipelineState(renderCommandEncoder);
|
||||
SetDepthStencilState(renderCommandEncoder);
|
||||
}
|
||||
|
||||
_currentState.Dirty = new();
|
||||
if (_currentState.Dirty.DepthStencil)
|
||||
{
|
||||
SetDepthStencilState(renderCommandEncoder);
|
||||
}
|
||||
|
||||
_currentState.Dirty.Clear();
|
||||
}
|
||||
|
||||
private void SetPipelineState(MTLRenderCommandEncoder renderCommandEncoder) {
|
||||
if (_currentState.Dirty.Pipeline)
|
||||
{
|
||||
var renderPipelineDescriptor = new MTLRenderPipelineDescriptor();
|
||||
|
||||
for (int i = 0; i < EncoderState.MaxColorAttachments; i++)
|
||||
|
@ -211,7 +213,6 @@ namespace Ryujinx.Graphics.Metal
|
|||
_currentState.BlendColor.Blue,
|
||||
_currentState.BlendColor.Alpha);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateIndexBuffer(BufferRange buffer, IndexType type)
|
||||
{
|
||||
|
@ -550,15 +551,12 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
|
||||
private void SetDepthStencilState(MTLRenderCommandEncoder renderCommandEncoder)
|
||||
{
|
||||
if (_currentState.Dirty.DepthStencil)
|
||||
{
|
||||
if (_currentState.DepthStencilState != null)
|
||||
{
|
||||
renderCommandEncoder.SetDepthStencilState(_currentState.DepthStencilState.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDepthClamp(MTLRenderCommandEncoder renderCommandEncoder)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue