Example #1
0
 /// <summary>
 /// Creates a new Vertex buffer with <see cref="GraphicsResourceUsage.Immutable"/> uasge by default.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="value">The value to initialize the Vertex buffer.</param>
 /// <param name="usage">The usage of this resource.</param>
 /// <returns>A Vertex buffer</returns>
 public static Buffer New(GraphicsDevice device, DataPointer value, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
 {
     return(Buffer.New(device, value, 0, BufferFlags.VertexBuffer, usage));
 }
Example #2
0
 /// <summary>
 /// Creates a new <see cref="Buffer" /> instance.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="dataPointer">The data pointer.</param>
 /// <param name="elementSize">Size of the element.</param>
 /// <param name="bufferFlags">The buffer flags to specify the type of buffer.</param>
 /// <param name="usage">The usage.</param>
 /// <returns>An instance of a new <see cref="Buffer" /></returns>
 public static Buffer New(GraphicsDevice device, DataPointer dataPointer, int elementSize, BufferFlags bufferFlags, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(New(device, dataPointer, elementSize, bufferFlags, PixelFormat.None, usage));
 }
Example #3
0
 /// <summary>
 /// Creates a new Raw buffer with <see cref="GraphicsResourceUsage.Default"/> uasge by default.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="value">The value to initialize the Raw buffer.</param>
 /// <param name="additionalBindings">The additional bindings (for example, to create a combined raw/index buffer, pass <see cref="BufferFlags.IndexBuffer" />)</param>
 /// <param name="usage">The usage of this resource.</param>
 /// <returns>A Raw buffer</returns>
 public static Buffer New(GraphicsDevice device, DataPointer value, BufferFlags additionalBindings = BufferFlags.None, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(Buffer.New(device, value, 0, BufferFlags.RawBuffer | additionalBindings, usage));
 }
Example #4
0
            /// <summary>
            /// Creates a new StructuredCounter buffer <see cref="GraphicsResourceUsage.Default" /> uasge.
            /// </summary>
            /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
            /// <param name="value">The value to initialize the StructuredCounter buffer.</param>
            /// <param name="elementSize">Size of the element.</param>
            /// <returns>A StructuredCounter buffer</returns>
            public static Buffer New(GraphicsDevice device, DataPointer value, int elementSize)
            {
                const BufferFlags BufferFlags = BufferFlags.StructuredCounterBuffer | BufferFlags.ShaderResource | BufferFlags.UnorderedAccess;

                return(Buffer.New(device, value, elementSize, BufferFlags));
            }
Example #5
0
 /// <summary>
 /// Creates a new Typed buffer <see cref="GraphicsResourceUsage.Default" /> uasge.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="value">The value to initialize the Typed buffer.</param>
 /// <param name="viewFormat">The view format of the buffer.</param>
 /// <param name="isUnorderedAccess">if set to <c>true</c> this buffer supports unordered access (RW in HLSL).</param>
 /// <param name="usage">The usage of this resource.</param>
 /// <returns>A Typed buffer</returns>
 public static Buffer New(GraphicsDevice device, DataPointer value, PixelFormat viewFormat, bool isUnorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(Buffer.New(device, value, 0, BufferFlags.ShaderResource | (isUnorderedAccess ? BufferFlags.UnorderedAccess : BufferFlags.None), viewFormat, usage));
 }
Example #6
0
 /// <summary>
 /// Creates a new constant buffer with <see cref="GraphicsResourceUsage.Dynamic"/> usage.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <param name="value">The value to initialize the constant buffer.</param>
 /// <param name="usage">The usage of this resource.</param>
 /// <returns>A constant buffer</returns>
 public static Buffer New(GraphicsDevice device, DataPointer value, GraphicsResourceUsage usage = GraphicsResourceUsage.Dynamic)
 {
     return(Buffer.New(device, value, 0, BufferFlags.ConstantBuffer, usage));
 }