aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureManager.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/TextureManager.cs
parent88633f4bc2987c3118c4d0f482870b7871b47e81 (diff)
Prefer truly perfect texture matches over fomat aliased ones (#1754)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureManager.cs43
1 files changed, 29 insertions, 14 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index 0834d7ac..6b11a671 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -682,26 +682,43 @@ namespace Ryujinx.Graphics.Gpu.Image
sameAddressOverlapsCount = _textures.FindOverlaps(info.Address, ref _textureOverlaps);
}
+ Texture texture = null;
+
+ TextureMatchQuality bestQuality = TextureMatchQuality.NoMatch;
+
for (int index = 0; index < sameAddressOverlapsCount; index++)
{
Texture overlap = _textureOverlaps[index];
- if (overlap.IsPerfectMatch(info, flags))
+ TextureMatchQuality matchQuality = overlap.IsExactMatch(info, flags);
+
+ if (matchQuality == TextureMatchQuality.Perfect)
{
- if (!isSamplerTexture)
- {
- // If not a sampler texture, it is managed by the auto delete
- // cache, ensure that it is on the "top" of the list to avoid
- // deletion.
- _cache.Lift(overlap);
- }
+ texture = overlap;
+ break;
+ }
+ else if (matchQuality > bestQuality)
+ {
+ texture = overlap;
+ bestQuality = matchQuality;
+ }
+ }
- ChangeSizeIfNeeded(info, overlap, isSamplerTexture, sizeHint);
+ if (texture != null)
+ {
+ if (!isSamplerTexture)
+ {
+ // If not a sampler texture, it is managed by the auto delete
+ // cache, ensure that it is on the "top" of the list to avoid
+ // deletion.
+ _cache.Lift(texture);
+ }
- overlap.SynchronizeMemory();
+ ChangeSizeIfNeeded(info, texture, isSamplerTexture, sizeHint);
- return overlap;
- }
+ texture.SynchronizeMemory();
+
+ return texture;
}
// Calculate texture sizes, used to find all overlapping textures.
@@ -743,8 +760,6 @@ namespace Ryujinx.Graphics.Gpu.Image
overlapsCount = _textures.FindOverlaps(info.Address, size, ref _textureOverlaps);
}
- Texture texture = null;
-
for (int index = 0; index < overlapsCount; index++)
{
Texture overlap = _textureOverlaps[index];