Example #1
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="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Instance Create(ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = default(SharpVk.InstanceCreateFlags?), SharpVk.ApplicationInfo?applicationInfo = default(SharpVk.ApplicationInfo?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Instance result = default(SharpVk.Instance);
         SharpVk.Interop.InstanceCreateInfo * marshalledCreateInfo = default(SharpVk.Interop.InstanceCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Instance             marshalledInstance   = default(SharpVk.Interop.Instance);
         marshalledCreateInfo        = (SharpVk.Interop.InstanceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.InstanceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.InstanceCreateInfo;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.InstanceCreateFlags);
         }
         if (applicationInfo != null)
         {
             marshalledCreateInfo->ApplicationInfo = (SharpVk.Interop.ApplicationInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.ApplicationInfo>());
             applicationInfo.Value.MarshalTo(marshalledCreateInfo->ApplicationInfo);
         }
         else
         {
             marshalledCreateInfo->ApplicationInfo = default(SharpVk.Interop.ApplicationInfo *);
         }
         marshalledCreateInfo->EnabledLayerCount     = (uint)(Interop.HeapUtil.GetLength(enabledLayerNames));
         marshalledCreateInfo->EnabledLayerNames     = Interop.HeapUtil.MarshalTo(enabledLayerNames);
         marshalledCreateInfo->EnabledExtensionCount = (uint)(Interop.HeapUtil.GetLength(enabledExtensionNames));
         marshalledCreateInfo->EnabledExtensionNames = Interop.HeapUtil.MarshalTo(enabledExtensionNames);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         Result methodResult = Interop.Commands.vkCreateInstance(marshalledCreateInfo, marshalledAllocator, &marshalledInstance);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Instance(marshalledInstance);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #2
