aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/Texture.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-11-27 18:46:23 +0000
committerGitHub <noreply@github.com>2020-11-27 19:46:23 +0100
commit0108004691a582f7df8e629c1e68a6bb0e0b90e7 (patch)
treebb3090e6670c22cd2eee144c7060f9dd3b252f2b /Ryujinx.Graphics.Gpu/Image/Texture.cs
parent88633f4bc2987c3118c4d0f482870b7871b47e81 (diff)
Prefer truly perfect texture matches over fomat aliased ones (#1754)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Texture.cs22
1 files changed, 12 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs
index 7fb41572..45a27051 100644
--- a/Ryujinx.Graphics.Gpu/Image/Texture.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs
@@ -800,29 +800,31 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
/// <param name="info">Texture information to compare against</param>
/// <param name="flags">Comparison flags</param>
- /// <returns>True if the textures are strictly equal or similar, false otherwise</returns>
- public bool IsPerfectMatch(TextureInfo info, TextureSearchFlags flags)
+ /// <returns>A value indicating how well this texture matches the given info</returns>
+ public TextureMatchQuality IsExactMatch(TextureInfo info, TextureSearchFlags flags)
{
- if (!TextureCompatibility.FormatMatches(Info, info, (flags & TextureSearchFlags.ForSampler) != 0, (flags & TextureSearchFlags.ForCopy) != 0))
+ TextureMatchQuality matchQuality = TextureCompatibility.FormatMatches(Info, info, (flags & TextureSearchFlags.ForSampler) != 0, (flags & TextureSearchFlags.ForCopy) != 0);
+
+ if (matchQuality == TextureMatchQuality.NoMatch)
{
- return false;
+ return matchQuality;
}
if (!TextureCompatibility.LayoutMatches(Info, info))
{
- return false;
+ return TextureMatchQuality.NoMatch;
}
if (!TextureCompatibility.SizeMatches(Info, info, (flags & TextureSearchFlags.Strict) == 0))
{
- return false;
+ return TextureMatchQuality.NoMatch;
}
if ((flags & TextureSearchFlags.ForSampler) != 0 || (flags & TextureSearchFlags.Strict) != 0)
{
if (!TextureCompatibility.SamplerParamsMatches(Info, info))
{
- return false;
+ return TextureMatchQuality.NoMatch;
}
}
@@ -832,15 +834,15 @@ namespace Ryujinx.Graphics.Gpu.Image
if (!msTargetCompatible && !TextureCompatibility.TargetAndSamplesCompatible(Info, info))
{
- return false;
+ return TextureMatchQuality.NoMatch;
}
}
else if (!TextureCompatibility.TargetAndSamplesCompatible(Info, info))
{
- return false;
+ return TextureMatchQuality.NoMatch;
}
- return Info.Address == info.Address && Info.Levels == info.Levels;
+ return Info.Address == info.Address && Info.Levels == info.Levels ? matchQuality : TextureMatchQuality.NoMatch;
}
/// <summary>