1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-24 04:56:02 +00:00

Update bindless to indexed conversion code pattern match (#938)

* Update bindless to indexed conversion code pattern match

* Correct index shift
This commit is contained in:
gdkchan 2020-02-14 07:29:58 -03:00 committed by GitHub
parent 5a9dba0756
commit 9e4f668f6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
continue; 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; continue;
} }
@ -57,15 +62,15 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
continue; continue;
} }
texOp.TurnIntoIndexed(addSrc1.Value); texOp.TurnIntoIndexed(addSrc1.Value / 4);
Operand index = Local(); Operand index = Local();
Operand source = addOp.GetSource(0); 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); texOp.SetSource(0, index);
} }