From: Jean-Philippe Bruyère Date: Sat, 20 Nov 2021 03:04:02 +0000 (+0100) Subject: debug utils buffer overflow debug, print enabled layers in DEBUG mode with toolsPrope... X-Git-Tag: v0.2.4-beta~31 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=472832f8848495f881adc6da1a3b9bebcce990cb;p=jp%2Fvke.net.git debug utils buffer overflow debug, print enabled layers in DEBUG mode with toolsProperties in SampleBase --- diff --git a/samples/common/SampleBase.cs b/samples/common/SampleBase.cs index 76a85f3..4f22dca 100644 --- a/samples/common/SampleBase.cs +++ b/samples/common/SampleBase.cs @@ -3,11 +3,22 @@ using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; - +using Vulkan; namespace vke { public abstract class SampleBase : VkWindow { public SampleBase (string name = "VkWindow", uint _width = 800, uint _height = 600, bool vSync = true) : base (name, _width, _height, vSync){} + protected override void initVulkan() + { + base.initVulkan(); +#if DEBUG + foreach (VkPhysicalDeviceToolPropertiesEXT toolProp in phy.GetToolProperties()) { + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine ($"Enabled Tool: {toolProp.name}({toolProp.version})"); + Console.ResetColor (); + } +#endif + } } } diff --git a/vke/src/base/DebugUtilsMessenger.cs b/vke/src/base/DebugUtilsMessenger.cs index 4c47867..67f13d9 100644 --- a/vke/src/base/DebugUtilsMessenger.cs +++ b/vke/src/base/DebugUtilsMessenger.cs @@ -41,15 +41,15 @@ namespace vke.DebugUtils { break; case VkDebugUtilsMessageTypeFlagsEXT.PerformanceEXT: Console.Write ("PERF:"); - break; + break; } - byte [] tmp = new byte [1024]; + Span tmp = stackalloc byte [2048]; if (data.pMessage != IntPtr.Zero) { byte b = Marshal.ReadByte (data.pMessage); int i = 1; - while (b != 0) { + while (b != 0 && i