diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-11-08 12:57:28 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-08 12:57:28 -0300 |
| commit | 3dee712164e635fd3a0d2e9d359a7d11a80bf675 (patch) | |
| tree | 0c3cfbdb03ed7ce27740eea9008f6472b7787df4 | |
| parent | b7a1544e8b4e538272c491a746bdd19ec188a0c3 (diff) | |
Fix bindless/global memory elimination with inverted predicates (#2826)
* Fix bindless/global memory elimination with inverted predicates
* Shader cache version bump
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 67a397b3..4e1e130c 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -40,7 +40,7 @@ namespace Ryujinx.Graphics.Gpu.Shader /// <summary> /// Version of the codegen (to be changed when codegen or guest format change). /// </summary> - private const ulong ShaderCodeGenVersion = 2822; + private const ulong ShaderCodeGenVersion = 2826; // Progress reporting helpers private volatile int _shaderCount; diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs index 83ff8c40..4ca6d687 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs @@ -10,11 +10,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { if (sourceBlock.Operations.Count > 0) { - Operation lastOp = sourceBlock.Operations.Last.Value as Operation; - - if (lastOp != null && - ((sourceBlock.Next == block && lastOp.Inst == Instruction.BranchIfFalse) || - (sourceBlock.Branch == block && lastOp.Inst == Instruction.BranchIfTrue))) + if (sourceBlock.GetLastOp() is Operation lastOp && IsConditionalBranch(lastOp.Inst) && sourceBlock.Next == block) { return lastOp; } @@ -24,6 +20,11 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations return null; } + private static bool IsConditionalBranch(Instruction inst) + { + return inst == Instruction.BranchIfFalse || inst == Instruction.BranchIfTrue; + } + private static bool BlockConditionsMatch(BasicBlock currentBlock, BasicBlock queryBlock) { // Check if all the conditions for the query block are satisfied by the current block. |
