NsGpu.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using ChocolArm64.Memory;
  2. using Ryujinx.Graphics.Gal;
  3. namespace Ryujinx.Graphics.Gpu
  4. {
  5. public class NsGpu
  6. {
  7. public IGalRenderer Renderer { get; private set; }
  8. internal NsGpuMemoryMgr MemoryMgr { get; private set; }
  9. internal NsGpuPGraph PGraph { get; private set; }
  10. public NsGpu(IGalRenderer Renderer)
  11. {
  12. this.Renderer = Renderer;
  13. MemoryMgr = new NsGpuMemoryMgr();
  14. PGraph = new NsGpuPGraph(this);
  15. }
  16. public long GetCpuAddr(long Position)
  17. {
  18. return MemoryMgr.GetCpuAddr(Position);
  19. }
  20. public long MapMemory(long CpuAddr, long Size)
  21. {
  22. return MemoryMgr.Map(CpuAddr, Size);
  23. }
  24. public long MapMemory(long CpuAddr, long GpuAddr, long Size)
  25. {
  26. return MemoryMgr.Map(CpuAddr, GpuAddr, Size);
  27. }
  28. public void ProcessPushBuffer(NsGpuPBEntry[] PushBuffer, AMemory Memory)
  29. {
  30. PGraph.ProcessPushBuffer(PushBuffer, Memory);
  31. }
  32. public long ReserveMemory(long Size, long Align)
  33. {
  34. return MemoryMgr.Reserve(Size, Align);
  35. }
  36. public long ReserveMemory(long GpuAddr, long Size, long Align)
  37. {
  38. return MemoryMgr.Reserve(GpuAddr, Size, Align);
  39. }
  40. }
  41. }