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.Vertex, _currentState.VertexTextures, _currentState.VertexSamplers);
|
||||||
SetTextureAndSampler(renderCommandEncoder, ShaderStage.Fragment, _currentState.FragmentTextures, _currentState.FragmentSamplers);
|
SetTextureAndSampler(renderCommandEncoder, ShaderStage.Fragment, _currentState.FragmentTextures, _currentState.FragmentSamplers);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
renderPassDescriptor.Dispose();
|
||||||
|
|
||||||
return renderCommandEncoder;
|
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)
|
if (_currentState.VertexFunction != null)
|
||||||
{
|
{
|
||||||
renderPipelineDescriptor.VertexFunction = _currentState.VertexFunction.Value;
|
renderPipelineDescriptor.VertexFunction = _currentState.VertexFunction.Value;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_currentState.FragmentFunction != null)
|
if (_currentState.FragmentFunction != null)
|
||||||
{
|
{
|
||||||
|
@ -242,6 +242,10 @@ namespace Ryujinx.Graphics.Metal
|
||||||
_currentState.BlendColor.Green,
|
_currentState.BlendColor.Green,
|
||||||
_currentState.BlendColor.Blue,
|
_currentState.BlendColor.Blue,
|
||||||
_currentState.BlendColor.Alpha);
|
_currentState.BlendColor.Alpha);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
renderPipelineDescriptor.Dispose();
|
||||||
|
vertexDescriptor.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateIndexBuffer(BufferRange buffer, IndexType type)
|
public void UpdateIndexBuffer(BufferRange buffer, IndexType type)
|
||||||
|
@ -320,7 +324,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
// Inlineable
|
// Inlineable
|
||||||
public void UpdateStencilState(StencilTestDescriptor stencilTest)
|
public void UpdateStencilState(StencilTestDescriptor stencilTest)
|
||||||
{
|
{
|
||||||
_currentState.BackFaceStencil = new MTLStencilDescriptor
|
var backFace = new MTLStencilDescriptor
|
||||||
{
|
{
|
||||||
StencilFailureOperation = stencilTest.BackSFail.Convert(),
|
StencilFailureOperation = stencilTest.BackSFail.Convert(),
|
||||||
DepthFailureOperation = stencilTest.BackDpFail.Convert(),
|
DepthFailureOperation = stencilTest.BackDpFail.Convert(),
|
||||||
|
@ -329,8 +333,9 @@ namespace Ryujinx.Graphics.Metal
|
||||||
ReadMask = (uint)stencilTest.BackFuncMask,
|
ReadMask = (uint)stencilTest.BackFuncMask,
|
||||||
WriteMask = (uint)stencilTest.BackMask
|
WriteMask = (uint)stencilTest.BackMask
|
||||||
};
|
};
|
||||||
|
_currentState.BackFaceStencil = backFace;
|
||||||
|
|
||||||
_currentState.FrontFaceStencil = new MTLStencilDescriptor
|
var frontFace = new MTLStencilDescriptor
|
||||||
{
|
{
|
||||||
StencilFailureOperation = stencilTest.FrontSFail.Convert(),
|
StencilFailureOperation = stencilTest.FrontSFail.Convert(),
|
||||||
DepthFailureOperation = stencilTest.FrontDpFail.Convert(),
|
DepthFailureOperation = stencilTest.FrontDpFail.Convert(),
|
||||||
|
@ -339,6 +344,7 @@ namespace Ryujinx.Graphics.Metal
|
||||||
ReadMask = (uint)stencilTest.FrontFuncMask,
|
ReadMask = (uint)stencilTest.FrontFuncMask,
|
||||||
WriteMask = (uint)stencilTest.FrontMask
|
WriteMask = (uint)stencilTest.FrontMask
|
||||||
};
|
};
|
||||||
|
_currentState.FrontFaceStencil = frontFace;
|
||||||
|
|
||||||
_currentState.StencilTestEnabled = stencilTest.TestEnable;
|
_currentState.StencilTestEnabled = stencilTest.TestEnable;
|
||||||
|
|
||||||
|
@ -358,6 +364,11 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
// Mark dirty
|
// Mark dirty
|
||||||
_currentState.Dirty.DepthStencil = true;
|
_currentState.Dirty.DepthStencil = true;
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
descriptor.Dispose();
|
||||||
|
frontFace.Dispose();
|
||||||
|
backFace.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inlineable
|
// Inlineable
|
||||||
|
@ -382,6 +393,9 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
// Mark dirty
|
// Mark dirty
|
||||||
_currentState.Dirty.DepthStencil = true;
|
_currentState.Dirty.DepthStencil = true;
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
descriptor.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inlineable
|
// Inlineable
|
||||||
|
|
Loading…
Reference in a new issue