From 48a717f5960d5c071f700382b315d4688a65e64a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 30 Nov 2020 14:02:33 +0100 Subject: [PATCH] Added missing buffer allocation extension --- .../Extensions/GraphicsDeviceExtensions.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs index d46cb48a..9b675154 100644 --- a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs +++ b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs @@ -11,6 +11,20 @@ namespace ComputeSharp /// public static class GraphicsDeviceExtensions { + /// + /// Allocates a new constant buffer with the specified parameters. + /// + /// The type of items to store in the buffer. + /// The instance to use to allocate the buffer. + /// The length of the buffer to allocate. + /// A zeroed instance of size . + [Pure] + public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, int length) + where T : unmanaged + { + return new(device, length); + } + /// /// Allocates a new constant buffer with the specified parameters. ///