From 2eccc7023ae0d1247378516b14507d422e4915c5 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 14 Dec 2019 14:51:00 -0300 Subject: Partial support for shader memory barriers --- .../Instructions/InstEmitMemory.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Ryujinx.Graphics.Shader/Instructions') diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs index 56688161..866df56d 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs @@ -77,6 +77,17 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), res); } + public static void Bar(EmitterContext context) + { + OpCodeBarrier op = (OpCodeBarrier)context.CurrOp; + + // TODO: Support other modes. + if (op.Mode == BarrierMode.Sync) + { + context.Barrier(); + } + } + public static void Ipa(EmitterContext context) { OpCodeIpa op = (OpCodeIpa)context.CurrOp; @@ -162,6 +173,20 @@ namespace Ryujinx.Graphics.Shader.Instructions EmitLoad(context, MemoryRegion.Shared); } + public static void Membar(EmitterContext context) + { + OpCodeMemoryBarrier op = (OpCodeMemoryBarrier)context.CurrOp; + + if (op.Level == BarrierLevel.Cta) + { + context.GroupMemoryBarrier(); + } + else + { + context.MemoryBarrier(); + } + } + public static void Out(EmitterContext context) { OpCode op = context.CurrOp; -- cgit v1.2.3