Avoid lookup of invalid textures if pool did not change

This commit is contained in:
gdkchan
2025-08-17 00:41:30 -05:00
committed by KeatonTheBot
parent 48c809a80d
commit e7d423cd07
2 changed files with 238 additions and 2 deletions
+12 -2
View File
@@ -1,3 +1,4 @@
using Ryujinx.Common.Collections;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Memory;
@@ -72,6 +73,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
private readonly GpuChannel _channel;
private readonly BitMap _invalidMap;
private readonly ConcurrentQueue<DereferenceRequest> _dereferenceQueue = new();
private TextureDescriptor _defaultDescriptor;
@@ -166,6 +168,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
_channel = channel;
_aliasLists = new Dictionary<Texture, TextureAliasList>();
_invalidMap = new BitMap(maximumId + 1);
}
/// <summary>
@@ -182,6 +185,11 @@ namespace Ryujinx.Graphics.Gpu.Image
if (texture == null)
{
if (_invalidMap.IsSet(id))
{
return ref descriptor;
}
texture = PhysicalMemory.TextureCache.FindShortCache(descriptor);
if (texture == null)
@@ -198,8 +206,8 @@ namespace Ryujinx.Graphics.Gpu.Image
// If this happens, then the texture address is invalid, we can't add it to the cache.
if (texture == null)
{
return ref descriptor;
}
_invalidMap.Set(id);
return ref descriptor;}
}
else
{
@@ -514,6 +522,8 @@ namespace Ryujinx.Graphics.Gpu.Image
RemoveAliasList(texture);
}
}
_invalidMap.Clear(id);
}
}