aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image/TextureView.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureView.cs26
1 files changed, 25 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
index 770e99a0..5e7b5f22 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureView.cs
@@ -121,7 +121,31 @@ namespace Ryujinx.Graphics.OpenGL.Image
public byte[] GetData()
{
- return _renderer.PersistentBuffers.Default.GetTextureData(this);
+ int size = 0;
+
+ for (int level = 0; level < Info.Levels; level++)
+ {
+ size += Info.GetMipSize(level);
+ }
+
+ if (HwCapabilities.UsePersistentBufferForFlush)
+ {
+ return _renderer.PersistentBuffers.Default.GetTextureData(this, size);
+ }
+ else
+ {
+ byte[] data = new byte[size];
+
+ unsafe
+ {
+ fixed (byte* ptr = data)
+ {
+ WriteTo((IntPtr)ptr);
+ }
+ }
+
+ return data;
+ }
}
public void WriteToPbo(int offset, bool forceBgra)