Minor code refactoring
このコミットが含まれているのは:
1 親
6629e94f0a
コミット
56026b3290
20ファイル変更
+20
-20
検索条件に一致するファイルはありません
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class BufferDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BufferDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> instance with the items to display.</param>
|
||||
public BufferDebugView(Buffer<T>? buffer)
|
||||
{
|
||||
if (buffer is not null)
|
||||
{
|
||||
var items = GC.AllocateUninitializedArray<T>(buffer.Length);
|
||||
|
||||
buffer.CopyTo(ref items[0], buffer.Length, 0);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[]? Items { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="Texture2D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class Texture2DDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Texture2DDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="texture">The input <see cref="Texture2D{T}"/> instance with the items to display.</param>
|
||||
public Texture2DDebugView(Texture2D<T>? texture)
|
||||
{
|
||||
if (texture is not null)
|
||||
{
|
||||
var items = new T[texture.Height, texture.Width];
|
||||
|
||||
texture.CopyTo(ref items[0, 0], items.Length, 0, 0, texture.Width, texture.Height);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[,]? Items { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="Texture3D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class Texture3DDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Texture3DDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance with the items to display.</param>
|
||||
public Texture3DDebugView(Texture3D<T>? texture)
|
||||
{
|
||||
if (texture is not null)
|
||||
{
|
||||
var items = new T[texture.Depth, texture.Height, texture.Width];
|
||||
|
||||
texture.CopyTo(ref items[0, 0, 0], items.Length, 0, 0, 0, texture.Width, texture.Height, texture.Depth);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[,,]? Items { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="TransferBuffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class TransferBufferDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TransferBufferDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="buffer">The input <see cref="TransferBuffer{T}"/> instance with the items to display.</param>
|
||||
public TransferBufferDebugView(TransferBuffer<T>? buffer)
|
||||
{
|
||||
if (buffer is not null)
|
||||
{
|
||||
var items = GC.AllocateUninitializedArray<T>(buffer.Length);
|
||||
|
||||
buffer.Span.CopyTo(items);
|
||||
|
||||
Items = items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[]? Items { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="TransferTexture2D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class TransferTexture2DDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TransferTexture2DDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="texture">The input <see cref="TransferTexture2D{T}"/> instance with the items to display.</param>
|
||||
public TransferTexture2DDebugView(TransferTexture2D<T>? texture)
|
||||
{
|
||||
Items = texture?.Span.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[,]? Items { get; }
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする