/ src / Ryujinx.Graphics.Shader / Instructions / InstEmitBarrier.cs
InstEmitBarrier.cs
 1  using Ryujinx.Graphics.Shader.Decoders;
 2  using Ryujinx.Graphics.Shader.Translation;
 3  
 4  namespace Ryujinx.Graphics.Shader.Instructions
 5  {
 6      static partial class InstEmit
 7      {
 8          public static void Bar(EmitterContext context)
 9          {
10              InstBar op = context.GetOp<InstBar>();
11  
12              // TODO: Support other modes.
13              if (op.BarOp == BarOp.Sync)
14              {
15                  context.Barrier();
16              }
17              else
18              {
19                  context.TranslatorContext.GpuAccessor.Log($"Invalid barrier mode: {op.BarOp}.");
20              }
21          }
22  
23          public static void Depbar(EmitterContext context)
24          {
25  #pragma warning disable IDE0059 // Remove unnecessary value assignment
26              InstDepbar op = context.GetOp<InstDepbar>();
27  #pragma warning restore IDE0059
28  
29              // No operation.
30          }
31  
32          public static void Membar(EmitterContext context)
33          {
34              InstMembar op = context.GetOp<InstMembar>();
35  
36              if (op.Membar == Decoders.Membar.Cta)
37              {
38                  context.GroupMemoryBarrier();
39              }
40              else
41              {
42                  context.MemoryBarrier();
43              }
44          }
45      }
46  }