From aae9dc0c2e410a3b04ec1f29dc788ac0a0b45389 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Wed, 29 May 2024 23:10:00 +0100 Subject: [PATCH] Cleanup --- src/Ryujinx.Graphics.Metal/MetalRenderer.cs | 5 --- src/Ryujinx.Graphics.Metal/Pipeline.cs | 37 +++++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index 0a4123621..56b554134 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -54,11 +54,6 @@ namespace Ryujinx.Graphics.Metal Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); } - public BufferHandle CreateBuffer(int size, BufferAccess access, BufferHandle storageHint) - { - return CreateBuffer(size, access); - } - public BufferHandle CreateBuffer(IntPtr pointer, int size) { var buffer = _device.NewBuffer(pointer, (ulong)size, MTLResourceOptions.ResourceStorageModeShared); diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index c00c1d09b..9d6aab7a6 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -205,26 +205,29 @@ namespace Ryujinx.Graphics.Metal public void Barrier() { - - if (_currentEncoderType == EncoderType.Render) + switch (_currentEncoderType) { - var renderCommandEncoder = GetOrCreateRenderEncoder(); + case EncoderType.Render: + { + var renderCommandEncoder = GetOrCreateRenderEncoder(); - var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures | MTLBarrierScope.RenderTargets; - MTLRenderStages stages = MTLRenderStages.RenderStageVertex | MTLRenderStages.RenderStageFragment; - renderCommandEncoder.MemoryBarrier(scope, stages, stages); - } - else if (_currentEncoderType == EncoderType.Compute) - { - var computeCommandEncoder = GetOrCreateComputeEncoder(); + var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures | MTLBarrierScope.RenderTargets; + MTLRenderStages stages = MTLRenderStages.RenderStageVertex | MTLRenderStages.RenderStageFragment; + renderCommandEncoder.MemoryBarrier(scope, stages, stages); + break; + } + case EncoderType.Compute: + { + var computeCommandEncoder = GetOrCreateComputeEncoder(); - // TODO: Should there be a barrier on render targets? - var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures; - computeCommandEncoder.MemoryBarrier(scope); - } - else - { - Logger.Warning?.Print(LogClass.Gpu, "Barrier called outside of a render or compute pass"); + // TODO: Should there be a barrier on render targets? + var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures; + computeCommandEncoder.MemoryBarrier(scope); + break; + } + default: + Logger.Warning?.Print(LogClass.Gpu, "Barrier called outside of a render or compute pass"); + break; } }