Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        internal static unsafe DebugUtilsMessengerCallbackData MarshalFrom(SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *pointer)
        {
            DebugUtilsMessengerCallbackData result = default(DebugUtilsMessengerCallbackData);

            result.Flags           = pointer->Flags;
            result.MessageIdName   = Interop.HeapUtil.MarshalStringFrom(pointer->MessageIdName);
            result.MessageIdNumber = pointer->MessageIdNumber;
            result.Message         = Interop.HeapUtil.MarshalStringFrom(pointer->Message);

            if (pointer->QueueLabels == null)
            {
                result.QueueLabels = null;
            }
            else
            {
                result.QueueLabels = new DebugUtilsLabel[pointer->QueueLabelCount];
                for (int index = 0; index < (uint)(result.QueueLabels.Length); index++)
                {
                    result.QueueLabels[index] = SharpVk.Multivendor.DebugUtilsLabel.MarshalFrom(&pointer->QueueLabels[index]);
                }
            }

            if (pointer->CommandBufLabels == null)
            {
                result.CommandBufLabels = null;
            }
            else
            {
                result.CommandBufLabels = new DebugUtilsLabel[pointer->CommandBufLabelCount];
                for (int index = 0; index < (uint)(result.CommandBufLabels.Length); index++)
                {
                    result.CommandBufLabels[index] = SharpVk.Multivendor.DebugUtilsLabel.MarshalFrom(&pointer->CommandBufLabels[index]);
                }
            }

            if (pointer->Objects == null)
            {
                result.Objects = null;
            }
            else
            {
                result.Objects = new DebugUtilsObjectNameInfo[pointer->ObjectCount];
                for (int index = 0; index < (uint)(result.Objects.Length); index++)
                {
                    result.Objects[index] = SharpVk.Multivendor.DebugUtilsObjectNameInfo.MarshalFrom(&pointer->Objects[index]);
                }
            }

            return(result);
        }
Ejemplo n.º 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);
        }