using ComputeSharp.Exceptions;
using ComputeSharp.Graphics;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Graphics.Buffers.Enums;
namespace ComputeSharp
{
///
/// A representing a typed readonly buffer stored on GPU memory
///
/// The type of items stored on the buffer
public sealed class ReadOnlyBuffer2 : HlslStructuredBuffer2
where T : unmanaged
{
///
/// Creates a new instance with the specified parameters
///
/// The associated with the current instance
/// The number of items to store in the current buffer
internal ReadOnlyBuffer2(GraphicsDevice2 device, int size)
: base(device, size, BufferType.ReadOnly)
{
}
///
/// Gets a single value from the current read write buffer
///
/// The index of the value to get
/// This API can only be used from a compute shader, and will always throw if used anywhere else
public T this[int i] => throw new InvalidExecutionContextException($"{nameof(ReadOnlyBuffer)}[int]");
}
}