buffer setData tweak and pin depthstenciltargetdescription

pull/14/head
cosmonaut 2021-01-28 21:49:33 -08:00
parent 55d8e5a1df
commit 9e4007f9f0
2 changed files with 20 additions and 7 deletions

View File

@ -22,8 +22,8 @@ namespace MoonWorks.Graphics
} }
public unsafe void SetData<T>( public unsafe void SetData<T>(
uint offsetInBytes,
T[] data, T[] data,
uint offsetInBytes,
uint dataLengthInBytes uint dataLengthInBytes
) where T : unmanaged ) where T : unmanaged
{ {
@ -55,12 +55,11 @@ namespace MoonWorks.Graphics
} }
} }
public void SetData<T>( public void SetData(
uint offsetInBytes,
IntPtr data, IntPtr data,
uint offsetInBytes,
uint dataLengthInBytes uint dataLengthInBytes
) where T : unmanaged ) {
{
Refresh.Refresh_SetBufferData( Refresh.Refresh_SetBufferData(
Device.Handle, Device.Handle,
Handle, Handle,
@ -70,6 +69,20 @@ namespace MoonWorks.Graphics
); );
} }
public unsafe void SetData<T>(
T* data,
uint offsetInBytes,
uint dataLengthInBytes
) where T : unmanaged {
Refresh.Refresh_SetBufferData(
Device.Handle,
Handle,
offsetInBytes,
(IntPtr) data,
dataLengthInBytes
);
}
// NOTE: You want to wait on the device before calling this // NOTE: You want to wait on the device before calling this
public unsafe void GetData<T>( public unsafe void GetData<T>(
T[] data, T[] data,

View File

@ -25,12 +25,12 @@ namespace MoonWorks.Graphics
public unsafe RenderPass( public unsafe RenderPass(
GraphicsDevice device, GraphicsDevice device,
DepthStencilTargetDescription depthStencilTargetDescription, in DepthStencilTargetDescription depthStencilTargetDescription,
params ColorTargetDescription[] colorTargetDescriptions params ColorTargetDescription[] colorTargetDescriptions
) : base(device) ) : base(device)
{ {
DepthStencilTargetDescription* depthStencilPtr = &depthStencilTargetDescription;
fixed (DepthStencilTargetDescription* depthStencilPtr = &depthStencilTargetDescription)
fixed (ColorTargetDescription* colorPtr = colorTargetDescriptions) fixed (ColorTargetDescription* colorPtr = colorTargetDescriptions)
{ {
Refresh.RenderPassCreateInfo renderPassCreateInfo; Refresh.RenderPassCreateInfo renderPassCreateInfo;