From c8c4fd730d8f61a673cf8074a255b269deae519e Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Thu, 27 Jun 2024 22:51:12 +0100 Subject: [PATCH] CommandBufferBarrier --- src/Ryujinx.Graphics.Metal/Pipeline.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index 588037272..39361f710 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -285,14 +285,10 @@ namespace Ryujinx.Graphics.Metal { var computeCommandEncoder = GetOrCreateComputeEncoder(); - // TODO: Should there be a barrier on render targets? - var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures; + var scope = MTLBarrierScope.Buffers | MTLBarrierScope.Textures | MTLBarrierScope.RenderTargets;; computeCommandEncoder.MemoryBarrier(scope); break; } - default: - Logger.Warning?.Print(LogClass.Gpu, "Barrier called outside of a render or compute pass"); - break; } } @@ -344,7 +340,7 @@ namespace Ryujinx.Graphics.Metal public void CommandBufferBarrier() { - Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!"); + Barrier(); } public void CopyBuffer(BufferHandle src, BufferHandle dst, int srcOffset, int dstOffset, int size) @@ -701,9 +697,12 @@ namespace Ryujinx.Graphics.Metal public void TextureBarrier() { - var renderCommandEncoder = GetOrCreateRenderEncoder(); + if (CurrentEncoderType == EncoderType.Render) + { + var renderCommandEncoder = GetOrCreateRenderEncoder(); - renderCommandEncoder.MemoryBarrier(MTLBarrierScope.Textures, MTLRenderStages.RenderStageFragment, MTLRenderStages.RenderStageFragment); + renderCommandEncoder.MemoryBarrier(MTLBarrierScope.Textures, MTLRenderStages.RenderStageFragment, MTLRenderStages.RenderStageFragment); + } } public void TextureBarrierTiled()