Fix bad pointer arithmetic in SetBufferData #33

Merged
cosmonaut merged 1 commits from TheSpydog/MoonWorks:pointerfix into main 2022-11-12 03:42:35 +00:00
1 changed files with 2 additions and 4 deletions

View File

@ -784,16 +784,14 @@ namespace MoonWorks.Graphics
var elementSize = sizeof(T); var elementSize = sizeof(T);
fixed (T* ptr = &data[0]) fixed (T* ptr = &data[startElement])
{ {
var dataPtr = ptr + (startElement * elementSize);
Refresh.Refresh_SetBufferData( Refresh.Refresh_SetBufferData(
Device.Handle, Device.Handle,
Handle, Handle,
buffer.Handle, buffer.Handle,
bufferOffsetInBytes, bufferOffsetInBytes,
(IntPtr) dataPtr, (IntPtr) ptr,
(uint) (numElements * elementSize) (uint) (numElements * elementSize)
); );
} }