Refactored public Buffer<T> APIs

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-06 21:46:43 +01:00
1 親 ccec496316
コミット 0e2d604f47
4ファイル変更
+173 -124

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

+11 -2
ファイルの表示
@@ -1,4 +1,6 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using ComputeSharp.Graphics.Buffers.Abstract;
namespace ComputeSharp.Graphics.Buffers.Views
@@ -16,7 +18,14 @@ namespace ComputeSharp.Graphics.Buffers.Views
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance with the items to display.</param>
public BufferDebugView(Buffer<T>? buffer)
{
Items = buffer?.GetData();
if (buffer is not null)
{
var items = GC.AllocateUninitializedArray<T>(buffer.Length);
buffer.GetData(ref MemoryMarshal.GetArrayDataReference(items), buffer.Length, 0);
Items = items;
}
}
/// <summary>