GreemDev-Ryujinx/Ryujinx.Graphics.GAL
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
..
AddressMode.cs
BlendDescriptor.cs
BlendFactor.cs
BlendOp.cs
BufferHandle.cs
BufferRange.cs
Capabilities.cs Fix texture sampling with depth compare and LOD level or bias (#2404) 2021-06-25 00:54:50 +02:00
ColorF.cs
CompareMode.cs
CompareOp.cs
CounterType.cs
DepthMode.cs
DepthStencilMode.cs
DepthStencilState.cs
DepthTestDescriptor.cs
Extents2D.cs Allow copy destination to have a different scale from source (#1711) 2020-11-20 17:14:45 -03:00
Face.cs
Format.cs Implement ETC2 (RGB) texture format (#2000) 2021-02-08 10:23:56 +11:00
FrontFace.cs
ICounterEvent.cs
ImageCrop.cs gui/gpu: Implement setting and toggle for Aspect Ratio (#1777) 2020-12-15 23:19:07 -03:00
IndexType.cs
IPipeline.cs Add support for custom line widths (#2406) 2021-06-25 20:11:54 -03:00
IProgram.cs Implement parallel host shader cache compilation. 2021-04-18 17:33:58 +01:00
IRenderer.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
ISampler.cs
IShader.cs
ITexture.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
IWindow.cs
LogicalOp.cs
MagFilter.cs
MinFilter.cs
Origin.cs
PolygonModeMask.cs
PrimitiveTopology.cs
ProgramLinkStatus.cs Implement parallel host shader cache compilation. 2021-04-18 17:33:58 +01:00
RectangleF.cs
Ryujinx.Graphics.GAL.csproj infra: Migrate to .NET 5 (#1694) 2020-11-15 19:27:15 +01:00
SamplerCreateInfo.cs
ScreenCaptureImageInfo.cs Add Screenshot Feature (#2354) 2021-06-28 22:09:43 +02:00
StencilOp.cs
StencilTestDescriptor.cs
SwizzleComponent.cs
Target.cs
TextureCreateInfo.cs
TextureReleaseCallback.cs
TransformFeedbackDescriptor.cs
VertexAttribDescriptor.cs Avoid some redundant GL calls (#1958) 2021-01-27 08:44:07 +11:00
VertexBufferDescriptor.cs
Viewport.cs
ViewportSwizzle.cs