Fix Scott Pilgrim (#15)

* check for null vertex functions

* format

* Format

---------

Co-authored-by: Isaac Marovitz <isaacryu@icloud.com>
This commit is contained in:
SamoZ256 2024-05-25 19:46:51 +02:00 committed by Isaac Marovitz
parent f837be962f
commit 5f6d375b00
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
1 changed files with 28 additions and 19 deletions

View File

@ -227,29 +227,38 @@ namespace Ryujinx.Graphics.Metal
var vertexDescriptor = BuildVertexDescriptor(_currentState.VertexBuffers, _currentState.VertexAttribs);
renderPipelineDescriptor.VertexDescriptor = vertexDescriptor;
if (_currentState.VertexFunction != null)
try
{
renderPipelineDescriptor.VertexFunction = _currentState.VertexFunction.Value;
}
if (_currentState.VertexFunction != null)
{
renderPipelineDescriptor.VertexFunction = _currentState.VertexFunction.Value;
}
else
{
return;
}
if (_currentState.FragmentFunction != null)
if (_currentState.FragmentFunction != null)
{
renderPipelineDescriptor.FragmentFunction = _currentState.FragmentFunction.Value;
}
var pipelineState = _renderPipelineCache.GetOrCreate(renderPipelineDescriptor);
renderCommandEncoder.SetRenderPipelineState(pipelineState);
renderCommandEncoder.SetBlendColor(
_currentState.BlendColor.Red,
_currentState.BlendColor.Green,
_currentState.BlendColor.Blue,
_currentState.BlendColor.Alpha);
}
finally
{
renderPipelineDescriptor.FragmentFunction = _currentState.FragmentFunction.Value;
// Cleanup
renderPipelineDescriptor.Dispose();
vertexDescriptor.Dispose();
}
var pipelineState = _renderPipelineCache.GetOrCreate(renderPipelineDescriptor);
renderCommandEncoder.SetRenderPipelineState(pipelineState);
renderCommandEncoder.SetBlendColor(
_currentState.BlendColor.Red,
_currentState.BlendColor.Green,
_currentState.BlendColor.Blue,
_currentState.BlendColor.Alpha);
// Cleanup
renderPipelineDescriptor.Dispose();
vertexDescriptor.Dispose();
}
public void UpdateIndexBuffer(BufferRange buffer, IndexType type)