Ejemplo n.º 1
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();
     }
 }
Ejemplo n.º 2
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();
     }
 }
Ejemplo n.º 3
0
 /// <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();
     }
 }
Ejemplo n.º 4
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();
     }
 }
Ejemplo n.º 5
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();
     }
 }
 /// <summary>
 /// Query present rectangles for a surface on a physical device.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 public static unsafe SharpVk.Rect2D[] GetPresentRectangles(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Surface surface)
 {
     try
     {
         SharpVk.Rect2D[] result          = default(SharpVk.Rect2D[]);
         uint             rectCount       = default(uint);
         CommandCache     commandCache    = default(CommandCache);
         SharpVk.Rect2D * marshalledRects = default(SharpVk.Rect2D *);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.Experimental.VkPhysicalDeviceGetPresentRectanglesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkPhysicalDeviceGetPresentRectanglesDelegate>("vkGetPhysicalDevicePresentRectanglesKHX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &rectCount, marshalledRects);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledRects = (SharpVk.Rect2D *)(Interop.HeapUtil.Allocate <SharpVk.Rect2D>((uint)(rectCount)));
         commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &rectCount, marshalledRects);
         if (marshalledRects != null)
         {
             var fieldPointer = new SharpVk.Rect2D[(uint)(rectCount)];
             for (int index = 0; index < (uint)(rectCount); index++)
             {
                 fieldPointer[index] = marshalledRects[index];
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.Experimental.DeviceGroupPresentModeFlags GetGroupSurfacePresentModes(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface)
 {
     try
     {
         SharpVk.Khronos.Experimental.DeviceGroupPresentModeFlags result = default(SharpVk.Khronos.Experimental.DeviceGroupPresentModeFlags);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Khronos.Experimental.DeviceGroupPresentModeFlags marshalledModes = default(SharpVk.Khronos.Experimental.DeviceGroupPresentModeFlags);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.Experimental.VkDeviceGetGroupSurfacePresentModesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.Experimental.VkDeviceGetGroupSurfacePresentModesDelegate>("vkGetDeviceGroupSurfacePresentModesKHX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledModes);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledModes;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 /// Query color formats supported by surface.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 public static unsafe SharpVk.Khronos.SurfaceFormat[] GetSurfaceFormats(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Surface surface)
 {
     try
     {
         SharpVk.Khronos.SurfaceFormat[] result    = default(SharpVk.Khronos.SurfaceFormat[]);
         uint         marshalledSurfaceFormatCount = default(uint);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Khronos.SurfaceFormat *marshalledSurfaceFormats = default(SharpVk.Khronos.SurfaceFormat *);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.VkPhysicalDeviceGetSurfaceFormatsDelegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceSurfaceFormatsKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledSurfaceFormatCount, marshalledSurfaceFormats);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledSurfaceFormats = (SharpVk.Khronos.SurfaceFormat *)(Interop.HeapUtil.Allocate <SharpVk.Khronos.SurfaceFormat>((uint)(marshalledSurfaceFormatCount)));
         commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledSurfaceFormatCount, marshalledSurfaceFormats);
         if (marshalledSurfaceFormats != null)
         {
             var fieldPointer = new SharpVk.Khronos.SurfaceFormat[(uint)(marshalledSurfaceFormatCount)];
             for (int index = 0; index < (uint)(marshalledSurfaceFormatCount); index++)
             {
                 fieldPointer[index] = marshalledSurfaceFormats[index];
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 /// Query surface capabilities.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 public static unsafe SharpVk.Khronos.SurfaceCapabilities GetSurfaceCapabilities(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Surface surface)
 {
     try
     {
         SharpVk.Khronos.SurfaceCapabilities result = default(SharpVk.Khronos.SurfaceCapabilities);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Khronos.SurfaceCapabilities marshalledSurfaceCapabilities = default(SharpVk.Khronos.SurfaceCapabilities);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.VkPhysicalDeviceGetSurfaceCapabilitiesDelegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledSurfaceCapabilities);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledSurfaceCapabilities;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 /// Query if presentation is supported.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 public static unsafe bool GetSurfaceSupport(this SharpVk.PhysicalDevice extendedHandle, uint queueFamilyIndex, SharpVk.Khronos.Surface surface)
 {
     try
     {
         bool         result              = default(bool);
         CommandCache commandCache        = default(CommandCache);
         Bool32       marshalledSupported = default(Bool32);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.VkPhysicalDeviceGetSurfaceSupportDelegate commandDelegate = commandCache.Cache.vkGetPhysicalDeviceSurfaceSupportKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, queueFamilyIndex, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledSupported);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledSupported;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.Swapchain CreateSwapchain(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface, uint minImageCount, SharpVk.Format imageFormat, SharpVk.Khronos.ColorSpace imageColorSpace, SharpVk.Extent2D imageExtent, uint imageArrayLayers, SharpVk.ImageUsageFlags imageUsage, SharpVk.SharingMode imageSharingMode, uint[] queueFamilyIndices, SharpVk.Khronos.SurfaceTransformFlags preTransform, SharpVk.Khronos.CompositeAlphaFlags compositeAlpha, SharpVk.Khronos.PresentMode presentMode, bool clipped, SharpVk.Khronos.Swapchain oldSwapchain, SharpVk.Khronos.SwapchainCreateFlags?flags = default(SharpVk.Khronos.SwapchainCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain result = default(SharpVk.Khronos.Swapchain);
         CommandCache commandCache        = default(CommandCache);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain            marshalledSwapchain  = default(SharpVk.Interop.Khronos.Swapchain);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
         marshalledCreateInfo->SType = StructureType.SwapchainCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.SwapchainCreateFlags);
         }
         marshalledCreateInfo->Surface               = surface?.handle ?? default(SharpVk.Interop.Khronos.Surface);
         marshalledCreateInfo->MinImageCount         = minImageCount;
         marshalledCreateInfo->ImageFormat           = imageFormat;
         marshalledCreateInfo->ImageColorSpace       = imageColorSpace;
         marshalledCreateInfo->ImageExtent           = imageExtent;
         marshalledCreateInfo->ImageArrayLayers      = imageArrayLayers;
         marshalledCreateInfo->ImageUsage            = imageUsage;
         marshalledCreateInfo->ImageSharingMode      = imageSharingMode;
         marshalledCreateInfo->QueueFamilyIndexCount = (uint)(queueFamilyIndices?.Length ?? 0);
         if (queueFamilyIndices != null)
         {
             var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(queueFamilyIndices.Length).ToPointer());
             for (int index = 0; index < (uint)(queueFamilyIndices.Length); index++)
             {
                 fieldPointer[index] = queueFamilyIndices[index];
             }
             marshalledCreateInfo->QueueFamilyIndices = fieldPointer;
         }
         else
         {
             marshalledCreateInfo->QueueFamilyIndices = null;
         }
         marshalledCreateInfo->PreTransform   = preTransform;
         marshalledCreateInfo->CompositeAlpha = compositeAlpha;
         marshalledCreateInfo->PresentMode    = presentMode;
         marshalledCreateInfo->Clipped        = clipped;
         marshalledCreateInfo->OldSwapchain   = oldSwapchain?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
         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.VkDeviceCreateSwapchainDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateSwapchainDelegate>("vkCreateSwapchainKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSwapchain);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchain);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 /// Query surface capabilities.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 public static unsafe SharpVk.Multivendor.SurfaceCapabilities2 GetSurfaceCapabilities2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Surface surface)
 {
     try
     {
         SharpVk.Multivendor.SurfaceCapabilities2 result = default(SharpVk.Multivendor.SurfaceCapabilities2);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.SurfaceCapabilities2 marshalledSurfaceCapabilities = default(SharpVk.Interop.Multivendor.SurfaceCapabilities2);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Multivendor.VkPhysicalDeviceGetSurfaceCapabilities2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkPhysicalDeviceGetSurfaceCapabilities2Delegate>("vkGetPhysicalDeviceSurfaceCapabilities2EXT", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, surface?.handle ?? default(SharpVk.Interop.Khronos.Surface), &marshalledSurfaceCapabilities);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = SharpVk.Multivendor.SurfaceCapabilities2.MarshalFrom(&marshalledSurfaceCapabilities);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Makes a new instance of <see cref="VKSurface"/> class.
 /// </summary>
 public VKSurface(SharpVk.Khronos.Surface surface) : base()
 {
     Handle = surface;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Create a swapchain.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// A bitmask indicating parameters of swapchain creation. Bits which
 /// can be set include: + --
 /// </param>
 /// <param name="queueFamilyIndices">
 /// </param>
 /// <param name="swapchainCounterCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="deviceGroupSwapchainCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="imageFormatListCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain CreateSwapchain(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface, uint minImageCount, SharpVk.Format imageFormat, SharpVk.Khronos.ColorSpace imageColorSpace, SharpVk.Extent2D imageExtent, uint imageArrayLayers, SharpVk.ImageUsageFlags imageUsage, SharpVk.SharingMode imageSharingMode, ArrayProxy <uint>?queueFamilyIndices, SharpVk.Khronos.SurfaceTransformFlags preTransform, SharpVk.Khronos.CompositeAlphaFlags compositeAlpha, SharpVk.Khronos.PresentMode presentMode, bool clipped, SharpVk.Khronos.Swapchain oldSwapchain, SharpVk.Khronos.SwapchainCreateFlags?flags = default(SharpVk.Khronos.SwapchainCreateFlags?), SharpVk.Multivendor.SwapchainCounterCreateInfo?swapchainCounterCreateInfoExt = null, SharpVk.Khronos.DeviceGroupSwapchainCreateInfo?deviceGroupSwapchainCreateInfoKhr = null, SharpVk.Khronos.ImageFormatListCreateInfo?imageFormatListCreateInfoKhr = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain result = default(SharpVk.Khronos.Swapchain);
         CommandCache commandCache        = default(CommandCache);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain    marshalledSwapchain = default(SharpVk.Interop.Khronos.Swapchain);
         if (swapchainCounterCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo>());
             swapchainCounterCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (deviceGroupSwapchainCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo>());
             deviceGroupSwapchainCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (imageFormatListCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.ImageFormatListCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.ImageFormatListCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.ImageFormatListCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.ImageFormatListCreateInfo>());
             imageFormatListCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
         marshalledCreateInfo->SType = StructureType.SwapchainCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.SwapchainCreateFlags);
         }
         marshalledCreateInfo->Surface               = surface?.handle ?? default(SharpVk.Interop.Khronos.Surface);
         marshalledCreateInfo->MinImageCount         = minImageCount;
         marshalledCreateInfo->ImageFormat           = imageFormat;
         marshalledCreateInfo->ImageColorSpace       = imageColorSpace;
         marshalledCreateInfo->ImageExtent           = imageExtent;
         marshalledCreateInfo->ImageArrayLayers      = imageArrayLayers;
         marshalledCreateInfo->ImageUsage            = imageUsage;
         marshalledCreateInfo->ImageSharingMode      = imageSharingMode;
         marshalledCreateInfo->QueueFamilyIndexCount = (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices));
         if (queueFamilyIndices.IsNull())
         {
             marshalledCreateInfo->QueueFamilyIndices = null;
         }
         else
         {
             if (queueFamilyIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->QueueFamilyIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfo->QueueFamilyIndices) = queueFamilyIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)); index++)
                 {
                     fieldPointer[index] = queueFamilyIndices.Value[index];
                 }
                 marshalledCreateInfo->QueueFamilyIndices = fieldPointer;
             }
         }
         marshalledCreateInfo->PreTransform   = preTransform;
         marshalledCreateInfo->CompositeAlpha = compositeAlpha;
         marshalledCreateInfo->PresentMode    = presentMode;
         marshalledCreateInfo->Clipped        = clipped;
         marshalledCreateInfo->OldSwapchain   = oldSwapchain?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
         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.VkDeviceCreateSwapchainDelegate commandDelegate = commandCache.Cache.vkCreateSwapchainKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSwapchain);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchain);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }