Remove RenderPipelineDescriptorResult

This commit is contained in:
Isaac Marovitz 2024-08-13 23:18:57 +01:00
parent 363c4a80ff
commit 3bd4dc7f2b
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
1 changed files with 4 additions and 22 deletions

View File

@ -103,24 +103,6 @@ namespace Ryujinx.Graphics.Metal
// Advanced blend not supported // Advanced blend not supported
private struct RenderPipelineDescriptorResult : IDisposable
{
public MTLRenderPipelineDescriptor Pipeline;
private MTLVertexDescriptor _vertex;
public RenderPipelineDescriptorResult(MTLRenderPipelineDescriptor pipeline, MTLVertexDescriptor vertex)
{
Pipeline = pipeline;
_vertex = vertex;
}
public void Dispose()
{
Pipeline.Dispose();
_vertex.Dispose();
}
}
private readonly void BuildColorAttachment(MTLRenderPipelineColorAttachmentDescriptor descriptor, ColorBlendStateUid blendState) private readonly void BuildColorAttachment(MTLRenderPipelineColorAttachmentDescriptor descriptor, ColorBlendStateUid blendState)
{ {
descriptor.PixelFormat = blendState.PixelFormat; descriptor.PixelFormat = blendState.PixelFormat;
@ -162,7 +144,7 @@ namespace Ryujinx.Graphics.Metal
return vertexDescriptor; return vertexDescriptor;
} }
private RenderPipelineDescriptorResult CreateRenderDescriptor(Program program) private MTLRenderPipelineDescriptor CreateRenderDescriptor(Program program)
{ {
var renderPipelineDescriptor = new MTLRenderPipelineDescriptor(); var renderPipelineDescriptor = new MTLRenderPipelineDescriptor();
@ -223,7 +205,7 @@ namespace Ryujinx.Graphics.Metal
renderPipelineDescriptor.FragmentFunction = program.FragmentFunction; renderPipelineDescriptor.FragmentFunction = program.FragmentFunction;
} }
return new RenderPipelineDescriptorResult(renderPipelineDescriptor, vertexDescriptor); return renderPipelineDescriptor;
} }
public MTLRenderPipelineState CreateRenderPipeline(MTLDevice device, Program program) public MTLRenderPipelineState CreateRenderPipeline(MTLDevice device, Program program)
@ -233,10 +215,10 @@ namespace Ryujinx.Graphics.Metal
return pipelineState; return pipelineState;
} }
using RenderPipelineDescriptorResult descriptors = CreateRenderDescriptor(program); using var descriptor = CreateRenderDescriptor(program);
var error = new NSError(IntPtr.Zero); var error = new NSError(IntPtr.Zero);
pipelineState = device.NewRenderPipelineState(descriptors.Pipeline, ref error); pipelineState = device.NewRenderPipelineState(descriptor, ref error);
if (error != IntPtr.Zero) if (error != IntPtr.Zero)
{ {
Logger.Error?.PrintMsg(LogClass.Gpu, $"Failed to create Render Pipeline State: {StringHelper.String(error.LocalizedDescription)}"); Logger.Error?.PrintMsg(LogClass.Gpu, $"Failed to create Render Pipeline State: {StringHelper.String(error.LocalizedDescription)}");