Reset cache on command buffer execution instead of sync calls (#341)
Also resets const buffer cache on CbData calls. Non-const buffer data might also change while a command buffer is executing but that's very unlikely.
This commit is contained in:
parent
9ac5583513
commit
0673dc183a
2 changed files with 28 additions and 15 deletions
|
@ -80,6 +80,14 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetCache()
|
||||||
|
{
|
||||||
|
foreach (List<long> Uploaded in UploadedKeys)
|
||||||
|
{
|
||||||
|
Uploaded.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void VertexEndGl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
private void VertexEndGl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
||||||
{
|
{
|
||||||
LockCaches();
|
LockCaches();
|
||||||
|
@ -623,11 +631,6 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
|
|
||||||
if (Mode == 0)
|
if (Mode == 0)
|
||||||
{
|
{
|
||||||
foreach (List<long> Uploaded in UploadedKeys)
|
|
||||||
{
|
|
||||||
Uploaded.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Write mode.
|
//Write mode.
|
||||||
Vmm.WriteInt32(Position, Seq);
|
Vmm.WriteInt32(Position, Seq);
|
||||||
}
|
}
|
||||||
|
@ -649,6 +652,8 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteRegister(NvGpuEngine3dReg.ConstBufferOffset, Offset);
|
WriteRegister(NvGpuEngine3dReg.ConstBufferOffset, Offset);
|
||||||
|
|
||||||
|
UploadedKeys[(int)NvGpuBufferType.ConstBuffer].Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CbBind(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
private void CbBind(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
|
|
||||||
private NvGpu Gpu;
|
private NvGpu Gpu;
|
||||||
|
|
||||||
private ConcurrentQueue<(NvGpuVmm, NvGpuPBEntry)> BufferQueue;
|
private ConcurrentQueue<(NvGpuVmm, NvGpuPBEntry[])> BufferQueue;
|
||||||
|
|
||||||
private NvGpuEngine[] SubChannels;
|
private NvGpuEngine[] SubChannels;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
{
|
{
|
||||||
this.Gpu = Gpu;
|
this.Gpu = Gpu;
|
||||||
|
|
||||||
BufferQueue = new ConcurrentQueue<(NvGpuVmm, NvGpuPBEntry)>();
|
BufferQueue = new ConcurrentQueue<(NvGpuVmm, NvGpuPBEntry[])>();
|
||||||
|
|
||||||
SubChannels = new NvGpuEngine[8];
|
SubChannels = new NvGpuEngine[8];
|
||||||
|
|
||||||
|
@ -69,10 +69,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
|
|
||||||
public void PushBuffer(NvGpuVmm Vmm, NvGpuPBEntry[] Buffer)
|
public void PushBuffer(NvGpuVmm Vmm, NvGpuPBEntry[] Buffer)
|
||||||
{
|
{
|
||||||
foreach (NvGpuPBEntry PBEntry in Buffer)
|
BufferQueue.Enqueue((Vmm, Buffer));
|
||||||
{
|
|
||||||
BufferQueue.Enqueue((Vmm, PBEntry));
|
|
||||||
}
|
|
||||||
|
|
||||||
Event.Set();
|
Event.Set();
|
||||||
}
|
}
|
||||||
|
@ -82,16 +79,27 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
while (Step());
|
while (Step());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private (NvGpuVmm Vmm, NvGpuPBEntry[] Pb) Curr;
|
||||||
|
|
||||||
|
private int CurrPbEntryIndex;
|
||||||
|
|
||||||
public bool Step()
|
public bool Step()
|
||||||
{
|
{
|
||||||
if (BufferQueue.TryDequeue(out (NvGpuVmm Vmm, NvGpuPBEntry PBEntry) Tuple))
|
while (Curr.Pb == null || Curr.Pb.Length <= CurrPbEntryIndex)
|
||||||
{
|
{
|
||||||
CallMethod(Tuple.Vmm, Tuple.PBEntry);
|
if (!BufferQueue.TryDequeue(out Curr))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
Gpu.Engine3d.ResetCache();
|
||||||
|
|
||||||
|
CurrPbEntryIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
CallMethod(Curr.Vmm, Curr.Pb[CurrPbEntryIndex++]);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
private void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
||||||
|
|
Reference in a new issue