Skip to content

Commit

Permalink
📍 Allow buffers to upload data from spans
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcscharf committed Aug 14, 2024
1 parent 5f3cd72 commit c21557c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Bearded.Graphics/Core/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ private void bufferData(T[]? data, int count, BufferTarget target, BufferUsageHi
GL.BufferData(target, itemSize * count, data, usageHint);
}

public void Upload(Span<T> data, BufferUsageHint usageHint = defaultUsageHint)
{
buffer.Count = data.Length;
GL.BufferData(target, itemSize * data.Length, ref data[0], usageHint);
}

public void Dispose()
{
GL.BindBuffer(target, 0);
Expand Down

0 comments on commit c21557c

Please sign in to comment.