From bde2f35fe6079c0eee8c1d94cfb162fb4f4335c6 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 12 Aug 2019 12:01:29 +0200 Subject: [PATCH] Added Bufffer2 indexer --- src/ComputeSharp.Graphics/Buffers/Buffer2.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ComputeSharp.Graphics/Buffers/Buffer2.cs b/src/ComputeSharp.Graphics/Buffers/Buffer2.cs index 740de6b8..bf4b2d5b 100644 --- a/src/ComputeSharp.Graphics/Buffers/Buffer2.cs +++ b/src/ComputeSharp.Graphics/Buffers/Buffer2.cs @@ -108,6 +108,17 @@ namespace ComputeSharp.Graphics.Buffers /// public HeapType HeapType { get; } + /// + /// Gets or sets a single value from the current 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[int 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"); + } + /// /// Reads the contents of the current instance and writes them into a target ///