/// <summary> /// Flushes a range of the buffer. /// This writes the range data back into guest memory. /// </summary> /// <param name="address">Start address of the range</param> /// <param name="size">Size in bytes of the range</param> public void Flush(ulong address, ulong size) { int offset = (int)(address - Address); ReadOnlySpan <byte> data = _context.Renderer.GetBufferData(Handle, offset, (int)size); // TODO: When write tracking shaders, they will need to be aware of changes in overlapping buffers. _physicalMemory.WriteUntracked(address, data); }
/// <summary> /// Write data to the MultiRange, without tracking. /// </summary> /// <param name="va">Offset address</param> /// <param name="data">Data to write</param> /// <exception cref="ArgumentException">Throw when a non-zero offset is given</exception> public void WriteUntracked(ulong va, ReadOnlySpan <byte> data) { if (va != 0) { throw new ArgumentException($"{nameof(va)} cannot be non-zero for {nameof(MultiRangeWritableBlock)}."); } _physicalMemory.WriteUntracked(_range, data); }