using System;
using SharpDX.Direct3D12;
namespace ComputeSharp.Graphics.Buffers
{
///
/// A representing a typed read write buffer stored on GPU memory
///
/// The type of items stored on the buffer
public sealed class ReadWriteBuffer : Buffer 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 ReadWriteBuffer(GraphicsDevice device, int size) : base(device, size, HeapType.Default) { }
///
/// Gets or sets a single value from the current read write buffer
///
/// The index of the value to get or set
/// This API can only be used from a compute shader, and will always throw if used anywhere else
public T this[uint i]
{
get => throw new InvalidOperationException("The indexer APIs can only be used from a compute shader");
set => throw new InvalidOperationException("The indexer APIs can only be used from a compute shader");
}
}
}