Improved Buffer<T> copy APIs, fixed validation
このコミットが含まれているのは:
1 親
3cfec22d8c
コミット
1142d7bbcd
4ファイル変更
+45
-40
検索条件に一致するファイルはありません
@@ -15,12 +15,11 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
/// <param name="source">The source <see cref="ReadOnlySpan{T}"/> to read.</param>
|
||||
/// <param name="destination">The pointer for the destination memory area.</param>
|
||||
/// <param name="destinationOffset">The destination offset to start writing data to.</param>
|
||||
/// <param name="count">The total number of items to copy.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void Copy<T>(ReadOnlySpan<T> source, void* destination, int destinationOffset, int count)
|
||||
public static unsafe void Copy<T>(ReadOnlySpan<T> source, void* destination, int destinationOffset)
|
||||
where T : unmanaged
|
||||
{
|
||||
source.CopyTo(new Span<T>((T*)destination + destinationOffset, count));
|
||||
source.CopyTo(new Span<T>((T*)destination + destinationOffset, source.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,13 +29,11 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
/// <param name="source">The <see cref="IntPtr"/> that indicates the memory area to read from.</param>
|
||||
/// <param name="sourceOffset">The source offset to start reading data from.</param>
|
||||
/// <param name="destination">The destination <see cref="Span{T}"/> to write.</param>
|
||||
/// <param name="destinationOffset">The destination offset to start writing data to.</param>
|
||||
/// <param name="count">The total number of items to copy.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void Copy<T>(void* source, int sourceOffset, Span<T> destination, int count)
|
||||
public static unsafe void Copy<T>(void* source, int sourceOffset, Span<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
new Span<T>((T*)source + sourceOffset, count).CopyTo(destination.Slice(0, count));
|
||||
new Span<T>((T*)source + sourceOffset, destination.Length).CopyTo(destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする