From: Jean-Philippe Bruyère Date: Mon, 27 Jan 2020 10:33:52 +0000 (+0100) Subject: fix runtime issues with dotnet X-Git-Tag: v0.1.21~14 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=2e1daf68aafa55784a898c8113048a92f6717976;p=jp%2Fvke.net.git fix runtime issues with dotnet --- diff --git a/addons/Directory.Build.props b/addons/Directory.Build.props index f1fba1a..ba37f8f 100644 --- a/addons/Directory.Build.props +++ b/addons/Directory.Build.props @@ -32,7 +32,7 @@ - + diff --git a/appveyor.yml b/appveyor.yml index 031fbc8..c712653 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,11 @@ -version: 0.1.{build} +version: 0.1.12.{build} image: - Visual Studio 2019 - Ubuntu +artifacts: + - path: 'build/**/*.nupkg' build: verbosity: minimal diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index 2600f8b..a0f1de6 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -31,7 +31,7 @@ - + diff --git a/vke/src/VkWindow.cs b/vke/src/VkWindow.cs index ecb6ac2..e2e2fb4 100644 --- a/vke/src/VkWindow.cs +++ b/vke/src/VkWindow.cs @@ -102,7 +102,6 @@ namespace vke { Glfw3.SetKeyCallback (hWin, HandleKeyDelegate); Glfw3.SetMouseButtonPosCallback (hWin, HandleMouseButtonDelegate); Glfw3.SetCursorPosCallback (hWin, HandleCursorPosDelegate); - Glfw3.SetWindowSizeCallback (hWin, HandleWindowSizeDelegate); Glfw3.SetScrollCallback (hWin, HandleScrollDelegate); Glfw3.SetCharCallback (hWin, HandleCharDelegate); @@ -283,13 +282,13 @@ namespace vke { protected virtual void onChar (CodePoint cp) { } #region events delegates - static void HandleWindowSizeDelegate (IntPtr window, int width, int height) { } - static void HandleCursorPosDelegate (IntPtr window, double xPosition, double yPosition) { + + static CursorPosDelegate HandleCursorPosDelegate = (window, xPosition, yPosition) => { windows[window].onMouseMove (xPosition, yPosition); windows[window].lastMouseX = xPosition; windows[window].lastMouseY = yPosition; - } - static void HandleMouseButtonDelegate (IntPtr window, Glfw.MouseButton button, InputAction action, Modifier mods) { + }; + static MouseButtonDelegate HandleMouseButtonDelegate = (IntPtr window, Glfw.MouseButton button, InputAction action, Modifier mods) => { if (action == InputAction.Press) { windows[window].buttons[(int)button] = true; windows[window].onMouseButtonDown (button); @@ -297,21 +296,21 @@ namespace vke { windows[window].buttons[(int)button] = false; windows[window].onMouseButtonUp (button); } - } - static void HandleScrollDelegate (IntPtr window, double xOffset, double yOffset) { + }; + static ScrollDelegate HandleScrollDelegate = (IntPtr window, double xOffset, double yOffset) => { windows[window].onScroll (xOffset, yOffset); - } - static void HandleKeyDelegate (IntPtr window, Key key, int scanCode, InputAction action, Modifier modifiers) { + }; + static KeyDelegate HandleKeyDelegate = (IntPtr window, Key key, int scanCode, InputAction action, Modifier modifiers) => { windows[window].KeyModifiers = modifiers; if (action == InputAction.Press || action == InputAction.Repeat) { windows[window].onKeyDown (key, scanCode, modifiers); } else { windows[window].onKeyUp (key, scanCode, modifiers); } - } - static void HandleCharDelegate (IntPtr window, CodePoint codepoint) { + }; + static CharDelegate HandleCharDelegate = (IntPtr window, CodePoint codepoint) => { windows[window].onChar (codepoint); - } + }; #endregion /// diff --git a/vke/src/base/GraphicPipeline.cs b/vke/src/base/GraphicPipeline.cs index b0c1e67..c538501 100644 --- a/vke/src/base/GraphicPipeline.cs +++ b/vke/src/base/GraphicPipeline.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using Vulkan; +using System.Linq; using static Vulkan.Vk; namespace vke { @@ -57,7 +58,7 @@ namespace vke { VkPipelineDynamicStateCreateInfo dynStatesInfo = VkPipelineDynamicStateCreateInfo.New (); dynStatesInfo.dynamicStateCount = (uint)cfg.dynamicStates.Count; - dynStatesInfo.pDynamicStates = cfg.dynamicStates.Pin (pctx); + dynStatesInfo.pDynamicStates = cfg.dynamicStates.Cast().ToArray().Pin (pctx); VkPipelineVertexInputStateCreateInfo vertInputInfo = VkPipelineVertexInputStateCreateInfo.New (); vertInputInfo.vertexBindingDescriptionCount = (uint)cfg.vertexBindings.Count; diff --git a/vke/src/base/PhysicalDevice.cs b/vke/src/base/PhysicalDevice.cs index d08bc4f..ec9d085 100644 --- a/vke/src/base/PhysicalDevice.cs +++ b/vke/src/base/PhysicalDevice.cs @@ -135,15 +135,19 @@ namespace vke { return formats; } - public VkPresentModeKHR [] GetSurfacePresentModes (VkSurfaceKHR surf) - { + public VkPresentModeKHR[] GetSurfacePresentModes (VkSurfaceKHR surf) { vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out uint count, IntPtr.Zero); - VkPresentModeKHR [] modes = new VkPresentModeKHR [count]; - - vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out count, modes.Pin ()); - modes.Unpin (); - - return modes; + if (Type.GetType ("Mono.Runtime") == null) { + int[] modes = new int[count];//this cause an error on mono + vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out count, modes.Pin ()); + modes.Unpin (); + return modes.Cast ().ToArray (); + } else { + VkPresentModeKHR[] modes = new VkPresentModeKHR[count];//enums not blittable on ms.Net + vkGetPhysicalDeviceSurfacePresentModesKHR (phy, surf, out count, modes.Pin ()); + modes.Unpin (); + return modes; + } } public VkFormatProperties GetFormatProperties (VkFormat format) {