aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image')
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureBuffer.cs4
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureView.cs14
2 files changed, 6 insertions, 12 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureBuffer.cs b/Ryujinx.Graphics.OpenGL/Image/TextureBuffer.cs
index f49a0647..8d407ccb 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureBuffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureBuffer.cs
@@ -38,9 +38,9 @@ namespace Ryujinx.Graphics.OpenGL.Image
throw new NotSupportedException();
}
- public byte[] GetData()
+ public ReadOnlySpan<byte> GetData()
{
- return Buffer.GetData(_buffer, _bufferOffset, _bufferSize);
+ return Buffer.GetData(_renderer, _buffer, _bufferOffset, _bufferSize);
}
public void SetData(ReadOnlySpan<byte> data)
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
index 5e7b5f22..460d1da4 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
@@ -119,7 +119,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
_renderer.TextureCopy.Copy(this, (TextureView)destination, srcRegion, dstRegion, linearFilter);
}
- public byte[] GetData()
+ public unsafe ReadOnlySpan<byte> GetData()
{
int size = 0;
@@ -134,17 +134,11 @@ namespace Ryujinx.Graphics.OpenGL.Image
}
else
{
- byte[] data = new byte[size];
+ IntPtr target = _renderer.PersistentBuffers.Default.GetHostArray(size);
- unsafe
- {
- fixed (byte* ptr = data)
- {
- WriteTo((IntPtr)ptr);
- }
- }
+ WriteTo(target);
- return data;
+ return new ReadOnlySpan<byte>(target.ToPointer(), size);
}
}