BufferCacheEntry.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace Ryujinx.Graphics.Gpu.Memory
  2. {
  3. /// <summary>
  4. /// A cached entry for easily locating a buffer that is used often internally.
  5. /// </summary>
  6. class BufferCacheEntry
  7. {
  8. /// <summary>
  9. /// The CPU VA of the buffer destination.
  10. /// </summary>
  11. public ulong Address;
  12. /// <summary>
  13. /// The end GPU VA of the associated buffer, used to check if new data can fit.
  14. /// </summary>
  15. public ulong EndGpuAddress;
  16. /// <summary>
  17. /// The buffer associated with this cache entry.
  18. /// </summary>
  19. public Buffer Buffer;
  20. /// <summary>
  21. /// The UnmappedSequence of the buffer at the time of creation.
  22. /// If this differs from the value currently in the buffer, then this cache entry is outdated.
  23. /// </summary>
  24. public int UnmappedSequence;
  25. /// <summary>
  26. /// Create a new cache entry.
  27. /// </summary>
  28. /// <param name="address">The CPU VA of the buffer destination</param>
  29. /// <param name="gpuVa">The GPU VA of the buffer destination</param>
  30. /// <param name="buffer">The buffer object containing the target buffer</param>
  31. public BufferCacheEntry(ulong address, ulong gpuVa, Buffer buffer)
  32. {
  33. Address = address;
  34. EndGpuAddress = gpuVa + (buffer.EndAddress - address);
  35. Buffer = buffer;
  36. UnmappedSequence = buffer.UnmappedSequence;
  37. }
  38. }
  39. }