Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="callback"></param>
 /// <param name="messageSeverity"></param>
 /// <param name="messageType"></param>
 /// <param name="flags"></param>
 public DebugUtilsMessengerWrapper(Delegate callback, SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageType, SharpVk.Multivendor.DebugUtilsMessengerCreateFlags?flags = null)
 {
     callback_       = callback;
     gch_            = System.Runtime.InteropServices.GCHandle.Alloc(this);
     Flags           = flags;
     MessageSeverity = messageSeverity;
     MessageType     = messageType;
     Enabled         = false;
 }
Beispiel #2
0
        private static unsafe Bool32 DebugUtilsMessengerWrapperCallback(SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageTypes, IntPtr pCallbackData, IntPtr pUserData)
        {
            if (pUserData == IntPtr.Zero)
            {
                return(false);
            }

            System.Runtime.InteropServices.GCHandle gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(pUserData);
            DebugUtilsMessengerWrapper callback         = (DebugUtilsMessengerWrapper)gch.Target;

            if (callback == null)
            {
                return(false);
            }

            SharpVk.Multivendor.DebugUtilsMessengerCallbackData userData = SharpVk.Multivendor.DebugUtilsMessengerCallbackData.MarshalFrom((SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *)pCallbackData.ToPointer());
            return(callback.callback_(messageSeverity, messageTypes, userData) && callback.ValidationLayerTesting);
        }