From 79c4df4a096c9584d36f4d5279c49934d4549383 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 12 Aug 2019 12:04:16 +0200 Subject: [PATCH] Added Buffer2.GetData() overload --- src/ComputeSharp.Graphics/Buffers/Buffer2.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/ComputeSharp.Graphics/Buffers/Buffer2.cs b/src/ComputeSharp.Graphics/Buffers/Buffer2.cs index bf4b2d5b..26f4d91d 100644 --- a/src/ComputeSharp.Graphics/Buffers/Buffer2.cs +++ b/src/ComputeSharp.Graphics/Buffers/Buffer2.cs @@ -119,6 +119,19 @@ namespace ComputeSharp.Graphics.Buffers set => throw new InvalidOperationException("The indexer APIs can only be used from a compute shader"); } + /// + /// Reads the contents of the current instance and returns an array + /// + /// A array with the contents of the current buffer + [Pure] + public T[] GetData() + { + T[] data = new T[Size]; + GetData(data); + + return data; + } + /// /// Reads the contents of the current instance and writes them into a target ///