Add readback and upload transfer texture 1D types
このコミットが含まれているのは:
1 親
4d0bab3890
コミット
0b6d2b0ddf
3ファイル変更
+92
検索条件に一致するファイルはありません
@@ -0,0 +1,26 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Resources.Debug;
|
||||
|
||||
/// <summary>
|
||||
/// A debug proxy used to display items in a <see cref="TransferTexture1D{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class TransferTexture1DDebugView<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TransferTexture1DDebugView{T}"/> class with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="texture">The input <see cref="TransferTexture1D{T}"/> instance with the items to display.</param>
|
||||
public TransferTexture1DDebugView(TransferTexture1D<T>? texture)
|
||||
{
|
||||
Items = texture?.Span.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items to display for the current instance.
|
||||
/// </summary>
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
|
||||
public T[]? Items { get; }
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Diagnostics;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Resources.Debug;
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> representing a typed 1D texture stored on CPU memory, that can be used to transfer back from the GPU.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
[DebuggerTypeProxy(typeof(TransferTexture1DDebugView<>))]
|
||||
[DebuggerDisplay("{ToString(),raw}")]
|
||||
public sealed class ReadBackTexture1D<T> : TransferTexture1D<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ReadBackTexture1D{T}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
internal ReadBackTexture1D(GraphicsDevice device, int width, AllocationMode allocationMode)
|
||||
: base(device, width, ResourceType.ReadBack, allocationMode)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ComputeSharp.ReadBackTexture1D<{typeof(T)}>[{Width}]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Diagnostics;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Resources.Debug;
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> representing a typed 1D texture stored on CPU memory, that can be used to transfer data to the GPU.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
[DebuggerTypeProxy(typeof(TransferTexture1DDebugView<>))]
|
||||
[DebuggerDisplay("{ToString(),raw}")]
|
||||
public sealed class UploadTexture1D<T> : TransferTexture1D<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UploadTexture1D{T}"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
internal UploadTexture1D(GraphicsDevice device, int width, AllocationMode allocationMode)
|
||||
: base(device, width, ResourceType.Upload, allocationMode)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ComputeSharp.UploadTexture1D<{typeof(T)}>[{Width}]";
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする