Extend bindless elimination to see through shuffle (#5958)

* Extend bindless elimination to see through shuffle

* Shader cache version bump
This commit is contained in:
gdkchan 2023-11-22 20:51:51 -03:00 committed by GitHub
parent 70d65d3d8e
commit 21cd4c0c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -29,7 +29,16 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
if (texOp.Inst == Instruction.TextureSample || texOp.Inst.IsTextureQuery())
{
Operand bindlessHandle = Utils.FindLastOperation(texOp.GetSource(0), block);
Operand bindlessHandle = texOp.GetSource(0);
// In some cases the compiler uses a shuffle operation to get the handle,
// for some textureGrad implementations. In those cases, we can skip the shuffle.
if (bindlessHandle.AsgOp is Operation shuffleOp && shuffleOp.Inst == Instruction.Shuffle)
{
bindlessHandle = shuffleOp.GetSource(0);
}
bindlessHandle = Utils.FindLastOperation(bindlessHandle, block);
// Some instructions do not encode an accurate sampler type:
// - Most instructions uses the same type for 1D and Buffer.