From d9d18439f6900fd9f05bde41998526281f7638c5 Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Wed, 11 Aug 2021 15:59:42 -0300
Subject: Use a new approach for shader BRX targets (#2532)

* Use a new approach for shader BRX targets

* Make shader cache actually work

* Improve the shader pattern matching a bit

* Extend LDC search to predecessor blocks, catches more cases

* Nit

* Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers

* Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
---
 Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs')

diff --git a/Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs b/Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs
index 1ac37704..3fc11e82 100644
--- a/Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs
+++ b/Ryujinx.Graphics.Gpu/Shader/Cache/CacheManager.cs
@@ -114,6 +114,16 @@ namespace Ryujinx.Graphics.Gpu.Shader.Cache
             _hostProgramCache.ReplaceValue(ref programCodeHash, data);
         }
 
+        /// <summary>
+        /// Removes a shader program present in the program cache.
+        /// </summary>
+        /// <param name="programCodeHash">Target program code hash</param>
+        public void RemoveProgram(ref Hash128 programCodeHash)
+        {
+            _guestProgramCache.RemoveValue(ref programCodeHash);
+            _hostProgramCache.RemoveValue(ref programCodeHash);
+        }
+
         /// <summary>
         /// Get all guest program hashes.
         /// </summary>
-- 
cgit v1.2.3-70-g09d2