Account for pool change on texture bindings cache (#3420)

* Account for pool change on texture bindings cache

* Reduce the number of checks needed
This commit is contained in:
gdkchan 2022-06-25 11:52:38 -03:00 committed by GitHub
parent 2382717600
commit 625f5fb88a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{