]> O.S.I.I.S - jp/vke.net.git/commitdiff
fix runtime issues with dotnet
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 27 Jan 2020 10:33:52 +0000 (11:33 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 27 Jan 2020 10:33:52 +0000 (11:33 +0100)
addons/Directory.Build.props
appveyor.yml
samples/Directory.Build.props
vke/src/VkWindow.cs
vke/src/base/GraphicPipeline.cs
vke/src/base/PhysicalDevice.cs

index f1fba1afc93fc650d3637a799571464c051d703c..ba37f8fadfcfe6fe455cd88b04c85fbe21acdda9 100644 (file)
@@ -32,7 +32,7 @@
                <ProjectReference Include="..\..\vke\vke.csproj" />
        </ItemGroup>
        <ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'BuildPackages|AnyCPU' ">
-               <PackageReference Include="vke" Version="0.1.11-beta" />
+               <PackageReference Include="vke" Version="0.1.12-beta" />
        </ItemGroup>
        
        <ItemGroup>
index 031fbc88ab19e8e943c454b67f384a83add3fb73..c7126533b1d1d9d18f3aa827e5fe69c4fd51f107 100644 (file)
@@ -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
index 2600f8b34459095bf3c2547356932736fd720e7f..a0f1de6fb622bc6a125c70e0c182ee9a3bb5ead7 100644 (file)
@@ -31,7 +31,7 @@
                <ProjectReference Include="..\..\vke\vke.csproj" />
        </ItemGroup>
        <ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'BuildPackages|AnyCPU' ">
-               <PackageReference Include="vke" Version="0.1.11-beta" />
+               <PackageReference Include="vke" Version="0.1.12-beta" />
        </ItemGroup>
                        
        <ItemGroup>
index ecb6ac2facf560c7e0f1a00f6eda581111bbb912..e2e2fb492dee319e3690aab9c3f02127cf30f5e8 100644 (file)
@@ -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
 
                /// <summary>
index b0c1e67c37c51c1ce5f7b6aad517a51ffa10e9f7..c538501c86d21240b6c9eb85e4cdb550c40a08d0 100644 (file)
@@ -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<int>().ToArray().Pin (pctx);
 
                                        VkPipelineVertexInputStateCreateInfo vertInputInfo = VkPipelineVertexInputStateCreateInfo.New ();
                                        vertInputInfo.vertexBindingDescriptionCount = (uint)cfg.vertexBindings.Count;
index d08bc4f6c593b11914176054c1712e7a0b1cb8c8..ec9d08547a850f2e29ae6ec7589b5cc2a575b078 100644 (file)
@@ -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<VkPresentModeKHR> ().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)
                {