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);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DebugReportCallbackCreateInfoExt"/> structure.
 /// </summary>
 /// <param name="flags">
 /// A bitmask specifying which event(s) will cause this callback to be called. Flags are
 /// interpreted as bitmasks and multiple can be set.
 /// </param>
 /// <param name="callback">The application callback function to call.</param>
 /// <param name="userData">User data to be passed to the callback.</param>
 public DebugReportCallbackCreateInfoExt(
     DebugReportFlagsExt flags,
     Func <DebugReportCallbackInfo, bool> callback,
     IntPtr userData = default(IntPtr))
 {
     Flags    = flags;
     Callback = callback;
     UserData = userData;
 }
예제 #4
0
        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);
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        public void EnableDebug(DebugReportCallback d, DebugReportFlagsExt flags = DebugReportFlagsExt.Debug | DebugReportFlagsExt.Error | DebugReportFlagsExt.Information | DebugReportFlagsExt.PerformanceWarning | DebugReportFlagsExt.Warning)
        {
            if (vkCreateDebugReportCallbackEXT == null)
            {
                throw new InvalidOperationException("vkCreateDebugReportCallbackEXT is not available, possibly you might be missing VK_EXT_debug_report extension. Try to enable it when creating the Instance.");
            }

            var debugCreateInfo = new DebugReportCallbackCreateInfoExt()
            {
                Flags       = flags,
                PfnCallback = Marshal.GetFunctionPointerForDelegate(d)
            };

            if (debugCallback != null)
            {
                DestroyDebugReportCallbackEXT(debugCallback);
            }
            debugCallback = CreateDebugReportCallbackEXT(debugCreateInfo);
        }
예제 #7
0
 public static extern void vkDebugReportMessageEXT(IntPtr instance, DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, ulong @object, UIntPtr location, int messageCode, string pLayerPrefix, string pMessage);
예제 #8
0
 internal static unsafe extern void vkDebugReportMessageEXT(Instance instance, DebugReportFlagsExt flags, DebugReportObjectTypeExt objectType, UInt64 @object, UIntPtr location, Int32 messageCode, IntPtr LayerPrefix, IntPtr Message);
예제 #9
0
 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);
 }