Inline2Memory.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Ryujinx.Graphics.Gpu.State;
  2. using System;
  3. namespace Ryujinx.Graphics.Gpu.Engine
  4. {
  5. partial class Methods
  6. {
  7. private Inline2MemoryParams _params;
  8. private bool _isLinear;
  9. private int _offset;
  10. private int _size;
  11. public void LaunchDma(GpuState state, int argument)
  12. {
  13. _params = state.Get<Inline2MemoryParams>(MethodOffset.I2mParams);
  14. _isLinear = (argument & 1) != 0;
  15. _offset = 0;
  16. _size = _params.LineLengthIn * _params.LineCount;
  17. }
  18. public void LoadInlineData(GpuState state, int argument)
  19. {
  20. if (_isLinear)
  21. {
  22. for (int shift = 0; shift < 32 && _offset < _size; shift += 8, _offset++)
  23. {
  24. ulong gpuVa = _params.DstAddress.Pack() + (ulong)_offset;
  25. _context.MemoryAccessor.Write(gpuVa, new byte[] { (byte)(argument >> shift) });
  26. }
  27. }
  28. else
  29. {
  30. throw new NotImplementedException();
  31. }
  32. }
  33. }
  34. }