Add new ReadBackBufferExtensions type

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-12 02:03:03 +01:00
1 親 c657730249
コミット 29944625e0
2ファイル変更
+126 -12

検索条件に一致するファイルはありません

+36
ファイルの表示
@@ -0,0 +1,36 @@
using ComputeSharp.Resources;
namespace ComputeSharp;
/// <summary>
/// A <see langword="class"/> that contains extension methods for the <see cref="ReadBackBuffer{T}"/> type.
/// </summary>
public static class ReadBackBufferExtensions
{
/// <summary>
/// Reads the contents of a <see cref="StructuredBuffer{T}"/> instance and writes them into a target <see cref="ReadBackBuffer{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
/// <param name="source">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source)
where T : unmanaged
{
source.CopyTo(destination, 0, 0, source.Length);
}
/// <summary>
/// Reads the contents of a <see cref="StructuredBuffer{T}"/> instance and writes them into a target <see cref="ReadBackBuffer{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
/// <param name="source">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
/// <param name="sourceOffset">The offset to start reading data from.</param>
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
/// <param name="count">The number of items to read.</param>
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
}