From dc59b851d467ac83354762d448d4a618fa97839b Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 10 Feb 2021 17:15:46 -0800 Subject: [PATCH] fix begin render pass --- src/Graphics/CommandBuffer.cs | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Graphics/CommandBuffer.cs b/src/Graphics/CommandBuffer.cs index e989a78..2a73c74 100644 --- a/src/Graphics/CommandBuffer.cs +++ b/src/Graphics/CommandBuffer.cs @@ -72,21 +72,31 @@ namespace MoonWorks.Graphics RenderPass renderPass, Framebuffer framebuffer, in Rect renderArea, - params Color[] clearColors + params Vector4[] clearColors ) { - fixed (Color* clearColorPtr = &clearColors[0]) + Refresh.Vec4* colors = stackalloc Refresh.Vec4[clearColors.Length]; + + for (var i = 0; i < clearColors.Length; i++) { - Refresh.Refresh_BeginRenderPass( - Device.Handle, - Handle, - renderPass.Handle, - framebuffer.Handle, - renderArea.ToRefresh(), - (IntPtr) clearColorPtr, - (uint) clearColors.Length, - IntPtr.Zero - ); + colors[i] = new Refresh.Vec4 + { + x = clearColors[i].X, + y = clearColors[i].Y, + z = clearColors[i].Z, + w = clearColors[i].W + }; } + + Refresh.Refresh_BeginRenderPass( + Device.Handle, + Handle, + renderPass.Handle, + framebuffer.Handle, + renderArea.ToRefresh(), + (IntPtr) colors, + (uint) clearColors.Length, + IntPtr.Zero + ); } public void BindComputePipeline(