0
 /// <summary>
 /// Create a SurfaceKHR structure representing a display plane and
 /// mode.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use, and must be zero.
 /// </param>
 /// <param name="displayMode">
 /// The mode to use when displaying this surface.
 /// </param>
 /// <param name="planeIndex">
 /// The plane on which this surface appears.
 /// </param>
 /// <param name="planeStackIndex">
 /// The z-order of the plane.
 /// </param>
 /// <param name="transform">
 /// The transform to apply to the images as part of the scanout
 /// operation.
 /// </param>
 /// <param name="globalAlpha">
 /// The global alpha value. This value is ignored if alphaMode is not
 /// VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR.
 /// </param>
 /// <param name="alphaMode">
 /// The type of alpha blending to use.
 /// </param>
 /// <param name="imageExtent">
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Surface CreateDisplayPlaneSurface(this SharpVk.Instance extendedHandle, SharpVk.Khronos.DisplayMode displayMode, uint planeIndex, uint planeStackIndex, SharpVk.Khronos.SurfaceTransformFlags transform, float globalAlpha, SharpVk.Khronos.DisplayPlaneAlphaFlags alphaMode, SharpVk.Extent2D imageExtent, SharpVk.Khronos.DisplaySurfaceCreateFlags?flags = default(SharpVk.Khronos.DisplaySurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Surface result       = default(SharpVk.Khronos.Surface);
         CommandCache            commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *);
         void *vkDisplaySurfaceCreateInfoKHRNextPointer           = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Surface      marshalledSurface   = default(SharpVk.Interop.Khronos.Surface);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplaySurfaceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DisplaySurfaceCreateInfo;
         marshalledCreateInfo->Next  = vkDisplaySurfaceCreateInfoKHRNextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplaySurfaceCreateFlags);
         }
         marshalledCreateInfo->DisplayMode     = displayMode?.handle ?? default(SharpVk.Interop.Khronos.DisplayMode);
         marshalledCreateInfo->PlaneIndex      = planeIndex;
         marshalledCreateInfo->PlaneStackIndex = planeStackIndex;
         marshalledCreateInfo->Transform       = transform;
         marshalledCreateInfo->GlobalAlpha     = globalAlpha;
         marshalledCreateInfo->AlphaMode       = alphaMode;
         marshalledCreateInfo->ImageExtent     = imageExtent;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkInstanceCreateDisplayPlaneSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateDisplayPlaneSurfaceKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe void DebugReportMessage(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugReportFlags flags, SharpVk.Multivendor.DebugReportObjectType objectType, ulong @object, HostSize location, int messageCode, string layerPrefix, string message)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Multivendor.VkInstanceDebugReportMessageDelegate commandDelegate = commandCache.Cache.vkDebugReportMessageEXT;
         commandDelegate(extendedHandle.handle, flags, objectType, @object, location, messageCode, Interop.HeapUtil.MarshalTo(layerPrefix), Interop.HeapUtil.MarshalTo(message));
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #4
0
 /// <summary>
 /// Create a SurfaceKHR object for a Wayland window.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="display">
 /// display and surface are pointers to the Wayland wl_display and
 /// wl_surface to associate the surface with.
 /// </param>
 /// <param name="surface">
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Surface CreateWaylandSurface(this SharpVk.Instance extendedHandle, IntPtr display, IntPtr surface, SharpVk.Khronos.WaylandSurfaceCreateFlags?flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Surface result       = default(SharpVk.Khronos.Surface);
         CommandCache            commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *);
         void *vkWaylandSurfaceCreateInfoKHRNextPointer           = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Surface      marshalledSurface   = default(SharpVk.Interop.Khronos.Surface);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.WaylandSurfaceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.WaylandSurfaceCreateInfo;
         marshalledCreateInfo->Next  = vkWaylandSurfaceCreateInfoKHRNextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.WaylandSurfaceCreateFlags);
         }
         marshalledCreateInfo->Display = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>());
         *marshalledCreateInfo->Display = display;
         marshalledCreateInfo->Surface = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>());
         *marshalledCreateInfo->Surface = surface;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkInstanceCreateWaylandSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateWaylandSurfaceKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 /// Create a SurfaceKHR object for a Mir window.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="connection">
 /// connection and surface are pointers to the MirConnection and
 /// MirSurface for the window to associate the surface with.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Surface CreateMirSurface(this SharpVk.Instance extendedHandle, IntPtr connection, IntPtr mirSurface, SharpVk.Khronos.MirSurfaceCreateFlags?flags = default(SharpVk.Khronos.MirSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Surface result       = default(SharpVk.Khronos.Surface);
         CommandCache            commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.MirSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.MirSurfaceCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *         marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Surface marshalledSurface = default(SharpVk.Interop.Khronos.Surface);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.MirSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.MirSurfaceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.MirSurfaceCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.MirSurfaceCreateFlags);
         }
         marshalledCreateInfo->Connection = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>());
         *marshalledCreateInfo->Connection = connection;
         marshalledCreateInfo->MirSurface = (IntPtr *)(Interop.HeapUtil.Allocate <IntPtr>());
         *marshalledCreateInfo->MirSurface = mirSurface;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkInstanceCreateMirSurfaceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkInstanceCreateMirSurfaceDelegate>("vkCreateMirSurfaceKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #6
0
 /// <summary>
 /// Create a SurfaceKHR object for a VI layer.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="window">
 /// The nn::vi::NativeWindowHandle for the nn::vi::Layer with which to
 /// associate the surface.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Surface CreateViSurface(this SharpVk.Instance extendedHandle, IntPtr window, SharpVk.Nintendo.ViSurfaceCreateFlags?flags = default(SharpVk.Nintendo.ViSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Surface result       = default(SharpVk.Khronos.Surface);
         CommandCache            commandCache = default(CommandCache);
         SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Surface      marshalledSurface   = default(SharpVk.Interop.Khronos.Surface);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Nintendo.ViSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Nintendo.ViSurfaceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.ViSurfaceCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Nintendo.ViSurfaceCreateFlags);
         }
         marshalledCreateInfo->Window = window.ToPointer();
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Nintendo.VkInstanceCreateViSurfaceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Nintendo.VkInstanceCreateViSurfaceDelegate>("vkCreateViSurfaceNN", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe void SubmitDebugUtilsMessage(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageTypes, SharpVk.Multivendor.DebugUtilsMessengerCallbackData callbackData)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *marshalledCallbackData = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *);
         commandCache           = extendedHandle.commandCache;
         marshalledCallbackData = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCallbackData>());
         callbackData.MarshalTo(marshalledCallbackData);
         SharpVk.Interop.Multivendor.VkInstanceSubmitDebugUtilsMessageDelegate commandDelegate = commandCache.Cache.vkSubmitDebugUtilsMessageEXT;
         commandDelegate(extendedHandle.handle, messageSeverity, messageTypes, marshalledCallbackData);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe SharpVk.Khronos.Surface CreateImagePipeSurface(this SharpVk.Instance extendedHandle, uint imagePipeHandle, SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags?flags = default(SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Surface result       = default(SharpVk.Khronos.Surface);
         CommandCache            commandCache = default(CommandCache);
         SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Surface      marshalledSurface   = default(SharpVk.Interop.Khronos.Surface);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Fuchsia.ImagePipeSurfaceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.ImagepipeSurfaceCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Fuchsia.ImagePipeSurfaceCreateFlags);
         }
         marshalledCreateInfo->ImagePipeHandle = imagePipeHandle;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Fuchsia.VkInstanceCreateImagePipeSurfaceDelegate commandDelegate = commandCache.Cache.vkCreateImagePipeSurfaceFUCHSIA;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSurface);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Surface(extendedHandle, marshalledSurface);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #9
