aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-01-24 19:22:19 -0300
committerGitHub <noreply@github.com>2021-01-25 09:22:19 +1100
commitf94acdb4efcf48555481f38417f8befa4ca560ad (patch)
tree2c16377cc2938cc4dfdca58cff03e050e8d3b215 /Ryujinx.Graphics.Gpu/Memory/Buffer.cs
parent8d4bee3ea90bc1e75006bdf64f859204991a37a2 (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Memory/Buffer.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Memory/Buffer.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
index 7127871a..cdd61b6d 100644
--- a/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
+++ b/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
@@ -89,6 +89,21 @@ namespace Ryujinx.Graphics.Gpu.Memory
}
/// <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>
/// <remarks>