aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Decoders
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-14 14:51:00 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit2eccc7023ae0d1247378516b14507d422e4915c5 (patch)
tree8ae9a8905394717347a775997ae0347483a9b0d8 /Ryujinx.Graphics.Shader/Decoders
parent1a550e810c71670e5a2f032ec136fb2f5f57ac9c (diff)
Partial support for shader memory barriers
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders')
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs10
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/BarrierMode.cs12
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/OpCodeBarrier.cs14
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/OpCodeMemoryBarrier.cs14
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs2
5 files changed, 52 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs b/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs
new file mode 100644
index 00000000..2d99dcfe
--- /dev/null
+++ b/Ryujinx.Graphics.Shader/Decoders/BarrierLevel.cs
@@ -0,0 +1,10 @@
+namespace Ryujinx.Graphics.Shader.Decoders
+{
+ enum BarrierLevel
+ {
+ Cta = 0,
+ Gl = 1,
+ Sys = 2,
+ Vc = 3
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/Decoders/BarrierMode.cs b/Ryujinx.Graphics.Shader/Decoders/BarrierMode.cs
new file mode 100644
index 00000000..a058cbbd
--- /dev/null
+++ b/Ryujinx.Graphics.Shader/Decoders/BarrierMode.cs
@@ -0,0 +1,12 @@
+namespace Ryujinx.Graphics.Shader.Decoders
+{
+ enum BarrierMode
+ {
+ ReductionPopCount = 2,
+ Scan = 3,
+ ReductionAnd = 0xa,
+ ReductionOr = 0x12,
+ Sync = 0x80,
+ Arrive = 0x81
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeBarrier.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeBarrier.cs
new file mode 100644
index 00000000..81e28aa1
--- /dev/null
+++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeBarrier.cs
@@ -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);
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeMemoryBarrier.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeMemoryBarrier.cs
new file mode 100644
index 00000000..c31fe87b
--- /dev/null
+++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeMemoryBarrier.cs
@@ -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);
+ }
+ }
+} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs b/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs
index bdc7ed80..87f1de0c 100644
--- a/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs
+++ b/Ryujinx.Graphics.Shader/Decoders/OpCodeTable.cs
@@ -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));