aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-13 03:02:07 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1876b346fea647e8284a66bb6d62c38801035cff (patch)
tree6eeff094298cda84d1613dc5ec0691e51d7b35f1 /Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
parentf617fb542a0e3d36012d77a4b5acbde7b08902f2 (diff)
Initial work
Diffstat (limited to 'Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs')
-rw-r--r--Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs101
1 files changed, 0 insertions, 101 deletions
diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
deleted file mode 100644
index c60f393e..00000000
--- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
-{
- class Operation : INode
- {
- public Instruction Inst { get; private set; }
-
- private Operand _dest;
-
- public Operand Dest
- {
- get => _dest;
- set => _dest = AssignDest(value);
- }
-
- private Operand[] _sources;
-
- public int SourcesCount => _sources.Length;
-
- public int ComponentIndex { get; }
-
- public Operation(Instruction inst, Operand dest, params Operand[] sources)
- {
- Inst = inst;
- Dest = dest;
-
- // The array may be modified externally, so we store a copy.
- _sources = (Operand[])sources.Clone();
-
- for (int index = 0; index < _sources.Length; index++)
- {
- Operand source = _sources[index];
-
- if (source.Type == OperandType.LocalVariable)
- {
- source.UseOps.Add(this);
- }
- }
- }
-
- public Operation(
- Instruction inst,
- int compIndex,
- Operand dest,
- params Operand[] sources) : this(inst, dest, sources)
- {
- ComponentIndex = compIndex;
- }
-
- private Operand AssignDest(Operand dest)
- {
- if (dest != null && dest.Type == OperandType.LocalVariable)
- {
- dest.AsgOp = this;
- }
-
- return dest;
- }
-
- public Operand GetSource(int index)
- {
- return _sources[index];
- }
-
- public void SetSource(int index, Operand source)
- {
- Operand oldSrc = _sources[index];
-
- if (oldSrc != null && oldSrc.Type == OperandType.LocalVariable)
- {
- oldSrc.UseOps.Remove(this);
- }
-
- if (source.Type == OperandType.LocalVariable)
- {
- source.UseOps.Add(this);
- }
-
- _sources[index] = source;
- }
-
- public void TurnIntoCopy(Operand source)
- {
- Inst = Instruction.Copy;
-
- foreach (Operand oldSrc in _sources)
- {
- if (oldSrc.Type == OperandType.LocalVariable)
- {
- oldSrc.UseOps.Remove(this);
- }
- }
-
- if (source.Type == OperandType.LocalVariable)
- {
- source.UseOps.Add(this);
- }
-
- _sources = new Operand[] { source };
- }
- }
-} \ No newline at end of file