diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-08 17:29:41 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 769c02235f489f02b1791e6e76dc8b3ab18028ee (patch) | |
| tree | ef0a2ffc5030360d5cef78e7c67e131e44348d50 /Ryujinx.Graphics.Shader/Decoders | |
| parent | 1e8bc29f32cde08616175f8f87405dfa7b8c4025 (diff) | |
Add ATOMS, LDS, POPC, RED, STS and VOTE shader instructions, start changing the way how global memory is handled
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/AtomicOp.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/IOpCodeAlu.cs | 5 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/IOpCodePredicate39.cs | 9 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/OpCodeAtom.cs | 39 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/OpCodeRed.cs | 32 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs | 8 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/OpCodeVote.cs | 26 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/ReductionType.cs | 12 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/SystemRegister.cs | 8 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/VoteOp.cs | 9 |
10 files changed, 158 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/AtomicOp.cs b/Ryujinx.Graphics.Shader/Decoders/AtomicOp.cs new file mode 100644 index 00000000..065a57c4 --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/AtomicOp.cs @@ -0,0 +1,15 @@ +namespace Ryujinx.Graphics.Shader.Decoders +{ + enum AtomicOp + { + Add = 0, + Minimum = 1, + Maximum = 2, + Increment = 3, + Decrement = 4, + BitwiseAnd = 5, + BitwiseOr = 6, + BitwiseExclusiveOr = 7, + Swap = 8 + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/IOpCodeAlu.cs b/Ryujinx.Graphics.Shader/Decoders/IOpCodeAlu.cs index d840d49d..6d1382a8 100644 --- a/Ryujinx.Graphics.Shader/Decoders/IOpCodeAlu.cs +++ b/Ryujinx.Graphics.Shader/Decoders/IOpCodeAlu.cs @@ -1,10 +1,7 @@ namespace Ryujinx.Graphics.Shader.Decoders { - interface IOpCodeAlu : IOpCodeRd, IOpCodeRa + interface IOpCodeAlu : IOpCodeRd, IOpCodeRa, IOpCodePredicate39 { - Register Predicate39 { get; } - - bool InvertP { get; } bool Extended { get; } bool SetCondCode { get; } bool Saturate { get; } diff --git a/Ryujinx.Graphics.Shader/Decoders/IOpCodePredicate39.cs b/Ryujinx.Graphics.Shader/Decoders/IOpCodePredicate39.cs new file mode 100644 index 00000000..74e7aff1 --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/IOpCodePredicate39.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.Graphics.Shader.Decoders +{ + interface IOpCodePredicate39 + { + Register Predicate39 { get; } + + bool InvertP { get; } + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeAtom.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeAtom.cs new file mode 100644 index 00000000..b572703e --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeAtom.cs @@ -0,0 +1,39 @@ +using Ryujinx.Graphics.Shader.Instructions; + +namespace Ryujinx.Graphics.Shader.Decoders +{ + class OpCodeAtom : OpCode, IOpCodeRd, IOpCodeRa, IOpCodeReg + { + public Register Rd { get; } + public Register Ra { get; } + public Register Rb { get; } + + public ReductionType Type { get; } + + public int Offset { get; } + + public bool Extended { get; } + + public AtomicOp AtomicOp { get; } + + public OpCodeAtom(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode) + { + Rd = new Register(opCode.Extract(0, 8), RegisterType.Gpr); + Ra = new Register(opCode.Extract(8, 8), RegisterType.Gpr); + Rb = new Register(opCode.Extract(20, 8), RegisterType.Gpr); + + Type = (ReductionType)opCode.Extract(28, 2); + + if (Type == ReductionType.FP32FtzRn) + { + Type = ReductionType.S64; + } + + Offset = opCode.Extract(30, 22); + + Extended = opCode.Extract(48); + + AtomicOp = (AtomicOp)opCode.Extract(52, 4); + } + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeRed.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeRed.cs new file mode 100644 index 00000000..8fde82a2 --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeRed.cs @@ -0,0 +1,32 @@ +using Ryujinx.Graphics.Shader.Instructions; + +namespace Ryujinx.Graphics.Shader.Decoders +{ + class OpCodeRed : OpCode, IOpCodeRd, IOpCodeRa + { + public Register Rd { get; } + public Register Ra { get; } + + public AtomicOp AtomicOp { get; } + + public ReductionType Type { get; } + + public int Offset { get; } + + public bool Extended { get; } + + public OpCodeRed(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode) + { + Rd = new Register(opCode.Extract(0, 8), RegisterType.Gpr); + Ra = new Register(opCode.Extract(8, 8), RegisterType.Gpr); + + Type = (ReductionType)opCode.Extract(20, 3); + + AtomicOp = (AtomicOp)opCode.Extract(23, 3); + + Offset = opCode.Extract(28, 20); + + Extended = opCode.Extract(48); + } + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs index 7adaff61..58bd2b88 100644 --- a/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs +++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs @@ -32,6 +32,7 @@ namespace Ryujinx.Graphics.Shader.Decoders #region Instructions Set("1110111111011x", InstEmit.Ald, typeof(OpCodeAttribute)); Set("1110111111110x", InstEmit.Ast, typeof(OpCodeAttribute)); + Set("11101100xxxxxx", InstEmit.Atoms, typeof(OpCodeAtom)); Set("0100110000000x", InstEmit.Bfe, typeof(OpCodeAluCbuf)); Set("0011100x00000x", InstEmit.Bfe, typeof(OpCodeAluImm)); Set("0101110000000x", InstEmit.Bfe, typeof(OpCodeAluReg)); @@ -122,6 +123,7 @@ namespace Ryujinx.Graphics.Shader.Decoders Set("1110111101000x", InstEmit.Ld, typeof(OpCodeMemory)); Set("1110111110010x", InstEmit.Ldc, typeof(OpCodeLdc)); Set("1110111011010x", InstEmit.Ldg, typeof(OpCodeMemory)); + Set("1110111101001x", InstEmit.Lds, typeof(OpCodeMemory)); Set("0100110001000x", InstEmit.Lop, typeof(OpCodeLopCbuf)); Set("0011100001000x", InstEmit.Lop, typeof(OpCodeLopImm)); Set("000001xxxxxxxx", InstEmit.Lop, typeof(OpCodeLopImm32)); @@ -136,7 +138,11 @@ namespace Ryujinx.Graphics.Shader.Decoders Set("0101000010000x", InstEmit.Mufu, typeof(OpCodeFArith)); Set("1111101111100x", InstEmit.Out, typeof(OpCode)); Set("111000101010xx", InstEmit.Pbk, typeof(OpCodeSsy)); + Set("0100110000001x", InstEmit.Popc, typeof(OpCodeAluCbuf)); + Set("0011100x00001x", InstEmit.Popc, typeof(OpCodeAluImm)); + Set("0101110000001x", InstEmit.Popc, typeof(OpCodeAluReg)); Set("0101000010010x", InstEmit.Psetp, typeof(OpCodePsetp)); + Set("1110101111111x", InstEmit.Red, typeof(OpCodeRed)); Set("0100110010010x", InstEmit.Rro, typeof(OpCodeFArithCbuf)); Set("0011100x10010x", InstEmit.Rro, typeof(OpCodeFArithImm)); Set("0101110010010x", InstEmit.Rro, typeof(OpCodeFArithReg)); @@ -154,6 +160,7 @@ namespace Ryujinx.Graphics.Shader.Decoders Set("111000101001xx", InstEmit.Ssy, typeof(OpCodeSsy)); Set("1110111101010x", InstEmit.St, typeof(OpCodeMemory)); Set("1110111011011x", InstEmit.Stg, typeof(OpCodeMemory)); + Set("1110111101011x", InstEmit.Sts, typeof(OpCodeMemory)); Set("11101011001xxx", InstEmit.Sust, typeof(OpCodeImage)); Set("1111000011111x", InstEmit.Sync, typeof(OpCodeSync)); Set("110000xxxx111x", InstEmit.Tex, typeof(OpCodeTex)); @@ -168,6 +175,7 @@ namespace Ryujinx.Graphics.Shader.Decoders Set("1101111101001x", InstEmit.Txq, typeof(OpCodeTex)); Set("1101111101010x", InstEmit.TxqB, typeof(OpCodeTex)); Set("01011111xxxxxx", InstEmit.Vmad, typeof(OpCodeVideo)); + Set("0101000011011x", InstEmit.Vote, typeof(OpCodeVote)); Set("0100111xxxxxxx", InstEmit.Xmad, typeof(OpCodeAluCbuf)); Set("0011011x00xxxx", InstEmit.Xmad, typeof(OpCodeAluImm)); Set("010100010xxxxx", InstEmit.Xmad, typeof(OpCodeAluRegCbuf)); diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeVote.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeVote.cs new file mode 100644 index 00000000..374767bd --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeVote.cs @@ -0,0 +1,26 @@ +using Ryujinx.Graphics.Shader.Instructions; + +namespace Ryujinx.Graphics.Shader.Decoders +{ + class OpCodeVote : OpCode, IOpCodeRd, IOpCodePredicate39 + { + public Register Rd { get; } + public Register Predicate39 { get; } + public Register Predicate45 { get; } + + public VoteOp VoteOp { get; } + + public bool InvertP { get; } + + public OpCodeVote(InstEmitter emitter, ulong address, long opCode) : base(emitter, address, opCode) + { + Rd = new Register(opCode.Extract(0, 8), RegisterType.Gpr); + Predicate39 = new Register(opCode.Extract(39, 3), RegisterType.Predicate); + Predicate45 = new Register(opCode.Extract(45, 3), RegisterType.Predicate); + + InvertP = opCode.Extract(42); + + VoteOp = (VoteOp)opCode.Extract(48, 2); + } + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/ReductionType.cs b/Ryujinx.Graphics.Shader/Decoders/ReductionType.cs new file mode 100644 index 00000000..aaa2186e --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/ReductionType.cs @@ -0,0 +1,12 @@ +namespace Ryujinx.Graphics.Shader.Decoders +{ + enum ReductionType + { + U32 = 0, + S32 = 1, + U64 = 2, + FP32FtzRn = 3, + U128 = 4, + S64 = 5 + } +}
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/SystemRegister.cs b/Ryujinx.Graphics.Shader/Decoders/SystemRegister.cs index 2f3f4492..45ef3782 100644 --- a/Ryujinx.Graphics.Shader/Decoders/SystemRegister.cs +++ b/Ryujinx.Graphics.Shader/Decoders/SystemRegister.cs @@ -2,6 +2,7 @@ namespace Ryujinx.Graphics.Shader.Decoders { enum SystemRegister { + LaneId = 0, YDirection = 0x12, ThreadId = 0x20, ThreadIdX = 0x21, @@ -9,6 +10,11 @@ namespace Ryujinx.Graphics.Shader.Decoders ThreadIdZ = 0x23, CtaIdX = 0x25, CtaIdY = 0x26, - CtaIdZ = 0x27 + CtaIdZ = 0x27, + EqMask = 0x38, + LtMask = 0x39, + LeMask = 0x3a, + GtMask = 0x3b, + GeMask = 0x3c } }
\ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Decoders/VoteOp.cs b/Ryujinx.Graphics.Shader/Decoders/VoteOp.cs new file mode 100644 index 00000000..2fe937c8 --- /dev/null +++ b/Ryujinx.Graphics.Shader/Decoders/VoteOp.cs @@ -0,0 +1,9 @@ +namespace Ryujinx.Graphics.Shader.Decoders +{ + enum VoteOp + { + All = 0, + Any = 1, + AllEqual = 2 + } +}
\ No newline at end of file |
