diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-05-22 22:43:31 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-22 22:43:31 -0300 |
| commit | 79e007036383b11cd53c2563fbb7f139a02c90ec (patch) | |
| tree | c7ddfc097282b98afd16f08cc5042636f9283224 /Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs | |
| parent | 84996ccd36a5fa13892c1f02acb1c79031c35aa5 (diff) | |
Improve shader sending method to GAL, use a memory interface instead of reading a fixed array size and sending every time
Diffstat (limited to 'Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs index 4958dfcf..024fa364 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs @@ -4,28 +4,28 @@ namespace Ryujinx.Graphics.Gal.Shader { private const bool AddDbgComments = true; - public static ShaderIrBlock DecodeBasicBlock(int[] Code, int Offset) + public static ShaderIrBlock DecodeBasicBlock(IGalMemory Memory, long Position) { ShaderIrBlock Block = new ShaderIrBlock(); - while (Offset + 2 <= Code.Length) + while (true) { - int InstPos = Offset * 4; + Block.Position = Position; - Block.Position = InstPos; - - Block.MarkLabel(InstPos); + Block.MarkLabel(Position); //Ignore scheduling instructions, which are written every 32 bytes. - if ((Offset & 7) == 0) + if ((Position & 0x1f) == 0) { - Offset += 2; + Position += 8; continue; } - uint Word0 = (uint)Code[Offset++]; - uint Word1 = (uint)Code[Offset++]; + uint Word0 = (uint)Memory.ReadInt32(Position + 0); + uint Word1 = (uint)Memory.ReadInt32(Position + 4); + + Position += 8; long OpCode = Word0 | (long)Word1 << 32; @@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Gal.Shader if (AddDbgComments) { - string DbgOpCode = $"0x{InstPos:x8}: 0x{OpCode:x16} "; + string DbgOpCode = $"0x{Position:x16}: 0x{OpCode:x16} "; Block.AddNode(new ShaderIrCmnt(DbgOpCode + (Decode?.Method.Name ?? "???"))); } |
