diff options
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs | 2 | ||||
-rw-r--r-- | src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs index e1e696ca8..a5c5abd4b 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 | |||
22 | private const ushort FileFormatVersionMajor = 1; | 22 | private const ushort FileFormatVersionMajor = 1; |
23 | private const ushort FileFormatVersionMinor = 2; | 23 | private const ushort FileFormatVersionMinor = 2; |
24 | private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; | 24 | private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor; |
25 | private const uint CodeGenVersion = 7320; | 25 | private const uint CodeGenVersion = 7331; |
26 | 26 | ||
27 | private const string SharedTocFileName = "shared.toc"; | 27 | private const string SharedTocFileName = "shared.toc"; |
28 | private const string SharedDataFileName = "shared.data"; | 28 | private const string SharedDataFileName = "shared.data"; |
diff --git a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs index 23180ff82..6ec90fa3c 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Utils.cs | |||
@@ -138,6 +138,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations | |||
138 | // Ensure that conditions met for that branch are also met for the current one. | 138 | // Ensure that conditions met for that branch are also met for the current one. |
139 | // Prefer the latest sources for the phi node. | 139 | // Prefer the latest sources for the phi node. |
140 | 140 | ||
141 | int undefCount = 0; | ||
142 | |||
141 | for (int i = phiNode.SourcesCount - 1; i >= 0; i--) | 143 | for (int i = phiNode.SourcesCount - 1; i >= 0; i--) |
142 | { | 144 | { |
143 | BasicBlock phiBlock = phiNode.GetBlock(i); | 145 | BasicBlock phiBlock = phiNode.GetBlock(i); |
@@ -159,6 +161,26 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations | |||
159 | return match; | 161 | return match; |
160 | } | 162 | } |
161 | } | 163 | } |
164 | else if (phiSource.Type == OperandType.Undefined) | ||
165 | { | ||
166 | undefCount++; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | // If all sources but one are undefined, we can assume that the one | ||
171 | // that is not undefined is the right one. | ||
172 | |||
173 | if (undefCount == phiNode.SourcesCount - 1) | ||
174 | { | ||
175 | for (int i = phiNode.SourcesCount - 1; i >= 0; i--) | ||
176 | { | ||
177 | Operand phiSource = phiNode.GetSource(i); | ||
178 | |||
179 | if (phiSource.Type != OperandType.Undefined) | ||
180 | { | ||
181 | return phiSource; | ||
182 | } | ||
183 | } | ||
162 | } | 184 | } |
163 | } | 185 | } |
164 | 186 | ||