From 9e4007f9f0723951b5533ee069b71cf82b0e8c7d Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 28 Jan 2021 21:49:33 -0800 Subject: [PATCH] buffer setData tweak and pin depthstenciltargetdescription --- src/Graphics/Resources/Buffer.cs | 23 ++++++++++++++++++----- src/Graphics/Resources/RenderPass.cs | 4 ++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Graphics/Resources/Buffer.cs b/src/Graphics/Resources/Buffer.cs index 3beb765..3fbcfd7 100644 --- a/src/Graphics/Resources/Buffer.cs +++ b/src/Graphics/Resources/Buffer.cs @@ -22,8 +22,8 @@ namespace MoonWorks.Graphics } public unsafe void SetData( - uint offsetInBytes, T[] data, + uint offsetInBytes, uint dataLengthInBytes ) where T : unmanaged { @@ -55,12 +55,11 @@ namespace MoonWorks.Graphics } } - public void SetData( - uint offsetInBytes, + public void SetData( IntPtr data, + uint offsetInBytes, uint dataLengthInBytes - ) where T : unmanaged - { + ) { Refresh.Refresh_SetBufferData( Device.Handle, Handle, @@ -70,6 +69,20 @@ namespace MoonWorks.Graphics ); } + public unsafe void SetData( + 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 public unsafe void GetData( T[] data, diff --git a/src/Graphics/Resources/RenderPass.cs b/src/Graphics/Resources/RenderPass.cs index 415f26d..81b6acb 100644 --- a/src/Graphics/Resources/RenderPass.cs +++ b/src/Graphics/Resources/RenderPass.cs @@ -25,12 +25,12 @@ namespace MoonWorks.Graphics public unsafe RenderPass( GraphicsDevice device, - DepthStencilTargetDescription depthStencilTargetDescription, + in DepthStencilTargetDescription depthStencilTargetDescription, params ColorTargetDescription[] colorTargetDescriptions ) : base(device) { - DepthStencilTargetDescription* depthStencilPtr = &depthStencilTargetDescription; + fixed (DepthStencilTargetDescription* depthStencilPtr = &depthStencilTargetDescription) fixed (ColorTargetDescription* colorPtr = colorTargetDescriptions) { Refresh.RenderPassCreateInfo renderPassCreateInfo;