diff options
author | riperiperi <rhy3756547@hotmail.com> | 2020-02-06 21:49:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 08:49:26 +1100 |
commit | 6db16b411031b17ac171dac3899ce0488a1b40df (patch) | |
tree | 5e33452e60dc563db8e2bfbd32927c147baa5fa8 /Ryujinx.Graphics.Gpu/Image/Texture.cs | |
parent | a906f2071cbe4caf53c697bcb7dfa91e3e7dcfae (diff) |
Only enumerate cached textures that are modified when flushing. (#918)
* Only enumarate cached textures that are modified when flushing, rather than all of them.
* Remove locking.
* Add missing clear.
* Remove texture from modified list when data is disposed.
In case the game does not call either flush method at any point.
* Add ReferenceEqualityComparer from jD for the HashSet
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Texture.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index 7d5e9079..7511bdfa 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -54,9 +54,14 @@ namespace Ryujinx.Graphics.Gpu.Image public LinkedListNode<Texture> CacheNode { get; set; } /// <summary> - /// Texture data modified by the GPU. + /// Event to fire when texture data is modified by the GPU. /// </summary> - public bool Modified { get; set; } + public event Action<Texture> Modified; + + /// <summary> + /// Event to fire when texture data is disposed. + /// </summary> + public event Action<Texture> Disposed; /// <summary> /// Start address of the texture in guest memory. @@ -934,6 +939,14 @@ namespace Ryujinx.Graphics.Gpu.Image } /// <summary> + /// Signals that the texture has been modified. + /// </summary> + public void SignalModified() + { + Modified?.Invoke(this); + } + + /// <summary> /// Replaces the host texture, while disposing of the old one if needed. /// </summary> /// <param name="hostTexture">The new host texture</param> @@ -1012,6 +1025,8 @@ namespace Ryujinx.Graphics.Gpu.Image _arrayViewTexture?.Dispose(); _arrayViewTexture = null; + + Disposed?.Invoke(this); } /// <summary> |