diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-01-31 09:43:24 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-31 09:43:24 -0300 |
| commit | e10ff17e2d87b818d340947367d2d1a4276a0d06 (patch) | |
| tree | 3b07aa92c5d8acff81d43ddb1ded48c4c7917b72 /Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs | |
| parent | c81abdde4c48c607669580ef769776623b86dcc7 (diff) | |
Initial support for shader half float instructions (#507)
Diffstat (limited to 'Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs index 3af17cae..6531138e 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecodeOpCode.cs @@ -75,6 +75,49 @@ namespace Ryujinx.Graphics.Gal.Shader return new ShaderIrOperGpr(OpCode.Read(28, 0xff)); } + private static ShaderIrOperGpr[] GprHalfVec8(this long OpCode) + { + return GetGprHalfVec2(OpCode.Read(8, 0xff), OpCode.Read(47, 3)); + } + + private static ShaderIrOperGpr[] GprHalfVec20(this long OpCode) + { + return GetGprHalfVec2(OpCode.Read(20, 0xff), OpCode.Read(28, 3)); + } + + private static ShaderIrOperGpr[] GetGprHalfVec2(int Gpr, int Mask) + { + if (Mask == 1) + { + //This value is used for FP32, the whole 32-bits register + //is used as each element on the vector. + return new ShaderIrOperGpr[] + { + new ShaderIrOperGpr(Gpr), + new ShaderIrOperGpr(Gpr) + }; + } + + ShaderIrOperGpr Low = new ShaderIrOperGpr(Gpr, 0); + ShaderIrOperGpr High = new ShaderIrOperGpr(Gpr, 1); + + return new ShaderIrOperGpr[] + { + (Mask & 1) != 0 ? High : Low, + (Mask & 2) != 0 ? High : Low + }; + } + + private static ShaderIrOperGpr GprHalf0(this long OpCode, int HalfPart) + { + return new ShaderIrOperGpr(OpCode.Read(0, 0xff), HalfPart); + } + + private static ShaderIrOperGpr GprHalf28(this long OpCode, int HalfPart) + { + return new ShaderIrOperGpr(OpCode.Read(28, 0xff), HalfPart); + } + private static ShaderIrOperImm Imm5_39(this long OpCode) { return new ShaderIrOperImm(OpCode.Read(39, 0x1f)); |
