Flush buffers and texture data through a persistent mapped buffer. (#2481)

* Use persistent buffers to flush texture data

* Flush buffers via copy to persistent buffers.

* Log error when timing out, small refactoring.
This commit is contained in:
riperiperi 2021-07-16 22:10:20 +01:00 committed by GitHub
parent bb6fab2009
commit ca5ac37cd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 135 additions and 23 deletions

View file

@ -30,6 +30,8 @@ namespace Ryujinx.Graphics.OpenGL
public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
internal PersistentBuffers PersistentBuffers { get; }
internal ResourcePool ResourcePool { get; }
internal int BufferCount { get; private set; }
@ -46,6 +48,7 @@ namespace Ryujinx.Graphics.OpenGL
_textureCopy = new TextureCopy(this);
_backgroundTextureCopy = new TextureCopy(this);
_sync = new Sync();
PersistentBuffers = new PersistentBuffers();
ResourcePool = new ResourcePool();
}
@ -90,7 +93,7 @@ namespace Ryujinx.Graphics.OpenGL
public byte[] GetBufferData(BufferHandle buffer, int offset, int size)
{
return Buffer.GetData(buffer, offset, size);
return PersistentBuffers.Default.GetBufferData(buffer, offset, size);
}
public Capabilities GetCapabilities()
@ -177,6 +180,7 @@ namespace Ryujinx.Graphics.OpenGL
{
_textureCopy.Dispose();
_backgroundTextureCopy.Dispose();
PersistentBuffers.Dispose();
ResourcePool.Dispose();
_pipeline.Dispose();
_window.Dispose();