/// <summary> /// Initializes a new instance of the <see cref="DebugMarkerObjectTagInfoExt"/> structure. /// </summary> /// <param name="obj">Vulkan object to be tagged.</param> /// <param name="tagName">A numerical identifier of the tag.</param> /// <param name="tag">Bytes containing the data to be associated with the object.</param> public DebugMarkerObjectTagInfoExt(VulkanHandle <long> obj, long tagName, byte[] tag) { ObjectType = GetTypeForObject(obj); Object = obj.Handle; TagName = tagName; Tag = tag; }
public void DebugReportMessageEXT(DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, UInt64 @object, UIntPtr location, Int32 messageCode, string pLayerPrefix, string pMessage) { unsafe { vkDebugReportMessageEXT(this.m, flags, objectType, @object, location, messageCode, pLayerPrefix, pMessage); } }
private Bool32 DebugCallback(DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, ulong objectHandle, IntPtr location, int messageCode, IntPtr layerPrefix, IntPtr message, IntPtr userData) { if (flags != DebugReportFlagsExt.Information) { Debug.WriteLine($"{flags}: {Marshal.PtrToStringAnsi(message)}"); } return(true); }
static public Bool32 DebugReportCallback(DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, ulong objectHandle, IntPtr location, int messageCode, IntPtr layerPrefix, IntPtr message, IntPtr userData) { string layerString = Marshal.PtrToStringAnsi(layerPrefix); string messageString = Marshal.PtrToStringAnsi(message); MGlobal.displayError(string.Format("DebugReport layer: {0} message: {1}", layerString, messageString)); //Console.WriteLine("DebugReport layer: {0} message: {1}", layerString, messageString); return(false); }
/// <summary> /// To inject it's own messages into the debug stream an application uses this method. /// </summary> /// <param name="instance">The instance the callback will be logged on.</param> /// <param name="flags"> /// Indicates the <see cref="DebugReportFlagsExt"/> that triggered this callback. /// </param> /// <param name="objectType"> /// The type of object being used / created at the time the event was triggered. /// </param> /// <param name="object"> /// Gives the object where the issue was detected. Object may be 0 if there is no object /// associated with the event. /// </param> /// <param name="location"> /// A component (layer, driver, loader) defined value that indicates the "location" of the /// trigger. This is an optional value. /// </param> /// <param name="messageCode"> /// A layer defined value indicating what test triggered this callback. /// </param> /// <param name="layerPrefix">Abbreviation of the component making the callback.</param> /// <param name="message">Unicode string detailing the trigger conditions.</param> /// <exception cref="InvalidOperationException">Vulkan command not found.</exception> public static void DebugReportMessageExt(this Instance instance, DebugReportFlagsExt flags, string message, DebugReportObjectTypeExt objectType = DebugReportObjectTypeExt.Unknown, long @object = 0, IntPtr location = default(IntPtr), int messageCode = 0, string layerPrefix = null) { int byteCount = Interop.String.GetMaxByteCount(layerPrefix); var layerPrefixBytes = stackalloc byte[byteCount]; Interop.String.ToPointer(layerPrefix, layerPrefixBytes, byteCount); byteCount = Interop.String.GetMaxByteCount(message); var messageBytes = stackalloc byte[byteCount]; Interop.String.ToPointer(message, messageBytes, byteCount); vkDebugReportMessageEXT(instance) (instance, flags, objectType, @object, location, messageCode, layerPrefixBytes, messageBytes); }
public void DebugReportMessageExt() { const string message = "message õäöü"; const DebugReportObjectTypeExt objectType = DebugReportObjectTypeExt.DebugReportCallback; const long @object = long.MaxValue; var location = new IntPtr(int.MaxValue); const int messageCode = 1; const string layerPrefix = "prefix õäöü"; bool visitedCallback = false; var instanceCreateInfo = new InstanceCreateInfo( enabledExtensionNames: new[] { InstanceExtension.ExtDebugReport }); using (var instance = new Instance(instanceCreateInfo)) { var debugReportCallbackCreateInfo = new DebugReportCallbackCreateInfoExt( DebugReportFlagsExt.Error, args => { Assert.Equal(objectType, args.ObjectType); Assert.Equal(@object, args.Object); Assert.Equal(location, args.Location); Assert.Equal(messageCode, args.MessageCode); Assert.Equal(layerPrefix, args.LayerPrefix); Assert.Equal(message, args.Message); visitedCallback = true; return(false); }); using (instance.CreateDebugReportCallbackExt(debugReportCallbackCreateInfo)) { instance.DebugReportMessageExt(DebugReportFlagsExt.Error, message, objectType, @object, location, messageCode, layerPrefix); } } Assert.True(visitedCallback); }
public static extern void vkDebugReportMessageEXT(IntPtr instance, DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, ulong @object, UIntPtr location, int messageCode, string pLayerPrefix, string pMessage);
/// <summary> /// Initializes a new instance of the <see cref="DebugMarkerObjectNameInfoExt"/> structure. /// </summary> /// <param name="obj">Vulkan object to name.</param> /// <param name="name">Name to set.</param> public DebugMarkerObjectNameInfoExt(VulkanHandle <long> obj, string name) { ObjectType = GetTypeForObject(obj); Object = obj.Handle; ObjectName = name; }
/// <summary> /// Initializes a new instance of the <see cref="DebugMarkerObjectNameInfoExt"/> structure. /// </summary> /// <param name="obj">Vulkan object to be name.</param> /// <param name="name">Name to set.</param> public DebugMarkerObjectNameInfoExt(VulkanHandle <IntPtr> obj, string name) { ObjectType = GetTypeForObject(obj); Object = obj.Handle.ToInt64(); ObjectName = name; }
internal static unsafe extern void vkDebugReportMessageEXT(Instance instance, DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, UInt64 @object, UIntPtr location, Int32 messageCode, IntPtr LayerPrefix, IntPtr Message);
private Bool32 DebugCallback(DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, ulong objectHandle, IntPtr location, int messageCode, IntPtr layerPrefix, IntPtr message, IntPtr userData) { Debug.WriteLine($"[{flags} | {objectType}]: {Marshal.PtrToStringAnsi(message)} - {location}"); Console.WriteLine($"[{flags} | {objectType}]: {Marshal.PtrToStringAnsi(message)} - {location}"); return(false); }