]> O.S.I.I.S - jp/crow.git/commitdiff
Travis (#46)
authorj-p <jp_bruyere@hotmail.com>
Sun, 5 May 2019 04:21:01 +0000 (06:21 +0200)
committerGitHub <noreply@github.com>
Sun, 5 May 2019 04:21:01 +0000 (06:21 +0200)
* travis help

* travis help

* try with mscorlib ref

* travis mono + dotnet

* travis mono + dotnet

* travis mono + dotnet

* travis mono + dotnet

* travis mono + dotnet

* travis mono + dotnet

* travis mono + dotnet

.travis.yml
Crow.NetStd.sln [deleted file]
Crow.sln
Crow/Crow.csproj
Crow/src/CrowVkWin.cs [deleted file]
Properties/AssemblyInfo.cs [deleted file]
Samples/common/CrowVkWin.cs [new file with mode: 0644]

index 9963d318a141f34818f69e4d28c513ef7c25622e..06116d87561da407ee5c587338a3cca23fc8925d 100644 (file)
@@ -1,12 +1,12 @@
-sudo: required
-dist: trusty
 language: csharp
-solution: Crow.sln
-before_install:
-      - sudo apt-get -qq update
-      - sudo apt-get install -y libcairo1.10-cil libgio3.0-cil libgdk3.0-cil libglib3.0-cil
-install:
-      - nuget restore Crow.sln
-script:
-      - xbuild /p:Configuration=Release Crow.sln
+dist: xenial
+dotnet: 2.1.502
+mono: latest
 
+script:
+    - nuget restore Crow.sln
+    - msbuild Crow.sln
+    - dotnet restore
+    - dotnet build Crow.sln
+    
\ No newline at end of file
diff --git a/Crow.NetStd.sln b/Crow.NetStd.sln
deleted file mode 100644 (file)
index a62e160..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26124.0
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.NetStd", "Crow\Crow.NetStd.csproj", "{75BDE4C7-4BAF-4A03-B697-5D1370775E20}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.NetStd", "Tests\Tests.NetStd.csproj", "{28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE.NetStd", "CrowIDE\CrowIDE.NetStd.csproj", "{A01B3151-BC81-437C-B526-CC8DBB808638}"
-EndProject
-Global
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               Debug|Any CPU = Debug|Any CPU
-               Debug|x64 = Debug|x64
-               Debug|x86 = Debug|x86
-               Release|Any CPU = Release|Any CPU
-               Release|x64 = Release|x64
-               Release|x86 = Release|x86
-       EndGlobalSection
-       GlobalSection(SolutionProperties) = preSolution
-               HideSolutionNode = FALSE
-       EndGlobalSection
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Release|Any CPU.Build.0 = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|Any CPU.Build.0 = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|Any CPU.Build.0 = Release|Any CPU
-       EndGlobalSection
-EndGlobal
index 5250cb4a7ac068d479269c506ff61adb103f3991..958b9ff9b4b30b43a84ffb61544095f2a0bbc77c 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -3,36 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "Crow\Crow.csproj", "{C2980F9B-4798-4C05-99E2-E174810F7C7B}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{B6D911CD-1D09-42FC-B300-9187190F2AE1}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Samples\HelloWorld\HelloWorld.csproj", "{1F18E74F-BCC9-481C-8888-89D81CBB30BE}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowCase", "Samples\ShowCase\ShowCase.csproj", "{56329D48-D382-4850-93DE-59C453894E8A}"
-EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
                Release|Any CPU = Release|Any CPU
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU
-               {1F18E74F-BCC9-481C-8888-89D81CBB30BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {1F18E74F-BCC9-481C-8888-89D81CBB30BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {1F18E74F-BCC9-481C-8888-89D81CBB30BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {1F18E74F-BCC9-481C-8888-89D81CBB30BE}.Release|Any CPU.Build.0 = Release|Any CPU
-               {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {56329D48-D382-4850-93DE-59C453894E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {56329D48-D382-4850-93DE-59C453894E8A}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
@@ -74,7 +56,5 @@ Global
                version = 0.8.0
        EndGlobalSection
        GlobalSection(NestedProjects) = preSolution
-               {1F18E74F-BCC9-481C-8888-89D81CBB30BE} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
-               {56329D48-D382-4850-93DE-59C453894E8A} = {B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}
        EndGlobalSection
 EndGlobal
index 16438f4c792f19661b8da2e0eaa7cb949557a65b..1658e824a2f45c3f2d09007709cdb076d3d6e8aa 100644 (file)
   
   <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
     <Reference Include="System" />
+    <Reference Include="mscorlib" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />        
   </ItemGroup>
     
+  <ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
+    <PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
+    <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
+  </ItemGroup>        
+    
   <ItemGroup>
     <Compile Include="src\**\*.cs" />
         
@@ -55,7 +61,6 @@
   </ItemGroup>  
     
   <ItemGroup>
-    <ProjectReference Include="..\..\vke\CVKL.csproj" />
-  </ItemGroup>    
-    
+    <PackageReference Include="Vulkan" Version="0.1.2.8-beta" />    
+  </ItemGroup>
 </Project>
diff --git a/Crow/src/CrowVkWin.cs b/Crow/src/CrowVkWin.cs
deleted file mode 100644 (file)
index 890b461..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-using System;
-using System.Threading;
-using Crow;
-using CVKL;
-using VK;
-
-namespace Crow
-{
-       public class CrowVkWin : VkWindow, IValueChange {
-               bool isRunning;
-
-               protected override void render () {
-                       int idx = swapChain.GetNextImage ();
-
-                       if (idx < 0) {
-                               OnResize ();
-                               return;
-                       }
-
-                       lock (crow.RenderMutex) {
-                               presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx]);
-                               presentQueue.Present (swapChain, drawComplete[idx]);
-                               presentQueue.WaitIdle ();
-                       }
-                       Thread.Sleep (1);
-               }
-
-               #region crow
-               #region IValueChange implementation
-               public event EventHandler<Crow.ValueChangeEventArgs> ValueChanged;
-               public virtual void NotifyValueChanged (string MemberName, object _value)
-               {
-                       if (ValueChanged != null)
-                               ValueChanged.Invoke (this, new Crow.ValueChangeEventArgs (MemberName, _value));
-               }
-               #endregion
-
-               protected Crow.Interface crow;
-
-               void crow_thread_func () {
-                       vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, presentQueue.qFamIndex,
-                               vkvg.SampleCount.Sample_8, presentQueue.index);
-
-                       crow = new Crow.Interface (vkvgDev, 800, 600);
-
-                       isRunning = true;
-                       while (isRunning) {
-                               crow.Update ();
-                               Thread.Sleep (3);
-                       }
-
-                       crow.Dispose ();
-                       vkvgDev.Dispose ();
-
-                       crow = null;
-               }
-               #endregion
-
-
-               protected CVKL.Image uiImage;
-               protected vkvg.Device vkvgDev;
-
-               void initUISurface () {
-                       lock (crow.UpdateMutex) {
-                               try {
-                                       uiImage?.Dispose ();
-                                       uiImage = new CVKL.Image (dev, new VkImage ((ulong)crow.surf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
-                                               VkImageUsageFlags.Sampled, swapChain.Width, swapChain.Height);
-                                       uiImage.SetName ("uiImage");
-                                       uiImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
-                                       uiImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
-                                       uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
-                               } catch (Exception ex) {
-                                       Console.WriteLine (ex);
-                               }
-                       }
-               }
-
-               protected CrowVkWin () : base() {               
-                       Thread crowThread = new Thread (crow_thread_func);
-                       crowThread.IsBackground = true;
-                       crowThread.Start ();
-
-                       while (crow == null)
-                               Thread.Sleep (2);
-
-                       initUISurface ();
-               }
-
-               protected virtual void recordDraw (CommandBuffer cmd, int imageIndex) { }
-
-               void buildCommandBuffers () {
-                       for (int i = 0; i < swapChain.ImageCount; ++i) {
-                               cmds[i]?.Free ();
-                               cmds[i] = cmdPool.AllocateAndStart ();
-
-                               CommandBuffer cmd = cmds [i];
-
-                               recordDraw (cmd, i);
-
-                               swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
-                                       VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
-                                       VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
-                               uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
-                                       VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
-                                       VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
-                                       
-                               VkImageSubresourceLayers imgSubResLayer = new VkImageSubresourceLayers {
-                                       aspectMask = VkImageAspectFlags.Color,
-                                       mipLevel = 0,
-                                       baseArrayLayer = 0,
-                                       layerCount = 1
-                               };
-                               VkImageCopy cregion = new VkImageCopy {
-                                       srcSubresource = imgSubResLayer,
-                                       srcOffset = default (VkOffset3D),
-                                       dstSubresource = imgSubResLayer,
-                                       dstOffset = default (VkOffset3D),
-                                       extent = new VkExtent3D { width = swapChain.Width, height = swapChain.Height }
-                               };
-                               Vk.vkCmdCopyImage (cmds [i].Handle, uiImage.Handle, VkImageLayout.TransferSrcOptimal,
-                                       swapChain.images [i].Handle, VkImageLayout.TransferDstOptimal, 1, ref cregion);
-
-                               swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
-                                       VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
-                                       VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
-                               uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
-                                       VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
-                                       VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
-
-                               cmds [i].End ();
-                       }
-               }
-
-               /// <summary>
-               /// rebuild command buffers if needed
-               /// </summary>
-               public override void Update () {
-                       if (rebuildBuffers) {
-                               buildCommandBuffers ();
-                               rebuildBuffers = false;
-                       }
-               }
-
-               protected override void OnResize () {
-                       dev.WaitIdle ();
-
-                       crow.ProcessResize (new Crow.Rectangle (0, 0, (int)swapChain.Width, (int)swapChain.Height));
-
-                       initUISurface ();
-
-                       buildCommandBuffers ();
-                       dev.WaitIdle ();
-               }
-
-               #region Mouse and keyboard
-               //protected override void onScroll (double xOffset, double yOffset)
-               //{
-               //      if (KeyModifiers.HasFlag (Glfw.Modifier.Shift))
-               //              crow.ProcessMouseWheelChanged ((float)xOffset);
-               //      else
-               //              crow.ProcessMouseWheelChanged ((float)yOffset);
-               //}
-               protected override void onMouseMove (double xPos, double yPos)
-               {
-                       if (crow.ProcessMouseMove ((int)xPos, (int)yPos))
-                               return;
-               }
-               protected override void onMouseButtonDown (Glfw.MouseButton button)
-               {
-                       if (crow.ProcessMouseButtonDown ((Crow.MouseButton)button))
-                               return;
-                       base.onMouseButtonDown (button);
-               }
-               protected override void onMouseButtonUp (Glfw.MouseButton button)
-               {
-                       if (crow.ProcessMouseButtonUp ((Crow.MouseButton)button))
-                               return;
-                       base.onMouseButtonUp (button);
-               }
-               protected override void onKeyDown (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
-               {
-                       if (crow.ProcessKeyDown ((Crow.Key)key))
-                               return;
-               }
-               protected override void onKeyUp (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
-               {
-                       if (crow.ProcessKeyUp ((Crow.Key)key))
-                               return;
-               }
-               //protected override void onChar (Glfw.CodePoint cp)
-               //{
-               //      if (crow.ProcessKeyPress (cp.ToChar ()))
-               //              return;
-               //}
-               #endregion
-
-               #region dispose
-               protected override void Dispose (bool disposing) {
-                       if (disposing) {
-                               if (!isDisposed) {
-                                       dev.WaitIdle ();
-
-                                       isRunning = false;
-                                       uiImage?.Dispose ();
-                                       while (crow != null)
-                                               Thread.Sleep (1);
-                               }
-                       }
-
-                       base.Dispose (disposing);
-               }
-               #endregion
-       }
-}
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
deleted file mode 100755 (executable)
index 8b7d2a2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle ("Crow")]
-[assembly: AssemblyDescription ("C# Rapid Open Widgets")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("Grand Tetra Software")]
-[assembly: AssemblyProduct ("Crow")]
-[assembly: AssemblyCopyright ("Copyright (c) 2018 - Jean-Philippe Bruyère <jp_bruyere@hotmail.com>")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion ("0.7.1")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("crow.key")]
-
diff --git a/Samples/common/CrowVkWin.cs b/Samples/common/CrowVkWin.cs
new file mode 100644 (file)
index 0000000..dd83a37
--- /dev/null
@@ -0,0 +1,206 @@
+using System;
+using System.Threading;
+using Crow;
+using CVKL;
+using VK;
+
+namespace Crow
+{
+       public class CrowVkWin : VkWindow, IValueChange {
+        #region IValueChange implementation
+        public event EventHandler<Crow.ValueChangeEventArgs> ValueChanged;
+        public virtual void NotifyValueChanged(string MemberName, object _value)
+        {
+            if (ValueChanged != null)
+                ValueChanged.Invoke(this, new Crow.ValueChangeEventArgs(MemberName, _value));
+        }
+        #endregion
+
+        protected Crow.Interface crow;
+        protected CVKL.Image uiImage;
+        protected vkvg.Device vkvgDev;
+        bool isRunning;
+
+        protected CrowVkWin() : base()
+        {
+            Thread crowThread = new Thread(crow_thread_func);
+            crowThread.IsBackground = true;
+            crowThread.Start();
+
+            while (crow == null)
+                Thread.Sleep(2);
+
+            initUISurface();
+        }
+
+        protected override void render () {
+                       int idx = swapChain.GetNextImage ();
+
+                       if (idx < 0) {
+                               OnResize ();
+                               return;
+                       }
+
+                       lock (crow.RenderMutex) {
+                               presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx]);
+                               presentQueue.Present (swapChain, drawComplete[idx]);
+                               presentQueue.WaitIdle ();
+                       }
+                       Thread.Sleep (1);
+               }
+
+               void crow_thread_func () {
+                       vkvgDev = new vkvg.Device (instance.Handle, phy.Handle, dev.VkDev.Handle, presentQueue.qFamIndex,
+                               vkvg.SampleCount.Sample_8, presentQueue.index);
+
+                       crow = new Crow.Interface (vkvgDev, 800, 600);
+
+                       isRunning = true;
+                       while (isRunning) {
+                               crow.Update ();
+                               Thread.Sleep (3);
+                       }
+
+                       crow.Dispose ();
+                       vkvgDev.Dispose ();
+                       crow = null;
+               }
+
+               void initUISurface () {
+                       lock (crow.UpdateMutex) {
+                               uiImage?.Dispose ();
+                               uiImage = new CVKL.Image (dev, new VkImage ((ulong)crow.surf.VkImage.ToInt64 ()), VkFormat.B8g8r8a8Unorm,
+                                       VkImageUsageFlags.Sampled, swapChain.Width, swapChain.Height);
+                               uiImage.SetName ("uiImage");
+                               uiImage.CreateView (VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
+                               uiImage.CreateSampler (VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
+                               uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal;
+                       }
+               }
+
+               protected virtual void recordDraw (CommandBuffer cmd, int imageIndex) { }
+
+               void buildCommandBuffers () {
+                       for (int i = 0; i < swapChain.ImageCount; ++i) {
+                               cmds[i]?.Free ();
+                               cmds[i] = cmdPool.AllocateAndStart ();
+
+                               CommandBuffer cmd = cmds [i];
+
+                               recordDraw (cmd, i);
+
+                               swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
+                                       VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
+                                       VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
+                               uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
+                                       VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
+                                       VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
+                                       
+                               VkImageSubresourceLayers imgSubResLayer = new VkImageSubresourceLayers {
+                                       aspectMask = VkImageAspectFlags.Color,
+                                       mipLevel = 0,
+                                       baseArrayLayer = 0,
+                                       layerCount = 1
+                               };
+                               VkImageCopy cregion = new VkImageCopy {
+                                       srcSubresource = imgSubResLayer,
+                                       srcOffset = default (VkOffset3D),
+                                       dstSubresource = imgSubResLayer,
+                                       dstOffset = default (VkOffset3D),
+                                       extent = new VkExtent3D { width = swapChain.Width, height = swapChain.Height }
+                               };
+                               Vk.vkCmdCopyImage (cmds [i].Handle, uiImage.Handle, VkImageLayout.TransferSrcOptimal,
+                                       swapChain.images [i].Handle, VkImageLayout.TransferDstOptimal, 1, ref cregion);
+
+                               swapChain.images [i].SetLayout (cmd, VkImageAspectFlags.Color,
+                                       VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
+                                       VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
+                               uiImage.SetLayout (cmd, VkImageAspectFlags.Color,
+                                       VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
+                                       VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
+
+                               cmds [i].End ();
+                       }
+               }
+
+               /// <summary>
+               /// rebuild command buffers if needed
+               /// </summary>
+               public override void Update () {
+                       if (rebuildBuffers) {
+                               buildCommandBuffers ();
+                               rebuildBuffers = false;
+                       }
+               }
+
+               protected override void OnResize () {
+                       dev.WaitIdle ();
+
+                       crow.ProcessResize (new Crow.Rectangle (0, 0, (int)swapChain.Width, (int)swapChain.Height));
+
+                       initUISurface ();
+
+                       buildCommandBuffers ();
+                       dev.WaitIdle ();
+               }
+
+               #region Mouse and keyboard
+               //protected override void onScroll (double xOffset, double yOffset)
+               //{
+               //      if (KeyModifiers.HasFlag (Glfw.Modifier.Shift))
+               //              crow.ProcessMouseWheelChanged ((float)xOffset);
+               //      else
+               //              crow.ProcessMouseWheelChanged ((float)yOffset);
+               //}
+               protected override void onMouseMove (double xPos, double yPos)
+               {
+                       if (crow.ProcessMouseMove ((int)xPos, (int)yPos))
+                               return;
+               }
+               protected override void onMouseButtonDown (Glfw.MouseButton button)
+               {
+                       if (crow.ProcessMouseButtonDown ((Crow.MouseButton)button))
+                               return;
+                       base.onMouseButtonDown (button);
+               }
+               protected override void onMouseButtonUp (Glfw.MouseButton button)
+               {
+                       if (crow.ProcessMouseButtonUp ((Crow.MouseButton)button))
+                               return;
+                       base.onMouseButtonUp (button);
+               }
+               protected override void onKeyDown (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
+               {
+                       if (crow.ProcessKeyDown ((Crow.Key)key))
+                               return;
+               }
+               protected override void onKeyUp (Glfw.Key key, int scanCode, Glfw.Modifier modifiers)
+               {
+                       if (crow.ProcessKeyUp ((Crow.Key)key))
+                               return;
+               }
+               //protected override void onChar (Glfw.CodePoint cp)
+               //{
+               //      if (crow.ProcessKeyPress (cp.ToChar ()))
+               //              return;
+               //}
+               #endregion
+
+               #region dispose
+               protected override void Dispose (bool disposing) {
+                       if (disposing) {
+                               if (!isDisposed) {
+                                       dev.WaitIdle ();
+
+                                       isRunning = false;
+                                       uiImage?.Dispose ();
+                                       while (crow != null)
+                                               Thread.Sleep (1);
+                               }
+                       }
+
+                       base.Dispose (disposing);
+               }
+               #endregion
+       }
+}
\ No newline at end of file