mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-27 02:53:04 +00:00
dispose all objects in encoder state manager
This commit is contained in:
parent
c26df1f7a3
commit
7654f0b16c
1 changed files with 21 additions and 7 deletions
|
@ -143,6 +143,9 @@ namespace Ryujinx.Graphics.Metal
|
|||
SetTextureAndSampler(renderCommandEncoder, ShaderStage.Vertex, _currentState.VertexTextures, _currentState.VertexSamplers);
|
||||
SetTextureAndSampler(renderCommandEncoder, ShaderStage.Fragment, _currentState.FragmentTextures, _currentState.FragmentSamplers);
|
||||
|
||||
// Cleanup
|
||||
renderPassDescriptor.Dispose();
|
||||
|
||||
return renderCommandEncoder;
|
||||
}
|
||||
|
||||
|
@ -217,16 +220,13 @@ namespace Ryujinx.Graphics.Metal
|
|||
}
|
||||
}
|
||||
|
||||
renderPipelineDescriptor.VertexDescriptor = BuildVertexDescriptor(_currentState.VertexBuffers, _currentState.VertexAttribs);
|
||||
var vertexDescriptor = BuildVertexDescriptor(_currentState.VertexBuffers, _currentState.VertexAttribs);
|
||||
renderPipelineDescriptor.VertexDescriptor = vertexDescriptor;
|
||||
|
||||
if (_currentState.VertexFunction != null)
|
||||
{
|
||||
renderPipelineDescriptor.VertexFunction = _currentState.VertexFunction.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentState.FragmentFunction != null)
|
||||
{
|
||||
|
@ -242,6 +242,10 @@ namespace Ryujinx.Graphics.Metal
|
|||
_currentState.BlendColor.Green,
|
||||
_currentState.BlendColor.Blue,
|
||||
_currentState.BlendColor.Alpha);
|
||||
|
||||
// Cleanup
|
||||
renderPipelineDescriptor.Dispose();
|
||||
vertexDescriptor.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateIndexBuffer(BufferRange buffer, IndexType type)
|
||||
|
@ -320,7 +324,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
// Inlineable
|
||||
public void UpdateStencilState(StencilTestDescriptor stencilTest)
|
||||
{
|
||||
_currentState.BackFaceStencil = new MTLStencilDescriptor
|
||||
var backFace = new MTLStencilDescriptor
|
||||
{
|
||||
StencilFailureOperation = stencilTest.BackSFail.Convert(),
|
||||
DepthFailureOperation = stencilTest.BackDpFail.Convert(),
|
||||
|
@ -329,8 +333,9 @@ namespace Ryujinx.Graphics.Metal
|
|||
ReadMask = (uint)stencilTest.BackFuncMask,
|
||||
WriteMask = (uint)stencilTest.BackMask
|
||||
};
|
||||
_currentState.BackFaceStencil = backFace;
|
||||
|
||||
_currentState.FrontFaceStencil = new MTLStencilDescriptor
|
||||
var frontFace = new MTLStencilDescriptor
|
||||
{
|
||||
StencilFailureOperation = stencilTest.FrontSFail.Convert(),
|
||||
DepthFailureOperation = stencilTest.FrontDpFail.Convert(),
|
||||
|
@ -339,6 +344,7 @@ namespace Ryujinx.Graphics.Metal
|
|||
ReadMask = (uint)stencilTest.FrontFuncMask,
|
||||
WriteMask = (uint)stencilTest.FrontMask
|
||||
};
|
||||
_currentState.FrontFaceStencil = frontFace;
|
||||
|
||||
_currentState.StencilTestEnabled = stencilTest.TestEnable;
|
||||
|
||||
|
@ -358,6 +364,11 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
// Mark dirty
|
||||
_currentState.Dirty.DepthStencil = true;
|
||||
|
||||
// Cleanup
|
||||
descriptor.Dispose();
|
||||
frontFace.Dispose();
|
||||
backFace.Dispose();
|
||||
}
|
||||
|
||||
// Inlineable
|
||||
|
@ -382,6 +393,9 @@ namespace Ryujinx.Graphics.Metal
|
|||
|
||||
// Mark dirty
|
||||
_currentState.Dirty.DepthStencil = true;
|
||||
|
||||
// Cleanup
|
||||
descriptor.Dispose();
|
||||
}
|
||||
|
||||
// Inlineable
|
||||
|
|
Loading…
Reference in a new issue