diff options
author | riperiperi <rhy3756547@hotmail.com> | 2021-01-29 03:19:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 14:19:06 +1100 |
commit | c30504e3b3bb64c44d993d6339f15ec6703a3c55 (patch) | |
tree | 91be94fc94dd52dcb8972f745559cf66f9dccb22 /Ryujinx.Graphics.Gpu/Image/TexturePool.cs | |
parent | 9eb0ab05c6e820e113b3c61cbacd9b085b2819c4 (diff) |
Use a descriptor cache for faster pool invalidation. (#1977)
* Use a descriptor cache for faster pool invalidation.
* Speed up comparison by casting to Vector256
Now we never need to worry about this ever again
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePool.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TexturePool.cs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs index dfcd8a52..58e881ca 100644 --- a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs +++ b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs @@ -1,6 +1,5 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.GAL; -using Ryujinx.Graphics.Gpu.Memory; using Ryujinx.Graphics.Texture; using System; using System.Collections.Generic; @@ -10,7 +9,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <summary> /// Texture pool. /// </summary> - class TexturePool : Pool<Texture> + class TexturePool : Pool<Texture, TextureDescriptor> { private int _sequenceNumber; @@ -65,6 +64,8 @@ namespace Ryujinx.Graphics.Gpu.Image texture.IncrementReferenceCount(); Items[id] = texture; + + DescriptorCache[id] = descriptor; } else { @@ -92,16 +93,6 @@ namespace Ryujinx.Graphics.Gpu.Image } /// <summary> - /// Gets the texture descriptor from a given texture ID. - /// </summary> - /// <param name="id">ID of the texture. This is effectively a zero-based index</param> - /// <returns>The texture descriptor</returns> - public TextureDescriptor GetDescriptor(int id) - { - return Context.PhysicalMemory.Read<TextureDescriptor>(Address + (ulong)id * DescriptorSize); - } - - /// <summary> /// Implementation of the texture pool range invalidation. /// </summary> /// <param name="address">Start address of the range of the texture pool</param> @@ -122,8 +113,7 @@ namespace Ryujinx.Graphics.Gpu.Image // If the descriptors are the same, the texture is the same, // we don't need to remove as it was not modified. Just continue. - if (texture.Info.GpuAddress == descriptor.UnpackAddress() && - texture.IsExactMatch(GetInfo(descriptor, out _), TextureSearchFlags.Strict) != TextureMatchQuality.NoMatch) + if (descriptor.Equals(ref DescriptorCache[id])) { continue; } |