mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-26 09:59:14 +01:00
Shader: Assume the only remaining source is the right one when all others are undefined (#7331)
Some checks failed
Release job / Create tag (push) Has been cancelled
Release job / Release for linux-arm64 (push) Has been cancelled
Release job / Release for linux-x64 (push) Has been cancelled
Release job / Release for win-x64 (push) Has been cancelled
Release job / Release MacOS universal (push) Has been cancelled
Release job / flatpak_release (push) Has been cancelled
Some checks failed
Release job / Create tag (push) Has been cancelled
Release job / Release for linux-arm64 (push) Has been cancelled
Release job / Release for linux-x64 (push) Has been cancelled
Release job / Release for win-x64 (push) Has been cancelled
Release job / Release MacOS universal (push) Has been cancelled
Release job / flatpak_release (push) Has been cancelled
* Shader: Assume the only remaining source is the right one when all other are undefined * Shader cache version bump * Improve comment
This commit is contained in:
parent
24ee8c39f1
commit
d717aef2be
2 changed files with 23 additions and 1 deletions
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||||
private const ushort FileFormatVersionMajor = 1;
|
private const ushort FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||||
private const uint CodeGenVersion = 7320;
|
private const uint CodeGenVersion = 7331;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
|
|
@ -138,6 +138,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||||
// Ensure that conditions met for that branch are also met for the current one.
|
// Ensure that conditions met for that branch are also met for the current one.
|
||||||
// Prefer the latest sources for the phi node.
|
// Prefer the latest sources for the phi node.
|
||||||
|
|
||||||
|
int undefCount = 0;
|
||||||
|
|
||||||
for (int i = phiNode.SourcesCount - 1; i >= 0; i--)
|
for (int i = phiNode.SourcesCount - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
BasicBlock phiBlock = phiNode.GetBlock(i);
|
BasicBlock phiBlock = phiNode.GetBlock(i);
|
||||||
|
@ -159,6 +161,26 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (phiSource.Type == OperandType.Undefined)
|
||||||
|
{
|
||||||
|
undefCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If all sources but one are undefined, we can assume that the one
|
||||||
|
// that is not undefined is the right one.
|
||||||
|
|
||||||
|
if (undefCount == phiNode.SourcesCount - 1)
|
||||||
|
{
|
||||||
|
for (int i = phiNode.SourcesCount - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
Operand phiSource = phiNode.GetSource(i);
|
||||||
|
|
||||||
|
if (phiSource.Type != OperandType.Undefined)
|
||||||
|
{
|
||||||
|
return phiSource;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue