JinxRyu/Ryujinx.Graphics.Gpu/Memory
riperiperi 4b60371e64
Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494)
* Return mapped buffer pointer directly for flush, WriteableRegion for textures

A few changes here to generally improve performance, even for platforms not using the persistent buffer flush.

- Texture and buffer flush now return a ReadOnlySpan<byte>. It's guaranteed that this span is pinned in memory, but it will be overwritten on the next flush from that thread, so it is expected that the data is used before calling again.
- As a result, persistent mappings no longer copy to a new array - rather the persistent map is returned directly as a Span<>. A similar host array is used for the glGet flushes instead of allocating new arrays each time.
- Texture flushes now do their layout conversion into a WriteableRegion when the texture is not MultiRange, which allows the flush to happen directly into guest memory rather than into a temporary span, then copied over. This avoids another copy when doing layout conversion.

Overall, this saves 1 data copy for buffer flush, 1 copy for linear textures with matching source/target stride, and 2 copies for block textures or linear textures with mismatching strides.

* Fix tests

* Fix array pointer for Mesa/Intel path

* Address some feedback

* Update method for getting array pointer.
2021-07-19 19:10:54 -03:00
..
Buffer.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
BufferBounds.cs Implement lazy flush-on-read for Buffers (SSBO/Copy) (#1790) 2021-01-17 17:08:06 -03:00
BufferCache.cs Separate GPU engines (part 2/2) (#2440) 2021-07-11 17:20:40 -03:00
BufferCacheEntry.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
BufferManager.cs Initial support for separate GPU address spaces (#2394) 2021-06-29 19:32:02 +02:00
BufferModifiedRangeList.cs Implement lazy flush-on-read for Buffers (SSBO/Copy) (#1790) 2021-01-17 17:08:06 -03:00
BufferTextureBinding.cs Improve Buffer Textures and flush Image Stores (#2088) 2021-03-08 18:43:39 -03:00
CounterCache.cs Implement Counter Queue and Partial Host Conditional Rendering (#1167) 2020-05-04 12:24:59 +10:00
GpuRegionHandle.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
IndexBuffer.cs Add XML documentation to Ryujinx.Graphics.Gpu.Memory 2020-01-09 02:13:00 +01:00
MemoryManager.cs Initial support for separate GPU address spaces (#2394) 2021-06-29 19:32:02 +02:00
PhysicalMemory.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
ResourceName.cs Add XML documentation to Ryujinx.Graphics.Gpu.Memory 2020-01-09 02:13:00 +01:00
UnmapEventArgs.cs Initial conditional rendering support (#1012) 2020-04-22 16:00:11 +10:00
VertexBuffer.cs Add XML documentation to Ryujinx.Graphics.Gpu.Memory 2020-01-09 02:13:00 +01:00