aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-05-17 15:25:42 -0300
committergdkchan <gab.dark.100@gmail.com>2018-05-17 15:25:42 -0300
commitb19c4740823ed8fcebf62bf5741a7614a2ac0aa0 (patch)
tree8cdede3fdb90aa35ffe50c004559b80d4704bea3 /Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
parent9b9ead94cd2f25a85468ecf91b7898bf34e10825 (diff)
Added more shader instructions, including BFE, BRA (partial), FMNMX, ISCADD, SHL, LD_C, some shader related fixes, added support for texture component selection
Diffstat (limited to 'Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs')
-rw-r--r--Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs20
1 files changed, 17 insertions, 3 deletions
diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
index e44d5b7d..4958dfcf 100644
--- a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
+++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
@@ -2,14 +2,21 @@ namespace Ryujinx.Graphics.Gal.Shader
{
static class ShaderDecoder
{
+ private const bool AddDbgComments = true;
+
public static ShaderIrBlock DecodeBasicBlock(int[] Code, int Offset)
{
ShaderIrBlock Block = new ShaderIrBlock();
while (Offset + 2 <= Code.Length)
{
- //Ignore scheduling instructions, which are
- //written every 32 bytes.
+ int InstPos = Offset * 4;
+
+ Block.Position = InstPos;
+
+ Block.MarkLabel(InstPos);
+
+ //Ignore scheduling instructions, which are written every 32 bytes.
if ((Offset & 7) == 0)
{
Offset += 2;
@@ -24,6 +31,13 @@ namespace Ryujinx.Graphics.Gal.Shader
ShaderDecodeFunc Decode = ShaderOpCodeTable.GetDecoder(OpCode);
+ if (AddDbgComments)
+ {
+ string DbgOpCode = $"0x{InstPos:x8}: 0x{OpCode:x16} ";
+
+ Block.AddNode(new ShaderIrCmnt(DbgOpCode + (Decode?.Method.Name ?? "???")));
+ }
+
if (Decode == null)
{
continue;
@@ -31,7 +45,7 @@ namespace Ryujinx.Graphics.Gal.Shader
Decode(Block, OpCode);
- if (Block.GetLastNode() is ShaderIrOp Op && IsFlowChange(Op.Inst))
+ if (Block.GetLastNode() is ShaderIrOp Op && Op.Inst == ShaderIrInst.Exit)
{
break;
}