aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-10-12 17:35:31 -0300
committerGitHub <noreply@github.com>2021-10-12 22:35:31 +0200
commita7109c767bdc014327b574012794156c92174495 (patch)
treed7d7db6eaa63d4e3e0396a3182d0267b6ad31dd7 /Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs
parent0510fde25ae66ec0b55091746a52931248d75b89 (diff)
Rewrite shader decoding stage (#2698)
* Rewrite shader decoding stage * Fix P2R constant buffer encoding * Fix PSET/PSETP * PR feedback * Log unimplemented shader instructions * Implement NOP * Remove using * PR feedback
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs74
1 files changed, 0 insertions, 74 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs b/Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs
deleted file mode 100644
index 3585c35f..00000000
--- a/Ryujinx.Graphics.Shader/Decoders/DecoderHelper.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System;
-
-namespace Ryujinx.Graphics.Shader.Decoders
-{
- static class DecoderHelper
- {
- public static int DecodeS20Immediate(long opCode)
- {
- int imm = opCode.Extract(20, 19);
-
- bool sign = opCode.Extract(56);
-
- if (sign)
- {
- imm = (imm << 13) >> 13;
- }
-
- return imm;
- }
-
- public static int Decode2xF10Immediate(long opCode)
- {
- int immH0 = opCode.Extract(20, 9);
- int immH1 = opCode.Extract(30, 9);
-
- bool negateH0 = opCode.Extract(29);
- bool negateH1 = opCode.Extract(56);
-
- if (negateH0)
- {
- immH0 |= 1 << 9;
- }
-
- if (negateH1)
- {
- immH1 |= 1 << 9;
- }
-
- return immH1 << 22 | immH0 << 6;
- }
-
- public static float DecodeF20Immediate(long opCode)
- {
- int imm = opCode.Extract(20, 19);
-
- bool negate = opCode.Extract(56);
-
- imm <<= 12;
-
- if (negate)
- {
- imm |= 1 << 31;
- }
-
- return BitConverter.Int32BitsToSingle(imm);
- }
-
- public static float DecodeD20Immediate(long opCode)
- {
- long imm = opCode.Extract(20, 19);
-
- bool negate = opCode.Extract(56);
-
- imm <<= 44;
-
- if (negate)
- {
- imm |= 1L << 63;
- }
-
- return (float)BitConverter.Int64BitsToDouble(imm);
- }
- }
-} \ No newline at end of file