From 8f05db321e3dd22bfb8eb6f0868fe32fb3cdbe80 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 24 Aug 2019 23:57:06 +0200 Subject: [PATCH] Fixed buffer accessors to support the new APIs --- src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs | 4 ++-- src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs index 1b4e1073..d3ad9052 100644 --- a/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs @@ -18,9 +18,9 @@ namespace ComputeSharp.Graphics.Buffers internal ReadOnlyBuffer(GraphicsDevice device, int size) : base(device, size, BufferType.ReadOnly) { } /// - /// Gets or sets a single value from the current read write buffer + /// Gets a single value from the current read write buffer /// - /// The index of the value to get or set + /// 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[uint i] => throw new InvalidExecutionContextException($"{nameof(ReadOnlyBuffer)}[uint i]"); } diff --git a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs index def4e799..9e71a9c3 100644 --- a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs @@ -22,10 +22,6 @@ namespace ComputeSharp.Graphics.Buffers /// /// 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 InvalidExecutionContextException($"{nameof(ReadWriteBuffer)}[uint i]"); - set => throw new InvalidExecutionContextException($"{nameof(ReadWriteBuffer)}[uint i]"); - } + public ref T this[uint i] => throw new InvalidExecutionContextException($"{nameof(ReadWriteBuffer)}[uint i]"); } }