aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/IntermediateRepresentation
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-11-08 17:29:41 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit769c02235f489f02b1791e6e76dc8b3ab18028ee (patch)
treeef0a2ffc5030360d5cef78e7c67e131e44348d50 /Ryujinx.Graphics.Shader/IntermediateRepresentation
parent1e8bc29f32cde08616175f8f87405dfa7b8c4025 (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/IntermediateRepresentation')
-rw-r--r--Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs50
-rw-r--r--Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs6
2 files changed, 52 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs
index 46c6b57f..d99e3f2b 100644
--- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs
+++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs
@@ -7,6 +7,17 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
Absolute = 1,
Add,
+ AtomicAdd,
+ AtomicAnd,
+ AtomicCompareAndSwap,
+ AtomicMinS32,
+ AtomicMinU32,
+ AtomicMaxS32,
+ AtomicMaxU32,
+ AtomicOr,
+ AtomicSwap,
+ AtomicXor,
+ Ballot,
BitCount,
BitfieldExtractS32,
BitfieldExtractU32,
@@ -57,6 +68,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
LoadConstant,
LoadGlobal,
LoadLocal,
+ LoadShared,
LoadStorage,
LogarithmB2,
LogicalAnd,
@@ -88,6 +100,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
SquareRoot,
StoreGlobal,
StoreLocal,
+ StoreShared,
StoreStorage,
Subtract,
SwizzleAdd,
@@ -96,9 +109,44 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
Truncate,
UnpackDouble2x32,
UnpackHalf2x16,
+ VoteAll,
+ VoteAllEqual,
+ VoteAny,
Count,
- FP = 1 << 16,
+
+ FP = 1 << 16,
+
+ MrShift = 17,
+
+ MrGlobal = 0 << MrShift,
+ MrShared = 1 << MrShift,
+ MrStorage = 2 << MrShift,
+ MrMask = 3 << MrShift,
+
Mask = 0xffff
}
+
+ static class InstructionExtensions
+ {
+ public static bool IsAtomic(this Instruction inst)
+ {
+ switch (inst & Instruction.Mask)
+ {
+ case Instruction.AtomicAdd:
+ case Instruction.AtomicAnd:
+ case Instruction.AtomicCompareAndSwap:
+ case Instruction.AtomicMaxS32:
+ case Instruction.AtomicMaxU32:
+ case Instruction.AtomicMinS32:
+ case Instruction.AtomicMinU32:
+ case Instruction.AtomicOr:
+ case Instruction.AtomicSwap:
+ case Instruction.AtomicXor:
+ return true;
+ }
+
+ return false;
+ }
+ }
} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs
index 0d7379a8..6b7fb82f 100644
--- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs
+++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs
@@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
public int SourcesCount => _sources.Length;
- public int ComponentIndex { get; }
+ public int Index { get; }
public Operation(Instruction inst, Operand dest, params Operand[] sources)
{
@@ -39,11 +39,11 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
public Operation(
Instruction inst,
- int compIndex,
+ int index,
Operand dest,
params Operand[] sources) : this(inst, dest, sources)
{
- ComponentIndex = compIndex;
+ Index = index;
}
private Operand AssignDest(Operand dest)