Allow out of bounds storage buffer access by aligning their sizes (#1870)

* Allow out of bounds storage buffer access by aligning their sizes

* Use correct size

* Fix typo and comment on the reason for the change
This commit is contained in:
gdkchan 2021-01-24 19:22:19 -03:00 committed by GitHub
parent 8d4bee3ea9
commit f94acdb4ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View file

@ -88,6 +88,21 @@ namespace Ryujinx.Graphics.Gpu.Memory
_modifiedDelegate = new Action<ulong, ulong>(RegionModified);
}
/// <summary>
/// Gets a sub-range from the buffer, from a start address till the end of the buffer.
/// </summary>
/// <remarks>
/// This can be used to bind and use sub-ranges of the buffer on the host API.
/// </remarks>
/// <param name="address">Start address of the sub-range, must be greater than or equal to the buffer address</param>
/// <returns>The buffer sub-range</returns>
public BufferRange GetRange(ulong address)
{
ulong offset = address - Address;
return new BufferRange(Handle, (int)offset, (int)(Size - offset));
}
/// <summary>
/// Gets a sub-range from the buffer.
/// </summary>