ryujinx-mirror/Ryujinx.Graphics.Texture
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
..
Astc Supper 2D array ASTC compressed texture formats decoding (#1593) 2020-10-02 11:22:23 +10:00
BCnDecoder.cs Simplify logic for bindless texture handling (#1667) 2020-11-09 19:35:04 -03:00
BlockLinearConstants.cs Initial work 2020-01-09 02:13:00 +01:00
BlockLinearLayout.cs Fix buffer to 3D texture copy (#1354) 2020-07-04 01:37:36 +02:00
Bpp12Pixel.cs Optimize texture format conversion, and MethodCopyBuffer (#1274) 2020-06-13 19:31:06 -03:00
LayoutConverter.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
OffsetCalculator.cs New NVDEC and VIC implementation (#1384) 2020-07-12 05:07:01 +02:00
Ryujinx.Graphics.Texture.csproj infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
Size.cs Initial work 2020-01-09 02:13:00 +01:00
SizeCalculator.cs Texture Cache: "Texture Groups" and "Texture Dependencies" (#2001) 2021-03-02 19:30:54 -03:00
SizeInfo.cs Texture Cache: "Texture Groups" and "Texture Dependencies" (#2001) 2021-03-02 19:30:54 -03:00