0
 internal PhysicalDevice(SharpVk.Instance parent, SharpVk.Interop.PhysicalDevice handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #10
0
 /// <summary>
 /// Create a debug report callback object.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 /// <param name="flags">
 /// flags indicate which event(s) will cause this callback to be
 /// called. Flags are interpreted as bitmasks and multiple may be set.
 /// Bits which can be set include: + --
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Multivendor.DebugReportCallback CreateDebugReportCallback(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugReportCallbackDelegate callback, SharpVk.Multivendor.DebugReportFlags?flags = default(SharpVk.Multivendor.DebugReportFlags?), IntPtr?userData = default(IntPtr?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Multivendor.DebugReportCallback result = default(SharpVk.Multivendor.DebugReportCallback);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *           marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Multivendor.DebugReportCallback marshalledCallback  = default(SharpVk.Interop.Multivendor.DebugReportCallback);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DebugReportCallbackCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Multivendor.DebugReportFlags);
         }
         marshalledCreateInfo->Callback = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(callback);
         if (userData != null)
         {
             marshalledCreateInfo->UserData = userData.Value.ToPointer();
         }
         else
         {
             marshalledCreateInfo->UserData = default(void *);
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Multivendor.VkInstanceCreateDebugReportCallbackDelegate commandDelegate = commandCache.Cache.vkCreateDebugReportCallbackEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledCallback);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Multivendor.DebugReportCallback(extendedHandle, marshalledCallback);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #11
0
 internal Surface(SharpVk.Instance parent, SharpVk.Interop.Khronos.Surface handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #12
0
 internal DebugReportCallback(SharpVk.Instance parent, SharpVk.Interop.Multivendor.DebugReportCallback handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
 /// <summary>
 /// Enumerates groups of physical devices that can be used to create a
 /// single logical device.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[] EnumeratePhysicalDeviceGroups(this SharpVk.Instance extendedHandle)
 {
     try
     {
         SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[] result = default(SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[]);
         uint         physicalDeviceGroupCount = default(uint);
         CommandCache commandCache             = default(CommandCache);
         SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *marshalledPhysicalDeviceGroupProperties = default(SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.Experimental.VkInstanceEnumeratePhysicalDeviceGroupsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkInstanceEnumeratePhysicalDeviceGroupsDelegate>("vkEnumeratePhysicalDeviceGroupsKHX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, &physicalDeviceGroupCount, marshalledPhysicalDeviceGroupProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledPhysicalDeviceGroupProperties = (SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.PhysicalDeviceGroupProperties>((uint)(physicalDeviceGroupCount)));
         commandDelegate(extendedHandle.handle, &physicalDeviceGroupCount, marshalledPhysicalDeviceGroupProperties);
         if (marshalledPhysicalDeviceGroupProperties != null)
         {
             var fieldPointer = new SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties[(uint)(physicalDeviceGroupCount)];
             for (int index = 0; index < (uint)(physicalDeviceGroupCount); index++)
             {
                 fieldPointer[index] = SharpVk.Khronos.Experimental.PhysicalDeviceGroupProperties.MarshalFrom(&marshalledPhysicalDeviceGroupProperties[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #14
0
 public virtual void Dispose() => Instance?.Dispose();
Example #15
0
 /// <summary>
 /// Create a new Vulkan instance.
 /// </summary>
 /// <param name="commandCache">
 /// </param>
 /// <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="debugReportCallbackCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="validationFlagsExt">
 /// Extension struct
 /// </param>
 /// <param name="validationFeaturesExt">
 /// Extension struct
 /// </param>
 /// <param name="debugUtilsMessengerCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Instance Create(CommandCache commandCache, ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = default(SharpVk.InstanceCreateFlags?), SharpVk.ApplicationInfo?applicationInfo = default(SharpVk.ApplicationInfo?), SharpVk.Multivendor.DebugReportCallbackCreateInfo?debugReportCallbackCreateInfoExt = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, SharpVk.Multivendor.ValidationFeatures?validationFeaturesExt = null, SharpVk.Multivendor.DebugUtilsMessengerCreateInfo?debugUtilsMessengerCreateInfoExt = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Instance result = default(SharpVk.Instance);
         SharpVk.Interop.InstanceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.InstanceCreateInfo *);
         void *vkInstanceCreateInfoNextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Instance             marshalledInstance  = default(SharpVk.Interop.Instance);
         if (debugReportCallbackCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo>());
             debugReportCallbackCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         if (validationFlagsExt != null)
         {
             SharpVk.Interop.Multivendor.ValidationFlags *extensionPointer = default(SharpVk.Interop.Multivendor.ValidationFlags *);
             extensionPointer = (SharpVk.Interop.Multivendor.ValidationFlags *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationFlags>());
             validationFlagsExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         if (validationFeaturesExt != null)
         {
             SharpVk.Interop.Multivendor.ValidationFeatures *extensionPointer = default(SharpVk.Interop.Multivendor.ValidationFeatures *);
             extensionPointer = (SharpVk.Interop.Multivendor.ValidationFeatures *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationFeatures>());
             validationFeaturesExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         if (debugUtilsMessengerCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo>());
             debugUtilsMessengerCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         marshalledCreateInfo        = (SharpVk.Interop.InstanceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.InstanceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.InstanceCreateInfo;
         marshalledCreateInfo->Next  = vkInstanceCreateInfoNextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.InstanceCreateFlags);
         }
         if (applicationInfo != null)
         {
             marshalledCreateInfo->ApplicationInfo = (SharpVk.Interop.ApplicationInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.ApplicationInfo>());
             applicationInfo.Value.MarshalTo(marshalledCreateInfo->ApplicationInfo);
         }
         else
         {
             marshalledCreateInfo->ApplicationInfo = default(SharpVk.Interop.ApplicationInfo *);
         }
         marshalledCreateInfo->EnabledLayerCount     = (uint)(Interop.HeapUtil.GetLength(enabledLayerNames));
         marshalledCreateInfo->EnabledLayerNames     = Interop.HeapUtil.MarshalTo(enabledLayerNames);
         marshalledCreateInfo->EnabledExtensionCount = (uint)(Interop.HeapUtil.GetLength(enabledExtensionNames));
         marshalledCreateInfo->EnabledExtensionNames = Interop.HeapUtil.MarshalTo(enabledExtensionNames);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.VkInstanceCreateDelegate commandDelegate = commandCache.Cache.vkCreateInstance;
         Result methodResult = commandDelegate(marshalledCreateInfo, marshalledAllocator, &marshalledInstance);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Instance(commandCache, marshalledInstance);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 internal DebugUtilsMessenger(SharpVk.Instance parent, SharpVk.Interop.Multivendor.DebugUtilsMessenger handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }