Spanify Graphics Abstraction Layer (#1226)

* Spanify Graphics Abstraction Layer

* Be explicit about BufferHandle size
This commit is contained in:
gdkchan 2020-05-23 06:46:09 -03:00 committed by GitHub
parent cc8dbdd3fb
commit 5011640b30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 208 additions and 134 deletions

View file

@ -1,6 +1,7 @@
using OpenTK.Graphics.OpenGL;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.OpenGL.Image;
using Ryujinx.Graphics.OpenGL.Queries;
using Ryujinx.Graphics.Shader;
using System;
@ -38,9 +39,9 @@ namespace Ryujinx.Graphics.OpenGL
return new Shader(shader);
}
public IBuffer CreateBuffer(int size)
public BufferHandle CreateBuffer(int size)
{
return new Buffer(size);
return Buffer.Create(size);
}
public IProgram CreateProgram(IShader[] shaders)
@ -58,6 +59,16 @@ namespace Ryujinx.Graphics.OpenGL
return info.Target == Target.TextureBuffer ? new TextureBuffer(info) : new TextureStorage(this, info).CreateDefaultView();
}
public void DeleteBuffer(BufferHandle buffer)
{
Buffer.Delete(buffer);
}
public byte[] GetBufferData(BufferHandle buffer, int offset, int size)
{
return Buffer.GetData(buffer, offset, size);
}
public Capabilities GetCapabilities()
{
return new Capabilities(
@ -68,6 +79,11 @@ namespace Ryujinx.Graphics.OpenGL
HwCapabilities.MaxSupportedAnisotropy);
}
public void SetBufferData(BufferHandle buffer, int offset, ReadOnlySpan<byte> data)
{
Buffer.SetData(buffer, offset, data);
}
public void UpdateCounters()
{
_counters.Update();