change type buffer setdata to use element offset and length
parent
ada9a1bb05
commit
68bb51439f
|
@ -23,18 +23,20 @@ namespace MoonWorks.Graphics
|
||||||
|
|
||||||
public unsafe void SetData<T>(
|
public unsafe void SetData<T>(
|
||||||
T[] data,
|
T[] data,
|
||||||
uint offsetInBytes,
|
uint offsetInElements,
|
||||||
uint dataLengthInBytes
|
uint lengthInElements
|
||||||
) where T : unmanaged
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
|
var elementSize = Marshal.SizeOf<T>();
|
||||||
|
|
||||||
fixed (T* ptr = &data[0])
|
fixed (T* ptr = &data[0])
|
||||||
{
|
{
|
||||||
Refresh.Refresh_SetBufferData(
|
Refresh.Refresh_SetBufferData(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
offsetInBytes,
|
(uint) (offsetInElements * elementSize),
|
||||||
(IntPtr) ptr,
|
(IntPtr) ptr,
|
||||||
dataLengthInBytes
|
(uint) (lengthInElements * elementSize)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,15 +73,16 @@ namespace MoonWorks.Graphics
|
||||||
|
|
||||||
public unsafe void SetData<T>(
|
public unsafe void SetData<T>(
|
||||||
T* data,
|
T* data,
|
||||||
uint offsetInBytes,
|
uint offsetInElements,
|
||||||
uint dataLengthInBytes
|
uint lengthInElements
|
||||||
) where T : unmanaged {
|
) where T : unmanaged {
|
||||||
|
var elementSize = Marshal.SizeOf<T>();
|
||||||
Refresh.Refresh_SetBufferData(
|
Refresh.Refresh_SetBufferData(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
offsetInBytes,
|
(uint) (offsetInElements * elementSize),
|
||||||
(IntPtr) data,
|
(IntPtr) data,
|
||||||
dataLengthInBytes
|
(uint) (lengthInElements * elementSize)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue