diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs index 628c3159..fe0175a6 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs @@ -16,6 +16,7 @@ namespace Ryujinx.Graphics.Gpu.Image private readonly TextureBindingsManager _cpBindingsManager; private readonly TextureBindingsManager _gpBindingsManager; private readonly TexturePoolCache _texturePoolCache; + private readonly SamplerPoolCache _samplerPoolCache; private readonly Texture[] _rtColors; private readonly ITexture[] _rtHostColors; @@ -41,13 +42,15 @@ namespace Ryujinx.Graphics.Gpu.Image _channel = channel; TexturePoolCache texturePoolCache = new TexturePoolCache(context); + SamplerPoolCache samplerPoolCache = new SamplerPoolCache(context); float[] scales = new float[64]; new Span<float>(scales).Fill(1f); - _cpBindingsManager = new TextureBindingsManager(context, channel, texturePoolCache, scales, isCompute: true); - _gpBindingsManager = new TextureBindingsManager(context, channel, texturePoolCache, scales, isCompute: false); + _cpBindingsManager = new TextureBindingsManager(context, channel, texturePoolCache, samplerPoolCache, scales, isCompute: true); + _gpBindingsManager = new TextureBindingsManager(context, channel, texturePoolCache, samplerPoolCache, scales, isCompute: false); _texturePoolCache = texturePoolCache; + _samplerPoolCache = samplerPoolCache; _rtColors = new Texture[Constants.TotalRenderTargets]; _rtHostColors = new ITexture[Constants.TotalRenderTargets]; @@ -368,6 +371,10 @@ namespace Ryujinx.Graphics.Gpu.Image // we must rebind everything. // Since compute work happens less often, we always do that // before and after the compute dispatch. + + _texturePoolCache.Tick(); + _samplerPoolCache.Tick(); + _cpBindingsManager.Rebind(); bool result = _cpBindingsManager.CommitBindings(specState); _gpBindingsManager.Rebind(); @@ -382,6 +389,9 @@ namespace Ryujinx.Graphics.Gpu.Image /// <returns>True if all bound textures match the current shader specialization state, false otherwise</returns> public bool CommitGraphicsBindings(ShaderSpecializationState specState) { + _texturePoolCache.Tick(); + _samplerPoolCache.Tick(); + bool result = _gpBindingsManager.CommitBindings(specState); UpdateRenderTargets(); @@ -502,6 +512,15 @@ namespace Ryujinx.Graphics.Gpu.Image } /// <summary> + /// Forces the texture and sampler pools to be re-loaded from the cache on next use. + /// </summary> + public void ReloadPools() + { + _cpBindingsManager.ReloadPools(); + _gpBindingsManager.ReloadPools(); + } + + /// <summary> /// Forces all textures, samplers, images and render targets to be rebound the next time /// CommitGraphicsBindings is called. /// </summary> @@ -523,8 +542,8 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public void Dispose() { - _cpBindingsManager.Dispose(); - _gpBindingsManager.Dispose(); + // Textures are owned by the texture cache, so we shouldn't dispose the texture pool cache. + _samplerPoolCache.Dispose(); for (int i = 0; i < _rtColors.Length; i++) { |