Open xposure opened 5 years ago
I'm considering adding some Span
void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source, uint sizeInBytes);
// For example:
Span<uint> data = ...;
graphicsDevice.UpdateBuffer(buffer, offset, ref data[0], (uint)data.Length * sizeof(uint));
// You can also use the IntPtr overload if you pin your data:
void UpdateBuffer(DeviceBuffer buffer, uint bufferOffsetInBytes, IntPtr source, uint sizeInBytes);
@mellinoe Yea, I was going to note that I'm using the last option, since the memory is off the heap there is no need to pin it and I'm just passing the raw pointer wrapped in a IntPtr.
More of a quality of life suggestion than anything else.
I have a lot of low level code that creates memory outside of the heap. My entity system could be thought of like the new unity ECS using unmanaged structs in blocks.
Since i'm not working with standard c# arrays, it would be useful if I could pass a span to
UpdateBuffer
in place of an array.