Пример #1
0
        /// <summary>
        ///
        /// </summary>
        public override void Dispose()
        {
            Debugger?.Dispose();
            Debugger = null;

            Instance?.Dispose();
            Instance = null;

            gch_.Free();
        }
Пример #2
0
 /// <summary>
 /// Create a new Vulkan instance.
 /// </summary>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="applicationInfo">
 /// Null or an instance of ApplicationInfo. If not Null, this
 /// information helps implementations recognize behavior inherent to
 /// classes of applications. ApplicationInfo is defined in detail
 /// below.
 /// </param>
 /// <param name="enabledLayerNames">
 /// An array of enabledLayerCount strings containing the names of
 /// layers to enable for the created instance. See the Layers section
 /// for further details.
 /// </param>
 /// <param name="enabledExtensionNames">
 /// An array of enabledExtensionCount strings containing the names of
 /// extensions to enable.
 /// </param>
 /// <param name="validationFlagsExt">
 /// </param>
 /// <param name="validationFeaturesExt"></param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public override unsafe void CreateInstance(ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = null, SharpVk.ApplicationInfo?applicationInfo = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, SharpVk.Multivendor.ValidationFeatures?validationFeaturesExt = null, AllocationCallbacks?allocator = null)
 {
     if (Instance != null)
     {
         return;
     }
     else if (Enabled)
     {
         Instance = SharpVk.Instance.Create(enabledLayerNames.GetValueOrDefault().AddUnique("VK_LAYER_KHRONOS_validation"), enabledExtensionNames.GetValueOrDefault().AddUnique(SharpVk.Multivendor.ExtExtensions.DebugUtils), flags, applicationInfo, null, validationFlagsExt, validationFeaturesExt, this, allocator);
         Debugger = Instance.CreateDebugUtilsMessenger(MessageSeverity, MessageType, DebugUtilsMessengerCallbackDelegate, Flags, System.Runtime.InteropServices.GCHandle.ToIntPtr(gch_), allocator);
     }
     else
     {
         Instance = SharpVk.Instance.Create(enabledLayerNames, enabledExtensionNames, flags, applicationInfo, null, validationFlagsExt, validationFeaturesExt, null, allocator);
     }
 }