diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index 076718e5..4bbefd0b 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// /// Represents a cached GPU texture. /// - class Texture : IRange, IDisposable + class Texture : IRange, IDisposable { private GpuContext _context; diff --git a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs index 99818bc8..8af61d3d 100644 --- a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs +++ b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs @@ -6,16 +6,14 @@ namespace Ryujinx.Graphics.Gpu.Memory /// /// Buffer, used to store vertex and index data, uniform and storage buffers, and others. /// - class Buffer : IRange, IDisposable + class Buffer : IRange, IDisposable { - private GpuContext _context; - - private IBuffer _buffer; + private readonly GpuContext _context; /// /// Host buffer object. /// - public IBuffer HostBuffer => _buffer; + public IBuffer HostBuffer { get; } /// /// Start address of the buffer in guest memory. @@ -46,7 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Memory Address = address; Size = size; - _buffer = context.Renderer.CreateBuffer((int)size); + HostBuffer = context.Renderer.CreateBuffer((int)size); _sequenceNumbers = new int[size / MemoryManager.PageSize]; @@ -64,7 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Memory { int offset = (int)(address - Address); - return new BufferRange(_buffer, offset, (int)size); + return new BufferRange(HostBuffer, offset, (int)size); } /// @@ -121,7 +119,7 @@ namespace Ryujinx.Graphics.Gpu.Memory int offset = (int)(mAddress - Address); - _buffer.SetData(offset, _context.PhysicalMemory.Read(mAddress, mSize)); + HostBuffer.SetData(offset, _context.PhysicalMemory.Read(mAddress, mSize)); } } @@ -132,7 +130,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// The offset of the destination buffer to copy into public void CopyTo(Buffer destination, int dstOffset) { - _buffer.CopyTo(destination._buffer, 0, dstOffset, (int)Size); + HostBuffer.CopyTo(destination.HostBuffer, 0, dstOffset, (int)Size); } /// @@ -145,7 +143,7 @@ namespace Ryujinx.Graphics.Gpu.Memory { int offset = (int)(address - Address); - byte[] data = _buffer.GetData(offset, (int)size); + byte[] data = HostBuffer.GetData(offset, (int)size); _context.PhysicalMemory.Write(address, data); } @@ -155,7 +153,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// public void Invalidate() { - _buffer.SetData(0, _context.PhysicalMemory.Read(Address, Size)); + HostBuffer.SetData(0, _context.PhysicalMemory.Read(Address, Size)); } /// @@ -163,7 +161,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// public void Dispose() { - _buffer.Dispose(); + HostBuffer.Dispose(); } } } \ No newline at end of file diff --git a/Ryujinx.Graphics.Gpu/Memory/IRange.cs b/Ryujinx.Graphics.Gpu/Memory/IRange.cs index 6d275d3f..9d5eee0b 100644 --- a/Ryujinx.Graphics.Gpu/Memory/IRange.cs +++ b/Ryujinx.Graphics.Gpu/Memory/IRange.cs @@ -3,8 +3,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// /// Range of memory. /// - /// GPU resource type - interface IRange + interface IRange { ulong Address { get; } ulong Size { get; } diff --git a/Ryujinx.Graphics.Gpu/Memory/RangeList.cs b/Ryujinx.Graphics.Gpu/Memory/RangeList.cs index 75be1cf2..638108fe 100644 --- a/Ryujinx.Graphics.Gpu/Memory/RangeList.cs +++ b/Ryujinx.Graphics.Gpu/Memory/RangeList.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// List of GPU resources with data on guest memory. /// /// Type of the GPU resource - class RangeList : IEnumerable where T : IRange + class RangeList : IEnumerable where T : IRange { private const int ArrayGrowthSize = 32;