update Clear

pull/14/head
cosmonaut 2021-01-22 14:16:38 -08:00
parent f84c4dad26
commit 12c5f37ae9
2 changed files with 13 additions and 19 deletions

@ -1 +1 @@
Subproject commit 718aaad80ebf075192e05bf7af97241d7cf7e726 Subproject commit 369ced4f80f0e7de22fa806b547831154a23efad

View File

@ -23,9 +23,6 @@ namespace MoonWorks.Graphics
in DepthStencilValue depthStencilClearValue, in DepthStencilValue depthStencilClearValue,
params Color[] clearColors params Color[] clearColors
) { ) {
var refreshRenderArea = renderArea.ToRefresh();
var refreshDepthStencilClearValue = depthStencilClearValue.ToRefresh();
fixed (Color* clearColorPtr = &clearColors[0]) fixed (Color* clearColorPtr = &clearColors[0])
{ {
Refresh.Refresh_BeginRenderPass( Refresh.Refresh_BeginRenderPass(
@ -33,10 +30,10 @@ namespace MoonWorks.Graphics
Handle, Handle,
renderPass.Handle, renderPass.Handle,
framebuffer.Handle, framebuffer.Handle,
refreshRenderArea, renderArea.ToRefresh(),
(IntPtr) clearColorPtr, (IntPtr) clearColorPtr,
(uint)clearColors.Length, (uint)clearColors.Length,
refreshDepthStencilClearValue depthStencilClearValue.ToRefresh()
); );
} }
} }
@ -47,8 +44,6 @@ namespace MoonWorks.Graphics
in Rect renderArea, in Rect renderArea,
params Color[] clearColors params Color[] clearColors
) { ) {
var refreshRenderArea = renderArea.ToRefresh();
fixed (Color* clearColorPtr = &clearColors[0]) fixed (Color* clearColorPtr = &clearColors[0])
{ {
Refresh.Refresh_BeginRenderPass( Refresh.Refresh_BeginRenderPass(
@ -56,7 +51,7 @@ namespace MoonWorks.Graphics
Handle, Handle,
renderPass.Handle, renderPass.Handle,
framebuffer.Handle, framebuffer.Handle,
refreshRenderArea, renderArea.ToRefresh(),
(IntPtr) clearColorPtr, (IntPtr) clearColorPtr,
(uint) clearColors.Length, (uint) clearColors.Length,
IntPtr.Zero IntPtr.Zero
@ -262,22 +257,21 @@ namespace MoonWorks.Graphics
); );
} }
public void Clear( public unsafe void Clear(
in Refresh.Rect clearRect, in Rect clearRect,
Refresh.ClearOptionsFlags clearOptions, Refresh.ClearOptionsFlags clearOptions,
in Refresh.Color[] colors, in DepthStencilValue depthStencilClearValue,
float depth, params Color[] clearColors
int stencil
) { ) {
Refresh.Color* colors = stackalloc Refresh.Color[clearColors.Length];
Refresh.Refresh_Clear( Refresh.Refresh_Clear(
Device.Handle, Device.Handle,
Handle, Handle,
in clearRect, clearRect.ToRefresh(),
clearOptions, clearOptions,
in colors, (IntPtr) colors,
(uint) colors.Length, (uint) clearColors.Length,
depth, depthStencilClearValue.ToRefresh()
stencil
); );
} }