diff options
author | riperiperi <rhy3756547@hotmail.com> | 2021-07-18 15:45:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-18 11:45:50 -0300 |
commit | 10e17ab423ba84856eb7411ce04d38989ac70a58 (patch) | |
tree | 80fa24a8db3f5949fac8cc28873d82280e93328e /Ryujinx.Graphics.OpenGL/Image/TextureView.cs | |
parent | b8ad676fb8cbe0a43617df41daaf284ab4421c75 (diff) |
Only use persistent buffers to flush on NVIDIA and Windows+AMD (#2489)
It seems like this method of flushing data is much slower on Mesa drivers, and slightly slower on Intel Windows. Have not tested Intel Mesa, but I'm assuming it is the same as AMD.
This also adds vendor detection for AMD on Unix, which counted as "Unknown" before.
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image/TextureView.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/Image/TextureView.cs | 26 |
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) |