/// <summary> /// Creates the buffer description. /// </summary> /// <param name="size">The size (in bytes).</param> /// <param name="flags">The flags.</param> /// <param name="format">The format.</param> /// <param name="initData">The initial data.</param> /// <param name="stride">The stride.</param> /// <param name="usage">The usage.</param> /// <returns>The buffer description.</returns> public static GPUBufferDescription Buffer(int size, GPUBufferFlags flags, PixelFormat format = PixelFormat.Unknown, IntPtr initData = new IntPtr(), int stride = 0, GPUResourceUsage usage = GPUResourceUsage.Default) { GPUBufferDescription desc; desc.Size = (uint)size; desc.Stride = (uint)stride; desc.Flags = flags; desc.Format = format; desc.InitData = initData; desc.Usage = usage; return(desc); }
/// <summary> /// Creates raw buffer description. /// </summary> /// <param name="data">The initial data.</param> /// <param name="size">The size (in bytes).</param> /// <param name="additionalFlags">The additional bindings (for example, to create a combined raw/index buffer, pass <see cref="GPUBufferFlags.IndexBuffer" />).</param> /// <param name="usage">The usage.</param> /// <returns>The buffer description.</returns> public static GPUBufferDescription Raw(IntPtr data, int size, GPUBufferFlags additionalFlags = GPUBufferFlags.None, GPUResourceUsage usage = GPUResourceUsage.Default) { return(Buffer(size, GPUBufferFlags.RawBuffer | additionalFlags, PixelFormat.R32_Typeless, data, sizeof(float), usage)); }