You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I'm considering adding some Span overloads where it makes sense in the next version. In the meantime, you can use Spans with some of the existing overloads:
voidUpdateBuffer<T>(DeviceBufferbuffer,uintbufferOffsetInBytes,refTsource,uintsizeInBytes);// For example:Span<uint>data= ...;graphicsDevice.UpdateBuffer(buffer,offset,refdata[0],(uint)data.Length*sizeof(uint));// You can also use the IntPtr overload if you pin your data:voidUpdateBuffer(DeviceBufferbuffer,uintbufferOffsetInBytes,IntPtrsource,uintsizeInBytes);
@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.The text was updated successfully, but these errors were encountered: