Added TerraFX buffer types

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-17 13:36:23 +01:00
1 親 c491d8c57c
コミット b5f3bf07e3
6ファイル変更
+366 -1

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

+32
ファイルの表示
@@ -0,0 +1,32 @@
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> representing a typed readonly buffer stored on GPU memory
/// </summary>
/// <typeparam name="T">The type of items stored on the buffer</typeparam>
public sealed class ReadOnlyBuffer2<T> : HlslStructuredBuffer2<T>
where T : unmanaged
{
/// <summary>
/// Creates a new <see cref="ReadOnlyBuffer2{T}"/> instance with the specified parameters
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance</param>
/// <param name="size">The number of items to store in the current buffer</param>
internal ReadOnlyBuffer2(GraphicsDevice2 device, int size)
: base(device, size, BufferType.ReadOnly)
{
}
/// <summary>
/// Gets a single <typeparamref name="T"/> value from the current read write buffer
/// </summary>
/// <param name="i">The index of the value to get</param>
/// <remarks>This API can only be used from a compute shader, and will always throw if used anywhere else</remarks>
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadOnlyBuffer<T>)}<T>[int]");
}
}