Margin="0";
BubbleMouseEvent="MouseWheel|Keyboard";
}
-TemplatedControl, GenericStack {
- CacheEnabled="true";
-}
\ No newline at end of file
+//TemplatedControl, GenericStack {
+// CacheEnabled="true";
+//}
\ No newline at end of file
widthRatio = heightRatio;
}
- gr.Save ();
+ /*gr.Save ();
gr.Translate (rect.Left,rect.Top);
gr.Scale (widthRatio, heightRatio);
hSVG.RenderCairoSub (gr, "#" + subPart);
}
- gr.Restore ();
+ gr.Restore (); */
}
}
}
// }
public void Flush () {
- throw new NotImplementedException ();
+ //throw new NotImplementedException ();
}
public void WriteToPng (string path) {
string[] EnabledDeviceExtensions => new string[] { Ext.D.VK_KHR_swapchain };
uint width, height;
-
+ public void WaitIdle() => dev.WaitIdle ();
public VulkanContext (IntPtr hWin, uint _width, uint _height, bool vsync = false) {
this.hWin = hWin;
+ Instance.VALIDATION = true;
+ /*Instance.RENDER_DOC_CAPTURE = true;*/
+
+ SwapChain.IMAGES_USAGE = VkImageUsageFlags.ColorAttachment | VkImageUsageFlags.TransferDst;
List<string> instExts = new List<string> (Glfw3.GetRequiredInstanceExtensions ());
if (EnabledInstanceExtensions != null)
internal vke.Image blitSource;
public void BuildBlitCommand (vkvg.Surface surf) {
+ cmdPool.Reset();
- blitSource = new vke.Image (dev, new VkImage((ulong)surf.VkImage.ToInt64()), Vulkan.VkFormat.R8g8b8a8Unorm,
+ blitSource = new vke.Image (dev, new VkImage((ulong)surf.VkImage.ToInt64()), Vulkan.VkFormat.B8g8r8a8Unorm,
Vulkan.VkImageUsageFlags.TransferSrc | Vulkan.VkImageUsageFlags.TransferDst | Vulkan.VkImageUsageFlags.ColorAttachment,
width, height);
vke.PrimaryCommandBuffer cmd = cmds[i];
cmd.Start();
- blitDest.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.TransferDstOptimal);
- blitSource.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.TransferSrcOptimal);
+ blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
+ VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
+
+ blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
+ VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);
blitSource.BlitTo (cmd, blitDest, VkFilter.Nearest);
- blitDest.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.PresentSrcKHR);
- blitSource.SetLayout (cmd, VkImageAspectFlags.Color, VkImageLayout.ColorAttachmentOptimal);
+ blitDest.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.TransferDstOptimal, VkImageLayout.PresentSrcKHR,
+ VkPipelineStageFlags.Transfer, VkPipelineStageFlags.BottomOfPipe);
+
+ blitSource.SetLayout (cmd, VkImageAspectFlags.Color,
+ VkImageLayout.TransferSrcOptimal, VkImageLayout.ColorAttachmentOptimal,
+ VkPipelineStageFlags.Transfer, VkPipelineStageFlags.ColorAttachmentOutput);
cmd.End ();
}
}
+ public void WaitAndResetDrawFence () {
+ drawFence.Wait ();
+ drawFence.Reset ();
+ }
/// <summary>
/// Main render method called each frame. get next swapchain image, process resize if needed, submit and present to the presentQueue.
/// Wait QueueIdle after presenting.
if (cmds[idx] == null)
return;
-
- drawFence.Wait ();
- drawFence.Reset ();
+ WaitAndResetDrawFence();
presentQueue.Submit (cmds[idx], swapChain.presentComplete, drawComplete[idx], drawFence);
presentQueue.Present (swapChain, drawComplete[idx]);
processDrawing (ctx);
}else
processDrawing (ctx);
+
+#if VKVG
+ if (IsDirty) {
+ IsDirty = false;
+ vkCtx.render ();
+ }
+#endif
+
} finally {
PerformanceMeasure.End (PerformanceMeasure.Kind.Update);
/// <summary>Clipping Rectangles drive the drawing process. For compositing, each object under a clip rectangle should be
/// repainted. If it contains also clip rectangles, its cache will be update, or if not cached a full redraw will take place</summary>
protected virtual void processDrawing(Context ctx){
-
+ /*ctx.Rectangle (0,0,100,100);
+ ctx.SetSource (1,0,0,1);
+ ctx.Fill();
+ return;*/
+
+ //ctx.Flush();
+ //surf.WriteToPng ("/home/jp/test.png");*/
DbgLogger.StartEvent (DbgEvtType.ProcessDrawing);
if (DragImage != null)
if (!clipping.IsEmpty) {
PerformanceMeasure.Begin (PerformanceMeasure.Kind.Drawing);
+#if VKVG
+ clear (ctx);
+#else
ctx.PushGroup ();
if (SolidBackground)
clear (ctx);
+#endif
for (int i = GraphicTree.Count -1; i >= 0 ; i--){
Widget p = GraphicTree[i];
#endif
#if VKVG
- vkCtx.render ();
+ //vkCtx.render ();
+ vkCtx.WaitIdle();
#else
ctx.PopGroupToSource ();
IsDirty = true;
}
-#if VKVG
- vkCtx.render ();
-#endif
-
drawTextCursor (ctx);
debugHighlightFocus (ctx);
clientRectangle = bounds;
#if VKVG
+ vkCtx.WaitIdle();
vkCtx.blitSource?.Dispose ();
surf?.Dispose ();
surf = new Surface (vkvgDevice, clientRectangle.Width, clientRectangle.Height);
<CrowStbSharp>true</CrowStbSharp>
<CrowDebugLogEnabled>false</CrowDebugLogEnabled>
<CrowDebugStatsEnabled>true</CrowDebugStatsEnabled>
- <CrowDesignModeEnabled>true</CrowDesignModeEnabled>
+ <CrowDesignModeEnabled>false</CrowDesignModeEnabled>
<CrowVkvgBackend>true</CrowVkvgBackend>
<GlfwSharpVersion>0.2.12-beta</GlfwSharpVersion>
</PropertyGroup>
//testFiles = new string [] { @"Interfaces/Stack/StretchedInFit4.crow" };
//testFiles = new string [] { @"Interfaces/TemplatedGroup/1.crow" };
//testFiles = new string [] { @"Interfaces/Divers/colorPicker2.crow" };
- testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
+ //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray ();
- testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray ();
+ /*testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
- testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/DragAndDrop", "*.crow")).ToArray ();
+ testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/DragAndDrop", "*.crow")).ToArray ();*/
//testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Experimental", "*.crow")).ToArray ();
Load (testFiles [idx]).DataSource = this;