Added BufferDebugView3D<T> type, minor bug fixes

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-06 22:58:03 +01:00
1 親 9806d02279
コミット d557d7264e
4ファイル変更
+41 -2

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

+2
ファイルの表示
@@ -3,6 +3,7 @@ using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Buffers.Views;
namespace ComputeSharp
{
@@ -10,6 +11,7 @@ namespace ComputeSharp
/// A <see langword="class"/> representing a typed readonly 3D texture stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
[DebuggerTypeProxy(typeof(BufferDebugView3D<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadOnlyTexture3D<T> : Texture3D<T>
where T : unmanaged
+3 -1
ファイルの表示
@@ -3,6 +3,7 @@ using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
using ComputeSharp.Graphics.Buffers.Views;
namespace ComputeSharp
{
@@ -10,6 +11,7 @@ namespace ComputeSharp
/// A <see langword="class"/> representing a typed readonly 3D texture stored on GPU memory.
/// </summary>
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
[DebuggerTypeProxy(typeof(BufferDebugView3D<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadWriteTexture3D<T> : Texture3D<T>
where T : unmanaged
@@ -36,7 +38,7 @@ namespace ComputeSharp
/// <inheritdoc/>
public override string ToString()
{
return $"ComputeSharp.ReadOnlyTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]";
return $"ComputeSharp.ReadWriteTexture3D<{typeof(T)}>[{Width}, {Height}, {Depth}]";
}
}
}
+1 -1
ファイルの表示
@@ -20,7 +20,7 @@ namespace ComputeSharp.Graphics.Buffers.Views
{
var items = new T[texture.Height, texture.Width];
texture.GetData(ref items[0, 0], items.Length, 0, 0, texture.Height, texture.Width);
texture.GetData(ref items[0, 0], items.Length, 0, 0, texture.Width, texture.Height);
Items = items;
}
+35
ファイルの表示
@@ -0,0 +1,35 @@
using System.Diagnostics;
using ComputeSharp.Graphics.Buffers.Abstract;
namespace ComputeSharp.Graphics.Buffers.Views
{
/// <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 BufferDebugView3D<T>
where T : unmanaged
{
/// <summary>
/// Initializes a new instance of the <see cref="BufferDebugView3D{T}"/> class with the specified parameters.
/// </summary>
/// <param name="texture">The input <see cref="Texture3D{T}"/> instance with the items to display.</param>
public BufferDebugView3D(Texture3D<T>? texture)
{
if (texture is not null)
{
var items = new T[texture.Depth, texture.Height, texture.Width];
texture.GetData(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; }
}
}