Skip repeated cache tests between same sync
This commit is contained in:
parent
241b46540d
commit
9303a7e9ae
1 changed files with 43 additions and 3 deletions
|
@ -25,6 +25,10 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
|
||||
private HashSet<long> FrameBuffers;
|
||||
|
||||
private List<long> UploadedIndexes;
|
||||
private List<long> UploadedVertices;
|
||||
private List<long> UploadedTextures;
|
||||
|
||||
public NvGpuEngine3d(NvGpu Gpu)
|
||||
{
|
||||
this.Gpu = Gpu;
|
||||
|
@ -57,6 +61,10 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
}
|
||||
|
||||
FrameBuffers = new HashSet<long>();
|
||||
|
||||
UploadedIndexes = new List<long>();
|
||||
UploadedVertices = new List<long>();
|
||||
UploadedTextures = new List<long>();
|
||||
}
|
||||
|
||||
public void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
||||
|
@ -516,10 +524,12 @@ 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);
|
||||
|
||||
UploadedIndexes.Add(Key);
|
||||
|
||||
HasCachedTexture = true;
|
||||
}
|
||||
}
|
||||
|
@ -593,7 +603,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 +667,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 +702,10 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
|
||||
if (Mode == 0)
|
||||
{
|
||||
UploadedIndexes.Clear();
|
||||
UploadedVertices.Clear();
|
||||
UploadedTextures.Clear();
|
||||
|
||||
//Write mode.
|
||||
Vmm.WriteInt32(Position, Seq);
|
||||
}
|
||||
|
@ -774,5 +788,31 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
{
|
||||
return FrameBuffers.Contains(Position);
|
||||
}
|
||||
|
||||
private bool QueryKeyUpload(NvGpuVmm Vmm, long Key, long Size, NvGpuBufferType Type)
|
||||
{
|
||||
List<long> UploadedKeys = TypeUploadedList(Type);
|
||||
|
||||
if (UploadedKeys.Contains(Key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UploadedKeys.Add(Key);
|
||||
|
||||
return Vmm.IsRegionModified(Key, Size, Type);
|
||||
}
|
||||
|
||||
private List<long> TypeUploadedList(NvGpuBufferType Type)
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case NvGpuBufferType.Index: return UploadedIndexes;
|
||||
case NvGpuBufferType.Vertex: return UploadedVertices;
|
||||
case NvGpuBufferType.Texture: return UploadedTextures;
|
||||
|
||||
default: throw new ArgumentException(nameof(Type));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue