diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-12-05 16:11:32 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-05 19:11:32 +0000 |
commit | bbb24d8c7e6ccc61ceda1f4223fd68feee3b2f20 (patch) | |
tree | 955a54494cda71a9f816a08773886e5168980c59 /Ryujinx.Graphics.Shader/Translation/Rewriter.cs | |
parent | 4da44e09cb2a32f69b4a6b47221117b78e4618dc (diff) |
Restrict shader storage buffer search when match fails (#4011)1.1.427
* Restrict storage buffer search when match fails
* Shader cache version bump
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/Rewriter.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/Translation/Rewriter.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs index bdd9b791..c8dab9de 100644 --- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs +++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs @@ -2,6 +2,7 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Numerics; using static Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandHelper; using static Ryujinx.Graphics.Shader.Translation.GlobalMemory; @@ -88,8 +89,14 @@ namespace Ryujinx.Graphics.Shader.Translation Operand sbBaseAddrLow = Const(0); Operand sbSlot = Const(0); - for (int slot = 0; slot < StorageMaxCount; slot++) + int sbUseMask = config.AccessibleStorageBuffersMask; + + while (sbUseMask != 0) { + int slot = BitOperations.TrailingZeroCount(sbUseMask); + + sbUseMask &= ~(1 << slot); + config.SetUsedStorageBuffer(slot, isWrite); int cbOffset = GetStorageCbOffset(config.Stage, slot); |