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:
parent
8d4bee3ea9
commit
f94acdb4ef
2 changed files with 36 additions and 2 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue