diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-02-14 07:29:58 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-14 11:29:58 +0100 |
| commit | 9e4f668f6cc59d47847472410228850fe5528daa (patch) | |
| tree | d12fe46d8b70636a0cf767550c0f0e485a19f7ef | |
| parent | 5a9dba0756e3173e3983cad3626e8e876b3c3041 (diff) | |
Update bindless to indexed conversion code pattern match (#938)
* Update bindless to indexed conversion code pattern match
* Correct index shift
| -rw-r--r-- | Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToIndexed.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToIndexed.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToIndexed.cs index 83f8fe9a..41f42dad 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToIndexed.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessToIndexed.cs @@ -45,7 +45,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations continue; } - if (!(ldcSrc1.AsgOp is Operation addOp)) + if (!(ldcSrc1.AsgOp is Operation shrOp) || shrOp.Inst != Instruction.ShiftRightU32) + { + continue; + } + + if (!(shrOp.GetSource(0).AsgOp is Operation addOp) || addOp.Inst != Instruction.Add) { continue; } @@ -57,15 +62,15 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations continue; } - texOp.TurnIntoIndexed(addSrc1.Value); + texOp.TurnIntoIndexed(addSrc1.Value / 4); Operand index = Local(); Operand source = addOp.GetSource(0); - Operation shrBy1 = new Operation(Instruction.ShiftRightU32, index, source, Const(1)); + Operation shrBy3 = new Operation(Instruction.ShiftRightU32, index, source, Const(3)); - block.Operations.AddBefore(node, shrBy1); + block.Operations.AddBefore(node, shrBy3); texOp.SetSource(0, index); } |
