Spanify Graphics Abstraction Layer (#1226)
* Spanify Graphics Abstraction Layer * Be explicit about BufferHandle size
This commit is contained in:
parent
cc8dbdd3fb
commit
5011640b30
24 changed files with 208 additions and 134 deletions
|
@ -11,9 +11,9 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
private readonly GpuContext _context;
|
||||
|
||||
/// <summary>
|
||||
/// Host buffer object.
|
||||
/// Host buffer handle.
|
||||
/// </summary>
|
||||
public IBuffer HostBuffer { get; }
|
||||
public BufferHandle Handle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Start address of the buffer in guest memory.
|
||||
|
@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
Address = address;
|
||||
Size = size;
|
||||
|
||||
HostBuffer = context.Renderer.CreateBuffer((int)size);
|
||||
Handle = context.Renderer.CreateBuffer((int)size);
|
||||
|
||||
_modifiedRanges = new (ulong, ulong)[size / PhysicalMemory.PageSize];
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
int offset = (int)(address - Address);
|
||||
|
||||
return new BufferRange(HostBuffer, offset, (int)size);
|
||||
return new BufferRange(Handle, offset, (int)size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -125,7 +125,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
|
||||
int offset = (int)(mAddress - Address);
|
||||
|
||||
HostBuffer.SetData(offset, _context.PhysicalMemory.GetSpan(mAddress, (int)mSize));
|
||||
_context.Renderer.SetBufferData(Handle, offset, _context.PhysicalMemory.GetSpan(mAddress, (int)mSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// <param name="dstOffset">The offset of the destination buffer to copy into</param>
|
||||
public void CopyTo(Buffer destination, int dstOffset)
|
||||
{
|
||||
HostBuffer.CopyTo(destination.HostBuffer, 0, dstOffset, (int)Size);
|
||||
_context.Renderer.Pipeline.CopyBuffer(Handle, destination.Handle, 0, dstOffset, (int)Size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
{
|
||||
int offset = (int)(address - Address);
|
||||
|
||||
byte[] data = HostBuffer.GetData(offset, (int)size);
|
||||
byte[] data = _context.Renderer.GetBufferData(Handle, offset, (int)size);
|
||||
|
||||
_context.PhysicalMemory.Write(address, data);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
HostBuffer.Dispose();
|
||||
_context.Renderer.DeleteBuffer(Handle);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue