From 79de8fd4904ec19318baceb999a7d1a84f686794 Mon Sep 17 00:00:00 2001
From: gdk <gab.dark.100@gmail.com>
Date: Fri, 22 Nov 2019 14:17:06 -0300
Subject: [PATCH] Share texture pool cache between graphics and compute

---
 Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs | 9 ++++-----
 Ryujinx.Graphics.Gpu/Image/TextureManager.cs         | 6 ++++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index 2d0e828ef..74d7a76a9 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -33,12 +33,11 @@ namespace Ryujinx.Graphics.Gpu.Image
 
         private bool _rebind;
 
-        public TextureBindingsManager(GpuContext context, bool isCompute)
+        public TextureBindingsManager(GpuContext context, TexturePoolCache texturePoolCache, bool isCompute)
         {
-            _context   = context;
-            _isCompute = isCompute;
-
-            _texturePoolCache = new TexturePoolCache(context);
+            _context          = context;
+            _texturePoolCache = texturePoolCache;
+            _isCompute        = isCompute;
 
             int stages = isCompute ? 1 : Constants.TotalShaderStages;
 
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index d4c161bd8..045c2ed94 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -30,8 +30,10 @@ namespace Ryujinx.Graphics.Gpu.Image
         {
             _context = context;
 
-            _cpBindingsManager = new TextureBindingsManager(context, isCompute: true);
-            _gpBindingsManager = new TextureBindingsManager(context, isCompute: false);
+            TexturePoolCache texturePoolCache = new TexturePoolCache(context);
+
+            _cpBindingsManager = new TextureBindingsManager(context, texturePoolCache, isCompute: true);
+            _gpBindingsManager = new TextureBindingsManager(context, texturePoolCache, isCompute: false);
 
             _rtColors = new Texture[Constants.TotalRenderTargets];