Code refactoring
このコミットが含まれているのは:
1 親
984d1113f8
コミット
9edbdcfdc3
3ファイル変更
+23
-48
検索条件に一致するファイルはありません
@@ -63,20 +63,7 @@ namespace ComputeSharp.Graphics.Buffers
|
||||
/// <inheritdoc/>
|
||||
public override void SetData(ReadOnlyBuffer<T> buffer)
|
||||
{
|
||||
if (buffer.IsPaddingPresent)
|
||||
{
|
||||
// Create a temporary array
|
||||
T[] array = ArrayPool<T>.Shared.Rent(buffer.Size);
|
||||
Span<T> span = array.AsSpan(buffer.Size);
|
||||
|
||||
// Get the data from the readonly array, removing the padding
|
||||
buffer.GetData(span);
|
||||
|
||||
// Set the data to the current buffer
|
||||
SetData(span);
|
||||
|
||||
ArrayPool<T>.Shared.Return(array);
|
||||
}
|
||||
if (buffer.IsPaddingPresent) SetDataWithCpuBuffer(buffer);
|
||||
else
|
||||
{
|
||||
// Directly copy the input buffer
|
||||
@@ -86,21 +73,5 @@ namespace ComputeSharp.Graphics.Buffers
|
||||
copyCommandList.Flush(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void SetData(ReadWriteBuffer<T> buffer)
|
||||
{
|
||||
// Create a temporary array
|
||||
T[] array = ArrayPool<T>.Shared.Rent(buffer.Size);
|
||||
Span<T> span = array.AsSpan(buffer.Size);
|
||||
|
||||
// Get the unpadded data from the read write buffer
|
||||
buffer.GetData(span);
|
||||
|
||||
// Set the data to the current buffer
|
||||
SetData(span);
|
||||
|
||||
ArrayPool<T>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする