diff --git a/src/Graphics/Resources/Buffer.cs b/src/Graphics/Resources/Buffer.cs index be11ec27..e8e56210 100644 --- a/src/Graphics/Resources/Buffer.cs +++ b/src/Graphics/Resources/Buffer.cs @@ -11,6 +11,27 @@ namespace MoonWorks.Graphics { protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyBuffer; + /// + /// Creates a buffer of appropriate size given a type and element count. + /// + /// The type that the buffer will contain. + /// The GraphicsDevice. + /// Specifies how the buffer will be used. + /// How many elements of type T the buffer will contain. + /// + public static Buffer Create( + GraphicsDevice device, + BufferUsageFlags usageFlags, + uint elementCount + ) + { + return new Buffer( + device, + usageFlags, + (uint) Marshal.SizeOf() * elementCount + ); + } + /// /// Creates a buffer. ///