NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl * More work on NvHostCtrl * Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind * Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb) * Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks * Remove now unused code, add comment about probably wrong result codes
This commit is contained in:
parent
4419e8d6b4
commit
34037701c7
75 changed files with 2472 additions and 1440 deletions
|
@ -1,101 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu
|
||||
{
|
||||
public static class NvGpuPushBuffer
|
||||
{
|
||||
private enum SubmissionMode
|
||||
{
|
||||
Incrementing = 1,
|
||||
NonIncrementing = 3,
|
||||
Immediate = 4,
|
||||
IncrementOnce = 5
|
||||
}
|
||||
|
||||
public static NsGpuPBEntry[] Decode(byte[] Data)
|
||||
{
|
||||
using (MemoryStream MS = new MemoryStream(Data))
|
||||
{
|
||||
BinaryReader Reader = new BinaryReader(MS);
|
||||
|
||||
List<NsGpuPBEntry> PushBuffer = new List<NsGpuPBEntry>();
|
||||
|
||||
bool CanRead() => MS.Position + 4 <= MS.Length;
|
||||
|
||||
while (CanRead())
|
||||
{
|
||||
int Packed = Reader.ReadInt32();
|
||||
|
||||
int Meth = (Packed >> 0) & 0x1fff;
|
||||
int SubC = (Packed >> 13) & 7;
|
||||
int Args = (Packed >> 16) & 0x1fff;
|
||||
int Mode = (Packed >> 29) & 7;
|
||||
|
||||
switch ((SubmissionMode)Mode)
|
||||
{
|
||||
case SubmissionMode.Incrementing:
|
||||
{
|
||||
for (int Index = 0; Index < Args && CanRead(); Index++, Meth++)
|
||||
{
|
||||
PushBuffer.Add(new NsGpuPBEntry(Meth, SubC, Reader.ReadInt32()));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SubmissionMode.NonIncrementing:
|
||||
{
|
||||
int[] Arguments = new int[Args];
|
||||
|
||||
for (int Index = 0; Index < Arguments.Length; Index++)
|
||||
{
|
||||
if (!CanRead())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Arguments[Index] = Reader.ReadInt32();
|
||||
}
|
||||
|
||||
PushBuffer.Add(new NsGpuPBEntry(Meth, SubC, Arguments));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SubmissionMode.Immediate:
|
||||
{
|
||||
PushBuffer.Add(new NsGpuPBEntry(Meth, SubC, Args));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SubmissionMode.IncrementOnce:
|
||||
{
|
||||
if (CanRead())
|
||||
{
|
||||
PushBuffer.Add(new NsGpuPBEntry(Meth, SubC, Reader.ReadInt32()));
|
||||
}
|
||||
|
||||
if (CanRead() && Args > 1)
|
||||
{
|
||||
int[] Arguments = new int[Args - 1];
|
||||
|
||||
for (int Index = 0; Index < Arguments.Length && CanRead(); Index++)
|
||||
{
|
||||
Arguments[Index] = Reader.ReadInt32();
|
||||
}
|
||||
|
||||
PushBuffer.Add(new NsGpuPBEntry(Meth + 1, SubC, Arguments));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PushBuffer.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue