Partial support for shader memory barriers

This commit is contained in:
gdkchan 2019-12-14 14:51:00 -03:00 committed by Thog
parent 1a550e810c
commit 2eccc7023a
9 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,10 @@
namespace Ryujinx.Graphics.Shader.Decoders
{
enum BarrierLevel
{
Cta = 0,
Gl = 1,
Sys = 2,
Vc = 3
}
}

View file

@ -0,0 +1,12 @@
namespace Ryujinx.Graphics.Shader.Decoders
{
enum BarrierMode
{
ReductionPopCount = 2,
Scan = 3,
ReductionAnd = 0xa,
ReductionOr = 0x12,
Sync = 0x80,
Arrive = 0x81
}
}

View file

@ -0,0 +1,14 @@
using Ryujinx.Graphics.Shader.Instructions;
namespace Ryujinx.Graphics.Shader.Decoders
{
class OpCodeBarrier : OpCode
{
public BarrierMode Mode { get; }
public OpCodeBarrier(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
{
Mode = (BarrierMode)((opCode >> 32) & 0x9b);
}
}
}

View file

@ -0,0 +1,14 @@
using Ryujinx.Graphics.Shader.Instructions;
namespace Ryujinx.Graphics.Shader.Decoders
{
class OpCodeMemoryBarrier : OpCode
{
public BarrierLevel Level { get; }
public OpCodeMemoryBarrier(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode)
{
Level = (BarrierLevel)opCode.Extract(8, 2);
}
}
}

View file

@ -33,6 +33,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
Set("1110111111011x", InstEmit.Ald, typeof(OpCodeAttribute));
Set("1110111111110x", InstEmit.Ast, typeof(OpCodeAttribute));
Set("11101100xxxxxx", InstEmit.Atoms, typeof(OpCodeAtom));
Set("1111000010101x", InstEmit.Bar, typeof(OpCodeBarrier));
Set("0100110000000x", InstEmit.Bfe, typeof(OpCodeAluCbuf));
Set("0011100x00000x", InstEmit.Bfe, typeof(OpCodeAluImm));
Set("0101110000000x", InstEmit.Bfe, typeof(OpCodeAluReg));
@ -140,6 +141,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
Set("0010000xxxxxxx", InstEmit.Lop3, typeof(OpCodeLopCbuf));
Set("001111xxxxxxxx", InstEmit.Lop3, typeof(OpCodeLopImm));
Set("0101101111100x", InstEmit.Lop3, typeof(OpCodeLopReg));
Set("1110111110011x", InstEmit.Membar, typeof(OpCodeMemoryBarrier));
Set("0100110010011x", InstEmit.Mov, typeof(OpCodeAluCbuf));
Set("0011100x10011x", InstEmit.Mov, typeof(OpCodeAluImm));
Set("000000010000xx", InstEmit.Mov, typeof(OpCodeAluImm32));