aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-06-25 11:52:38 -0300
committerGitHub <noreply@github.com>2022-06-25 16:52:38 +0200
commit625f5fb88ab992a0778f86c8acb95b1789c503a8 (patch)
treedb6b8da9f33c52af39557de39ef02ef8c316f502
parent2382717600939e0e970f47f404cd62672c097ad4 (diff)
Account for pool change on texture bindings cache (#3420)1.1.158
* Account for pool change on texture bindings cache * Reduce the number of checks needed
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index a990528e..18f5a74a 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -32,6 +32,9 @@ namespace Ryujinx.Graphics.Gpu.Image
private readonly GpuChannel _channel;
private readonly TexturePoolCache _texturePoolCache;
+ private TexturePool _cachedTexturePool;
+ private SamplerPool _cachedSamplerPool;
+
private readonly TextureBindingInfo[][] _textureBindings;
private readonly TextureBindingInfo[][] _imageBindings;
@@ -343,9 +346,14 @@ namespace Ryujinx.Graphics.Gpu.Image
? _texturePoolCache.FindOrCreate(_channel, texturePoolAddress, _texturePoolMaximumId)
: null;
+ SamplerPool samplerPool = _samplerPool;
+
// Check if the texture pool has been modified since bindings were last committed.
// If it wasn't, then it's possible to avoid looking up textures again when the handle remains the same.
- bool poolModified = false;
+ bool poolModified = _cachedTexturePool != texturePool || _cachedSamplerPool != samplerPool;
+
+ _cachedTexturePool = texturePool;
+ _cachedSamplerPool = samplerPool;
if (texturePool != null)
{
@@ -358,9 +366,9 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
- if (_samplerPool != null)
+ if (samplerPool != null)
{
- int samplerPoolSequence = _samplerPool.CheckModified();
+ int samplerPoolSequence = samplerPool.CheckModified();
if (_samplerPoolSequence != samplerPoolSequence)
{