aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-11-22 20:51:51 -0300
committerGitHub <noreply@github.com>2023-11-23 00:51:51 +0100
commit21cd4c0c00e4a06e399c93419c8f9eff0e663bfb (patch)
tree77ae9bb6df2d406ff2ec5fb886c8b12d7655809f
parent70d65d3d8e77e66226ebab7f23d9b6e8c271319f (diff)
Extend bindless elimination to see through shuffle (#5958)1.1.1093
* Extend bindless elimination to see through shuffle * Shader cache version bump
-rw-r--r--src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs2
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
index 403e039a..125ab899 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
private const ushort FileFormatVersionMajor = 1;
private const ushort FileFormatVersionMinor = 2;
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
- private const uint CodeGenVersion = 5957;
+ private const uint CodeGenVersion = 5958;
private const string SharedTocFileName = "shared.toc";
private const string SharedDataFileName = "shared.data";
diff --git a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs
index c955f5b5..6706053e 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs
@@ -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.