diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs
index 44d94af1..09e384e2 100644
--- a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs
+++ b/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs
@@ -25,10 +25,19 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
///
/// A array with the contents of the current buffer
[Pure]
- public T[] GetData()
+ public T[] GetData() => GetData(0, Size);
+
+ ///
+ /// Reads the contents of the current instance in a given range and returns an array
+ ///
+ /// The offset to start reading data from
+ /// The number of items to read
+ /// A array with the contents of the specified range from the current buffer
+ [Pure]
+ public T[] GetData(int offset, int count)
{
- T[] data = new T[Size];
- GetData(data);
+ T[] data = new T[count];
+ GetData(data, offset, count);
return data;
}
@@ -37,7 +46,15 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
/// Reads the contents of the current instance and writes them into a target
///
/// The input to write data to
- public abstract void GetData(Span span);
+ public void GetData(Span span) => GetData(span, 0, Size);
+
+ ///
+ /// Reads the contents of the specified range from the current instance and writes them into a target
+ ///
+ /// The input to write data to
+ /// The offset to start reading data from
+ /// The number of items to read
+ public abstract void GetData(Span span, int offset, int count);
///
/// Writes the contents of a given array to the current instance
@@ -45,11 +62,27 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
/// The input array to read data from
public void SetData(T[] array) => SetData(array.AsSpan());
+ ///
+ /// Writes the contents of a given array to a specified area of the current instance
+ ///
+ /// The input array to read data from
+ /// The offset to start writing data to
+ /// The number of items to write
+ public void SetData(T[] array, int offset, int count) { }
+
///
/// Writes the contents of a given to the current instance
///
/// The input to read data from
- public abstract void SetData(Span span);
+ public void SetData(Span span) => SetData(span, 0, Size);
+
+ ///
+ /// Writes the contents of a given to a specified area of the current instance
+ ///
+ /// The input to read data from
+ /// The offset to start writing data to
+ /// The number of items to write
+ public abstract void SetData(Span span, int offset, int count);
///
/// Writes the contents of a given to the current instance