From cd2d4cc65896b085ea09a2e255b951b0462b518d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Thu, 7 May 2020 11:02:14 +0200 Subject: [PATCH] test with byvalarrays in vk.net --- samples/ClearScreen/main.cs | 6 +++++- vke/src/base/PhysicalDevice.cs | 5 ++++- vke/vke.csproj | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/samples/ClearScreen/main.cs b/samples/ClearScreen/main.cs index 3e11384..4c5d1bd 100644 --- a/samples/ClearScreen/main.cs +++ b/samples/ClearScreen/main.cs @@ -1,6 +1,7 @@ // Copyright (c) 2019 Jean-Philippe Bruyère // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +using System; using vke; using Vulkan; @@ -30,7 +31,10 @@ namespace ClearScreen { //is handled automatically by the render pass. renderPass = new RenderPass (dev, swapChain.ColorFormat); //default clear values are automatically added for each attacments - renderPass.ClearValues[0] = new VkClearValue (0.1f, 0.2f, 1); + renderPass.ClearValues[0] = new VkClearValue (0.9f, 0.9f, 1); + + Console.WriteLine ($"{renderPass.ClearValues[0].color.float32[0]}"); + //bound to a pipeline, renderpasses are automatically activated, here we use //a stand alone renderpass just to clear the screen, so we have to //activate it manually diff --git a/vke/src/base/PhysicalDevice.cs b/vke/src/base/PhysicalDevice.cs index ec9d085..2fa1d98 100644 --- a/vke/src/base/PhysicalDevice.cs +++ b/vke/src/base/PhysicalDevice.cs @@ -54,7 +54,10 @@ namespace vke { public VkQueueFamilyProperties [] QueueFamilies { get; private set; } public VkPhysicalDeviceProperties Properties { get { - vkGetPhysicalDeviceProperties (phy, out VkPhysicalDeviceProperties pdp); + IntPtr ptr = Marshal.AllocHGlobal (Marshal.SizeOf ()); + vkGetPhysicalDeviceProperties (phy, ptr); + VkPhysicalDeviceProperties pdp = Marshal.PtrToStructure (ptr); + Marshal.FreeHGlobal (ptr); return pdp; } } diff --git a/vke/vke.csproj b/vke/vke.csproj index ca08d45..ee98059 100644 --- a/vke/vke.csproj +++ b/vke/vke.csproj @@ -56,7 +56,7 @@ - + -- 2.47.3