aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/Gpu/Engines
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-07-29 01:39:15 -0300
committergdkchan <gab.dark.100@gmail.com>2018-07-29 01:39:15 -0300
commit3208173620a0003d09d8e756729ca905ff14c47f (patch)
treed10f5b62f97b50545721bc82e8cf6c0f89fc058a /Ryujinx.HLE/Gpu/Engines
parentfdda67d4762c6a283ff0f1f76c02a02b21d9b119 (diff)
Cache changes (#302)
* Skip repeated cache tests between same sync * Skip some checks for regions where just one resource is resident * Dehardcode residency page size * Some cleanup
Diffstat (limited to 'Ryujinx.HLE/Gpu/Engines')
-rw-r--r--Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs34
1 files changed, 31 insertions, 3 deletions
diff --git a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs
index c3e7a77f..3dd0e98e 100644
--- a/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs
+++ b/Ryujinx.HLE/Gpu/Engines/NvGpuEngine3d.cs
@@ -25,6 +25,8 @@ namespace Ryujinx.HLE.Gpu.Engines
private HashSet<long> FrameBuffers;
+ private List<long>[] UploadedKeys;
+
public NvGpuEngine3d(NvGpu Gpu)
{
this.Gpu = Gpu;
@@ -57,6 +59,13 @@ namespace Ryujinx.HLE.Gpu.Engines
}
FrameBuffers = new HashSet<long>();
+
+ UploadedKeys = new List<long>[(int)NvGpuBufferType.Count];
+
+ for (int i = 0; i < UploadedKeys.Length; i++)
+ {
+ UploadedKeys[i] = new List<long>();
+ }
}
public void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
@@ -516,7 +525,7 @@ namespace Ryujinx.HLE.Gpu.Engines
if (Gpu.Renderer.Texture.TryGetCachedTexture(Key, Size, out GalTexture Texture))
{
- if (NewTexture.Equals(Texture) && !Vmm.IsRegionModified(Key, Size, NvGpuBufferType.Texture))
+ if (NewTexture.Equals(Texture) && !QueryKeyUpload(Vmm, Key, Size, NvGpuBufferType.Texture))
{
Gpu.Renderer.Texture.Bind(Key, TexIndex);
@@ -593,7 +602,7 @@ namespace Ryujinx.HLE.Gpu.Engines
bool IboCached = Gpu.Renderer.Rasterizer.IsIboCached(IboKey, (uint)IbSize);
- if (!IboCached || Vmm.IsRegionModified(IboKey, (uint)IbSize, NvGpuBufferType.Index))
+ if (!IboCached || QueryKeyUpload(Vmm, IboKey, (uint)IbSize, NvGpuBufferType.Index))
{
IntPtr DataAddress = Vmm.GetHostAddress(IndexPosition, IbSize);
@@ -657,7 +666,7 @@ namespace Ryujinx.HLE.Gpu.Engines
bool VboCached = Gpu.Renderer.Rasterizer.IsVboCached(VboKey, VbSize);
- if (!VboCached || Vmm.IsRegionModified(VboKey, VbSize, NvGpuBufferType.Vertex))
+ if (!VboCached || QueryKeyUpload(Vmm, VboKey, VbSize, NvGpuBufferType.Vertex))
{
IntPtr DataAddress = Vmm.GetHostAddress(VertexPosition, VbSize);
@@ -692,6 +701,11 @@ namespace Ryujinx.HLE.Gpu.Engines
if (Mode == 0)
{
+ foreach (List<long> Uploaded in UploadedKeys)
+ {
+ Uploaded.Clear();
+ }
+
//Write mode.
Vmm.WriteInt32(Position, Seq);
}
@@ -774,5 +788,19 @@ namespace Ryujinx.HLE.Gpu.Engines
{
return FrameBuffers.Contains(Position);
}
+
+ private bool QueryKeyUpload(NvGpuVmm Vmm, long Key, long Size, NvGpuBufferType Type)
+ {
+ List<long> Uploaded = UploadedKeys[(int)Type];
+
+ if (Uploaded.Contains(Key))
+ {
+ return false;
+ }
+
+ Uploaded.Add(Key);
+
+ return Vmm.IsRegionModified(Key, Size, Type);
+ }
}
} \ No newline at end of file