Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="pipelineBindPoint">
 /// The PipelineBindPoint that this layout targets.
 /// </param>
 /// <param name="flags">
 /// A bitmask providing usage hints of this layout. See
 /// IndirectCommandsLayoutUsageFlagBitsNVX below for a description of
 /// the supported bits.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.NVidia.Experimental.IndirectCommandsLayout CreateIndirectCommandsLayout(this SharpVk.Device extendedHandle, SharpVk.PipelineBindPoint pipelineBindPoint, SharpVk.NVidia.Experimental.IndirectCommandsLayoutUsageFlags flags, ArrayProxy <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>?tokens, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.Experimental.IndirectCommandsLayout result = default(SharpVk.NVidia.Experimental.IndirectCommandsLayout);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout marshalledIndirectCommandsLayout = default(SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayout);
         commandCache                            = extendedHandle.commandCache;
         marshalledCreateInfo                    = (SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.IndirectCommandsLayoutCreateInfo>());
         marshalledCreateInfo->SType             = StructureType.IndirectCommandsLayoutCreateInfoNvx;
         marshalledCreateInfo->Next              = null;
         marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint;
         marshalledCreateInfo->Flags             = flags;
         marshalledCreateInfo->TokenCount        = (uint)(Interop.HeapUtil.GetLength(tokens));
         if (tokens.IsNull())
         {
             marshalledCreateInfo->Tokens = null;
         }
         else
         {
             if (tokens.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->Tokens = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>());
                 *(SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(marshalledCreateInfo->Tokens) = tokens.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.IndirectCommandsLayoutToken>(Interop.HeapUtil.GetLength(tokens.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(tokens.Value)); index++)
                 {
                     fieldPointer[index] = tokens.Value[index];
                 }
                 marshalledCreateInfo->Tokens = fieldPointer;
             }
         }
         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.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkDeviceCreateIndirectCommandsLayoutDelegate>("vkCreateIndirectCommandsLayoutNVX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledIndirectCommandsLayout);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.Experimental.IndirectCommandsLayout(extendedHandle, marshalledIndirectCommandsLayout);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #2
0
 /// <summary>
 /// Signal a fence when a device event occurs.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="deviceEventInfo">
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Fence RegisterEvent(this SharpVk.Device extendedHandle, SharpVk.Multivendor.DeviceEventInfo deviceEventInfo, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Fence result       = default(SharpVk.Fence);
         CommandCache  commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.DeviceEventInfo *marshalledDeviceEventInfo = default(SharpVk.Interop.Multivendor.DeviceEventInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator       = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence);
         commandCache = extendedHandle.commandCache;
         marshalledDeviceEventInfo = (SharpVk.Interop.Multivendor.DeviceEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DeviceEventInfo>());
         deviceEventInfo.MarshalTo(marshalledDeviceEventInfo);
         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.VkDeviceRegisterEventDelegate commandDelegate = commandCache.Cache.vkRegisterDeviceEventEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledDeviceEventInfo, marshalledAllocator, &marshalledFence);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Fence(extendedHandle, marshalledFence);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Fence RegisterDisplayEvent(this SharpVk.Device extendedHandle, SharpVk.Khronos.Display display, SharpVk.Multivendor.DisplayEventInfo displayEventInfo, SharpVk.AllocationCallbacks allocator)
 {
     try
     {
         SharpVk.Fence result       = default(SharpVk.Fence);
         CommandCache  commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.DisplayEventInfo *marshalledDisplayEventInfo = default(SharpVk.Interop.Multivendor.DisplayEventInfo *);
         SharpVk.Interop.AllocationCallbacks *         marshalledAllocator        = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Fence marshalledFence = default(SharpVk.Interop.Fence);
         commandCache = extendedHandle.commandCache;
         marshalledDisplayEventInfo = (SharpVk.Interop.Multivendor.DisplayEventInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DisplayEventInfo>());
         displayEventInfo.MarshalTo(marshalledDisplayEventInfo);
         marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
         allocator.MarshalTo(marshalledAllocator);
         SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDeviceRegisterDisplayEventDelegate>("vkRegisterDisplayEventEXT", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledDisplayEventInfo, marshalledAllocator, &marshalledFence);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Fence(extendedHandle, marshalledFence);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 public static unsafe SharpVk.RenderPass CreateRenderPass2(this SharpVk.Device extendedHandle, SharpVk.Khronos.RenderPassCreateInfo2 createInfo, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.RenderPass result       = default(SharpVk.RenderPass);
         CommandCache       commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.RenderPassCreateInfo2 *marshalledCreateInfo = default(SharpVk.Interop.Khronos.RenderPassCreateInfo2 *);
         SharpVk.Interop.AllocationCallbacks *          marshalledAllocator  = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.RenderPass marshalledRenderPass = default(SharpVk.Interop.RenderPass);
         commandCache         = extendedHandle.commandCache;
         marshalledCreateInfo = (SharpVk.Interop.Khronos.RenderPassCreateInfo2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.RenderPassCreateInfo2>());
         createInfo.MarshalTo(marshalledCreateInfo);
         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.VkDeviceCreateRenderPass2Delegate commandDelegate = commandCache.Cache.vkCreateRenderPass2KHR;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledRenderPass);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.RenderPass(extendedHandle, marshalledRenderPass);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Instance handle to extend.
 /// </param>
 public static unsafe SharpVk.Multivendor.DebugUtilsMessenger CreateDebugUtilsMessenger(this SharpVk.Instance extendedHandle, SharpVk.Multivendor.DebugUtilsMessageSeverityFlags messageSeverity, SharpVk.Multivendor.DebugUtilsMessageTypeFlags messageType, SharpVk.Multivendor.DebugUtilsMessengerCallbackDelegate userCallback, SharpVk.Multivendor.DebugUtilsMessengerCreateFlags?flags = default(SharpVk.Multivendor.DebugUtilsMessengerCreateFlags?), IntPtr?userData = default(IntPtr?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Multivendor.DebugUtilsMessenger result = default(SharpVk.Multivendor.DebugUtilsMessenger);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *           marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Multivendor.DebugUtilsMessenger marshalledMessenger = default(SharpVk.Interop.Multivendor.DebugUtilsMessenger);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DebugUtilsMessengerCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Multivendor.DebugUtilsMessengerCreateFlags);
         }
         marshalledCreateInfo->MessageSeverity = messageSeverity;
         marshalledCreateInfo->MessageType     = messageType;
         marshalledCreateInfo->UserCallback    = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(userCallback);
         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.VkInstanceCreateDebugUtilsMessengerDelegate commandDelegate = commandCache.Cache.vkCreateDebugUtilsMessengerEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledMessenger);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Multivendor.DebugUtilsMessenger(extendedHandle, marshalledMessenger);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #6
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();
     }
 }
Пример #7
0
 /// <summary>
 ///
 /// </summary>
 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 *);
         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.DebugReportCallbackCreateInfoExt;
         marshalledCreateInfo->Next  = null;
         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.GetCommandDelegate <SharpVk.Interop.Multivendor.VkInstanceCreateDebugReportCallbackDelegate>("vkCreateDebugReportCallbackEXT", "instance");
         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();
     }
 }
Пример #8
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();
     }
 }
Пример #9
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();
     }
 }
Пример #10
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();
     }
 }
Пример #11
0
 /// <summary>
 ///
 /// </summary>
 internal unsafe void MarshalTo(SharpVk.Interop.AllocationCallbacks *pointer)
 {
     if (this.UserData != null)
     {
         pointer->UserData = this.UserData.Value.ToPointer();
     }
     else
     {
         pointer->UserData = default(void *);
     }
     pointer->Allocation         = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(this.Allocation);
     pointer->Reallocation       = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(this.Reallocation);
     pointer->Free               = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(this.Free);
     pointer->InternalAllocation = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(this.InternalAllocation);
     pointer->InternalFree       = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(this.InternalFree);
 }
 /// <summary>
 /// Create a display mode.
 /// </summary>
 /// <param name="extendedHandle">
 /// The PhysicalDevice handle to extend.
 /// </param>
 /// <param name="flags">
 /// Reserved for future use, and must be zero.
 /// </param>
 /// <param name="parameters">
 /// A DisplayModeParametersKHR structure describing the display
 /// parameters to use in creating the new mode. If the parameters are
 /// not compatible with the specified display, the implementation must
 /// return Result.ErrorINITIALIZATION_FAILED.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.DisplayMode CreateDisplayMode(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Khronos.Display display, SharpVk.Khronos.DisplayModeParameters parameters, SharpVk.Khronos.DisplayModeCreateFlags?flags = default(SharpVk.Khronos.DisplayModeCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.DisplayMode result = default(SharpVk.Khronos.DisplayMode);
         CommandCache commandCache          = default(CommandCache);
         SharpVk.Interop.Khronos.DisplayModeCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.DisplayModeCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.DisplayMode  marshalledMode      = default(SharpVk.Interop.Khronos.DisplayMode);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DisplayModeCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DisplayModeCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DisplayModeCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DisplayModeCreateFlags);
         }
         marshalledCreateInfo->Parameters = parameters;
         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.VkPhysicalDeviceCreateDisplayModeDelegate commandDelegate = commandCache.Cache.vkCreateDisplayModeKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, display?.handle ?? default(SharpVk.Interop.Khronos.Display), marshalledCreateInfo, marshalledAllocator, &marshalledMode);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.DisplayMode(extendedHandle, marshalledMode);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #13
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();
     }
 }
Пример #14
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();
     }
 }
Пример #15
0
 /// <summary>
 /// Free GPU memory.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Free(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         Interop.Commands.vkFreeMemory(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="compactedSize">
 /// </param>
 /// <param name="info">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.NVidia.AccelerationStructure CreateAccelerationStructure(this SharpVk.Device extendedHandle, ulong compactedSize, SharpVk.NVidia.AccelerationStructureInfo info, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.AccelerationStructure result = default(SharpVk.NVidia.AccelerationStructure);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *);
         void *vkAccelerationStructureCreateInfoNVNextPointer                         = default(void *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator             = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.AccelerationStructure marshalledAccelerationStructure = default(SharpVk.Interop.NVidia.AccelerationStructure);
         commandCache                        = extendedHandle.commandCache;
         marshalledCreateInfo                = (SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructureCreateInfo>());
         marshalledCreateInfo->SType         = StructureType.AccelerationStructureCreateInfo;
         marshalledCreateInfo->Next          = vkAccelerationStructureCreateInfoNVNextPointer;
         marshalledCreateInfo->CompactedSize = compactedSize;
         info.MarshalTo(&marshalledCreateInfo->Info);
         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.NVidia.VkDeviceCreateAccelerationStructureDelegate commandDelegate = commandCache.Cache.vkCreateAccelerationStructureNV;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledAccelerationStructure);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.AccelerationStructure(extendedHandle, marshalledAccelerationStructure);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #17
0
 /// <summary>
 /// Free GPU memory.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Free(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         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.VkDeviceMemoryFreeDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkDeviceMemoryFreeDelegate>("vkFreeMemory", "");
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #18
0
 /// <summary>
 /// Destroy a debug report callback object.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Destroy(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         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.VkDebugReportCallbackEXTDestroyDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Multivendor.VkDebugReportCallbackEXTDestroyDelegate>("vkDestroyDebugReportCallbackEXT", "instance");
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #19
0
 /// <summary>
 /// Destroy a fence object.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Destroy(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         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.VkFenceDestroyDelegate commandDelegate = commandCache.Cache.vkDestroyFence;
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #20
0
 /// <summary>
 /// Destroy a object table.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Destroy(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         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.NVidia.Experimental.VkIndirectCommandsLayoutNVXDestroyDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkIndirectCommandsLayoutNVXDestroyDelegate>("vkDestroyIndirectCommandsLayoutNVX", "device");
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #21
0
 /// <summary>
 /// Destroy a descriptor update template object.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Destroy(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         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.VkDescriptorUpdateTemplateKHRDestroyDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDescriptorUpdateTemplateKHRDestroyDelegate>("vkDestroyDescriptorUpdateTemplateKHR", "device");
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="pipelineCache">
 /// </param>
 /// <param name="createInfos">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.Pipeline[] CreateRayTracingPipelines(this SharpVk.Device extendedHandle, SharpVk.PipelineCache pipelineCache, ArrayProxy <SharpVk.NVidia.RayTracingPipelineCreateInfo>?createInfos, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Pipeline[] result       = default(SharpVk.Pipeline[]);
         CommandCache       commandCache = default(CommandCache);
         uint marshalledCreateInfoCount  = default(uint);
         SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Pipeline *           marshalledPipelines = default(SharpVk.Interop.Pipeline *);
         commandCache = extendedHandle.commandCache;
         marshalledCreateInfoCount = (uint)(Interop.HeapUtil.GetLength(createInfos));
         if (createInfos.IsNull())
         {
             marshalledCreateInfos = null;
         }
         else
         {
             if (createInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>());
                 createInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(marshalledCreateInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>(Interop.HeapUtil.GetLength(createInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(createInfos.Value)); index++)
                 {
                     createInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos = fieldPointer;
             }
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledPipelines = (SharpVk.Interop.Pipeline *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Pipeline>(marshalledCreateInfoCount));
         SharpVk.Interop.NVidia.VkDeviceCreateRayTracingPipelinesDelegate commandDelegate = commandCache.Cache.vkCreateRayTracingPipelinesNV;
         Result methodResult = commandDelegate(extendedHandle.handle, pipelineCache?.handle ?? default(SharpVk.Interop.PipelineCache), marshalledCreateInfoCount, marshalledCreateInfos, marshalledAllocator, marshalledPipelines);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         if (marshalledPipelines != null)
         {
             var fieldPointer = new SharpVk.Pipeline[(uint)(marshalledCreateInfoCount)];
             for (int index = 0; index < (uint)(marshalledCreateInfoCount); index++)
             {
                 fieldPointer[index] = new SharpVk.Pipeline(extendedHandle, marshalledPipelines[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #23
0
 /// <summary>
 /// Create a new device instance.
 /// </summary>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="enabledLayerNames">
 /// ppEnabledLayerNames is deprecated and ignored. See Device Layer
 /// Deprecation.
 /// </param>
 /// <param name="enabledExtensionNames">
 /// An array of enabledExtensionCount strings containing the names of
 /// extensions to enable for the created device. See the Extensions
 /// section for further details.
 /// </param>
 /// <param name="enabledFeatures">
 /// Null or a PhysicalDeviceFeatures structure that contains boolean
 /// indicators of all the features to be enabled. Refer to the Features
 /// section for further details.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe SharpVk.Device CreateDevice(ArrayProxy <SharpVk.DeviceQueueCreateInfo>?queueCreateInfos, ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.DeviceCreateFlags?flags = default(SharpVk.DeviceCreateFlags?), SharpVk.PhysicalDeviceFeatures?enabledFeatures = default(SharpVk.PhysicalDeviceFeatures?), SharpVk.Khronos.PhysicalDeviceFeatures2?physicalDeviceFeatures2Khr = null, SharpVk.Khronos.Experimental.DeviceGroupDeviceCreateInfo?deviceGroupDeviceCreateInfoKhx = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Device result = default(SharpVk.Device);
         SharpVk.Interop.DeviceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.DeviceCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Device marshalledDevice = default(SharpVk.Interop.Device);
         if (physicalDeviceFeatures2Khr != null)
         {
             SharpVk.Interop.Khronos.PhysicalDeviceFeatures2 *extensionPointer = default(SharpVk.Interop.Khronos.PhysicalDeviceFeatures2 *);
             extensionPointer = (SharpVk.Interop.Khronos.PhysicalDeviceFeatures2 *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.PhysicalDeviceFeatures2>());
             physicalDeviceFeatures2Khr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (deviceGroupDeviceCreateInfoKhx != null)
         {
             SharpVk.Interop.Khronos.Experimental.DeviceGroupDeviceCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.Experimental.DeviceGroupDeviceCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.Experimental.DeviceGroupDeviceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Experimental.DeviceGroupDeviceCreateInfo>());
             deviceGroupDeviceCreateInfoKhx.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         marshalledCreateInfo        = (SharpVk.Interop.DeviceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.DeviceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DeviceCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.DeviceCreateFlags);
         }
         marshalledCreateInfo->QueueCreateInfoCount = (uint)(Interop.HeapUtil.GetLength(queueCreateInfos));
         if (queueCreateInfos.IsNull())
         {
             marshalledCreateInfo->QueueCreateInfos = null;
         }
         else
         {
             if (queueCreateInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->QueueCreateInfos = (SharpVk.Interop.DeviceQueueCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.DeviceQueueCreateInfo>());
                 queueCreateInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.DeviceQueueCreateInfo *)(marshalledCreateInfo->QueueCreateInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.DeviceQueueCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.DeviceQueueCreateInfo>(Interop.HeapUtil.GetLength(queueCreateInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(queueCreateInfos.Value)); index++)
                 {
                     queueCreateInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfo->QueueCreateInfos = fieldPointer;
             }
         }
         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 (enabledFeatures != null)
         {
             marshalledCreateInfo->EnabledFeatures = (SharpVk.Interop.PhysicalDeviceFeatures *)(Interop.HeapUtil.Allocate <SharpVk.Interop.PhysicalDeviceFeatures>());
             enabledFeatures.Value.MarshalTo(marshalledCreateInfo->EnabledFeatures);
         }
         else
         {
             marshalledCreateInfo->EnabledFeatures = default(SharpVk.Interop.PhysicalDeviceFeatures *);
         }
         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.VkPhysicalDeviceCreateDeviceDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkPhysicalDeviceCreateDeviceDelegate>("vkCreateDevice", "");
         Result methodResult = commandDelegate(this.handle, marshalledCreateInfo, marshalledAllocator, &marshalledDevice);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Device(this, marshalledDevice);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// </param>
 /// <param name="initialData">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.Multivendor.ValidationCache CreateValidationCache(this SharpVk.Device extendedHandle, ArrayProxy <byte>?initialData, SharpVk.Multivendor.ValidationCacheCreateFlags?flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Multivendor.ValidationCache result = default(SharpVk.Multivendor.ValidationCache);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *);
         void *vkValidationCacheCreateInfoEXTNextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *       marshalledAllocator       = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Multivendor.ValidationCache marshalledValidationCache = default(SharpVk.Interop.Multivendor.ValidationCache);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationCacheCreateInfo>());
         marshalledCreateInfo->SType = StructureType.ValidationCacheCreateInfo;
         marshalledCreateInfo->Next  = vkValidationCacheCreateInfoEXTNextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags);
         }
         marshalledCreateInfo->InitialDataSize = (HostSize)(Interop.HeapUtil.GetLength(initialData));
         if (initialData.IsNull())
         {
             marshalledCreateInfo->InitialData = null;
         }
         else
         {
             if (initialData.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->InitialData            = (byte *)(Interop.HeapUtil.Allocate <byte>());
                 *(byte *)(marshalledCreateInfo->InitialData) = initialData.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(initialData.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(initialData.Value)); index++)
                 {
                     fieldPointer[index] = initialData.Value[index];
                 }
                 marshalledCreateInfo->InitialData = fieldPointer;
             }
         }
         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.VkDeviceCreateValidationCacheDelegate commandDelegate = commandCache.Cache.vkCreateValidationCacheEXT;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledValidationCache);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Multivendor.ValidationCache(extendedHandle, marshalledValidationCache);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #25
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();
     }
 }
Пример #26
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();
     }
 }
Пример #27
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.Swapchain[] CreateSharedSwapchains(this SharpVk.Device extendedHandle, SharpVk.Khronos.SwapchainCreateInfo[] createInfos, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain[] result = default(SharpVk.Khronos.Swapchain[]);
         CommandCache commandCache          = default(CommandCache);
         uint         swapchainCount        = default(uint);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator   = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain *          marshalledSwapchains  = default(SharpVk.Interop.Khronos.Swapchain *);
         commandCache   = extendedHandle.commandCache;
         swapchainCount = (uint)(createInfos?.Length ?? 0);
         if (createInfos != null)
         {
             var fieldPointer = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.Khronos.SwapchainCreateInfo>(createInfos.Length).ToPointer());
             for (int index = 0; index < (uint)(createInfos.Length); index++)
             {
                 createInfos[index].MarshalTo(&fieldPointer[index]);
             }
             marshalledCreateInfos = fieldPointer;
         }
         else
         {
             marshalledCreateInfos = null;
         }
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledSwapchains = (SharpVk.Interop.Khronos.Swapchain *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.Swapchain>(swapchainCount));
         SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateSharedSwapchainsDelegate>("vkCreateSharedSwapchainsKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, swapchainCount, marshalledCreateInfos, marshalledAllocator, marshalledSwapchains);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         if (marshalledSwapchains != null)
         {
             var fieldPointer = new SharpVk.Khronos.Swapchain[(uint)(swapchainCount)];
             for (int index = 0; index < (uint)(swapchainCount); index++)
             {
                 fieldPointer[index] = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchains[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="maxUniformBuffersPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER or
 /// VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxStorageBuffersPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or
 /// VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxStorageImagesPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE or
 /// VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxSampledImagesPerDescriptor">
 /// The maximum number of VK_DESCRIPTOR_TYPE_SAMPLER,
 /// VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
 /// or VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT used by any single
 /// registered DescriptorSet in this table.
 /// </param>
 /// <param name="maxPipelineLayouts">
 /// The maximum number of unique PipelineLayout used by any registered
 /// DescriptorSet or Pipeline in this table.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.NVidia.Experimental.ObjectTable CreateObjectTable(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.NVidia.Experimental.ObjectEntryType>?objectEntryTypes, ArrayProxy <uint>?objectEntryCounts, ArrayProxy <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>?objectEntryUsageFlags, uint maxUniformBuffersPerDescriptor, uint maxStorageBuffersPerDescriptor, uint maxStorageImagesPerDescriptor, uint maxSampledImagesPerDescriptor, uint maxPipelineLayouts, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.Experimental.ObjectTable result = default(SharpVk.NVidia.Experimental.ObjectTable);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *           marshalledAllocator             = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.Experimental.ObjectTable marshalledObjectTable           = default(SharpVk.Interop.NVidia.Experimental.ObjectTable);
         commandCache                      = extendedHandle.commandCache;
         marshalledCreateInfo              = (SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.Experimental.ObjectTableCreateInfo>());
         marshalledCreateInfo->SType       = StructureType.ObjectTableCreateInfoNvx;
         marshalledCreateInfo->Next        = null;
         marshalledCreateInfo->ObjectCount = (uint)(Interop.HeapUtil.GetLength(objectEntryTypes));
         if (objectEntryTypes.IsNull())
         {
             marshalledCreateInfo->ObjectEntryTypes = null;
         }
         else
         {
             if (objectEntryTypes.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryTypes = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectEntryType>());
                 *(SharpVk.NVidia.Experimental.ObjectEntryType *)(marshalledCreateInfo->ObjectEntryTypes) = objectEntryTypes.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.ObjectEntryType *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectEntryType>(Interop.HeapUtil.GetLength(objectEntryTypes.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryTypes.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryTypes.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryTypes = fieldPointer;
             }
         }
         if (objectEntryCounts.IsNull())
         {
             marshalledCreateInfo->ObjectEntryCounts = null;
         }
         else
         {
             if (objectEntryCounts.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryCounts            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfo->ObjectEntryCounts) = objectEntryCounts.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(objectEntryCounts.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryCounts.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryCounts.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryCounts = fieldPointer;
             }
         }
         if (objectEntryUsageFlags.IsNull())
         {
             marshalledCreateInfo->ObjectEntryUsageFlags = null;
         }
         else
         {
             if (objectEntryUsageFlags.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->ObjectEntryUsageFlags = (SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(Interop.HeapUtil.Allocate <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>());
                 *(SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(marshalledCreateInfo->ObjectEntryUsageFlags) = objectEntryUsageFlags.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (SharpVk.NVidia.Experimental.ObjectEntryUsageFlags *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.Experimental.ObjectEntryUsageFlags>(Interop.HeapUtil.GetLength(objectEntryUsageFlags.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(objectEntryUsageFlags.Value)); index++)
                 {
                     fieldPointer[index] = objectEntryUsageFlags.Value[index];
                 }
                 marshalledCreateInfo->ObjectEntryUsageFlags = fieldPointer;
             }
         }
         marshalledCreateInfo->MaxUniformBuffersPerDescriptor = maxUniformBuffersPerDescriptor;
         marshalledCreateInfo->MaxStorageBuffersPerDescriptor = maxStorageBuffersPerDescriptor;
         marshalledCreateInfo->MaxStorageImagesPerDescriptor  = maxStorageImagesPerDescriptor;
         marshalledCreateInfo->MaxSampledImagesPerDescriptor  = maxSampledImagesPerDescriptor;
         marshalledCreateInfo->MaxPipelineLayouts             = maxPipelineLayouts;
         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.NVidia.Experimental.VkDeviceCreateObjectTableDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.Experimental.VkDeviceCreateObjectTableDelegate>("vkCreateObjectTableNVX", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledObjectTable);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.Experimental.ObjectTable(extendedHandle, marshalledObjectTable);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #29
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.DescriptorUpdateTemplate CreateDescriptorUpdateTemplate(this SharpVk.Device extendedHandle, SharpVk.Khronos.DescriptorUpdateTemplateEntry[] descriptorUpdateEntries, SharpVk.Khronos.DescriptorUpdateTemplateType templateType, SharpVk.DescriptorSetLayout descriptorSetLayout, SharpVk.PipelineLayout pipelineLayout, SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?), SharpVk.PipelineBindPoint?pipelineBindPoint = default(SharpVk.PipelineBindPoint?), uint?set = default(uint?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.DescriptorUpdateTemplate result = default(SharpVk.Khronos.DescriptorUpdateTemplate);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *marshalledCreateInfo    = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *            marshalledAllocator                = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplate marshalledDescriptorUpdateTemplate = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplate);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DescriptorUpdateTemplateCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags);
         }
         marshalledCreateInfo->DescriptorUpdateEntryCount = (uint)(descriptorUpdateEntries?.Length ?? 0);
         if (descriptorUpdateEntries != null)
         {
             var fieldPointer = (SharpVk.Khronos.DescriptorUpdateTemplateEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Khronos.DescriptorUpdateTemplateEntry>(descriptorUpdateEntries.Length).ToPointer());
             for (int index = 0; index < (uint)(descriptorUpdateEntries.Length); index++)
             {
                 fieldPointer[index] = descriptorUpdateEntries[index];
             }
             marshalledCreateInfo->DescriptorUpdateEntries = fieldPointer;
         }
         else
         {
             marshalledCreateInfo->DescriptorUpdateEntries = null;
         }
         marshalledCreateInfo->TemplateType        = templateType;
         marshalledCreateInfo->DescriptorSetLayout = descriptorSetLayout?.handle ?? default(SharpVk.Interop.DescriptorSetLayout);
         if (pipelineBindPoint != null)
         {
             marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint.Value;
         }
         else
         {
             marshalledCreateInfo->PipelineBindPoint = default(SharpVk.PipelineBindPoint);
         }
         marshalledCreateInfo->PipelineLayout = pipelineLayout?.handle ?? default(SharpVk.Interop.PipelineLayout);
         if (set != null)
         {
             marshalledCreateInfo->Set = set.Value;
         }
         else
         {
             marshalledCreateInfo->Set = default(uint);
         }
         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.VkDeviceCreateDescriptorUpdateTemplateDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateDescriptorUpdateTemplateDelegate>("vkCreateDescriptorUpdateTemplateKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledDescriptorUpdateTemplate);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.DescriptorUpdateTemplate(extendedHandle, marshalledDescriptorUpdateTemplate);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Пример #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="pipelineCache">
 /// </param>
 /// <param name="flags">
 /// </param>
 /// <param name="stages">
 /// </param>
 /// <param name="groups">
 /// </param>
 /// <param name="maxRecursionDepth">
 /// </param>
 /// <param name="layout">
 /// </param>
 /// <param name="basePipelineHandle">
 /// </param>
 /// <param name="basePipelineIndex">
 /// </param>
 /// <param name="pipelineCreationFeedbackCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.Pipeline CreateRayTracingPipeline(this SharpVk.Device extendedHandle, SharpVk.PipelineCache pipelineCache, ArrayProxy <SharpVk.PipelineShaderStageCreateInfo>?stages, ArrayProxy <SharpVk.NVidia.RayTracingShaderGroupCreateInfo>?groups, uint maxRecursionDepth, SharpVk.PipelineLayout layout, SharpVk.Pipeline basePipelineHandle, int basePipelineIndex, SharpVk.PipelineCreateFlags?flags = default(SharpVk.PipelineCreateFlags?), SharpVk.Multivendor.PipelineCreationFeedbackCreateInfo?pipelineCreationFeedbackCreateInfoExt = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Pipeline result       = default(SharpVk.Pipeline);
         CommandCache     commandCache = default(CommandCache);
         uint             marshalledCreateInfoCount = default(uint);
         SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *marshalledCreateInfos = default(SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *);
         void *vkRayTracingPipelineCreateInfoNVNextPointer        = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Pipeline *           marshalledPipelines = default(SharpVk.Interop.Pipeline *);
         if (pipelineCreationFeedbackCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.PipelineCreationFeedbackCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.PipelineCreationFeedbackCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.PipelineCreationFeedbackCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.PipelineCreationFeedbackCreateInfo>());
             pipelineCreationFeedbackCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = vkRayTracingPipelineCreateInfoNVNextPointer;
             vkRayTracingPipelineCreateInfoNVNextPointer = extensionPointer;
         }
         commandCache = extendedHandle.commandCache;
         marshalledCreateInfoCount    = 1;
         marshalledCreateInfos        = (SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingPipelineCreateInfo>());
         marshalledCreateInfos->SType = StructureType.RayTracingPipelineCreateInfo;
         marshalledCreateInfos->Next  = vkRayTracingPipelineCreateInfoNVNextPointer;
         if (flags != null)
         {
             marshalledCreateInfos->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfos->Flags = default(SharpVk.PipelineCreateFlags);
         }
         marshalledCreateInfos->StageCount = (uint)(Interop.HeapUtil.GetLength(stages));
         if (stages.IsNull())
         {
             marshalledCreateInfos->Stages = null;
         }
         else
         {
             if (stages.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos->Stages = (SharpVk.Interop.PipelineShaderStageCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.PipelineShaderStageCreateInfo>());
                 stages.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.PipelineShaderStageCreateInfo *)(marshalledCreateInfos->Stages));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.PipelineShaderStageCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.PipelineShaderStageCreateInfo>(Interop.HeapUtil.GetLength(stages.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(stages.Value)); index++)
                 {
                     stages.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos->Stages = fieldPointer;
             }
         }
         marshalledCreateInfos->GroupCount = (uint)(Interop.HeapUtil.GetLength(groups));
         if (groups.IsNull())
         {
             marshalledCreateInfos->Groups = null;
         }
         else
         {
             if (groups.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfos->Groups = (SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo>());
                 groups.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(marshalledCreateInfos->Groups));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.RayTracingShaderGroupCreateInfo>(Interop.HeapUtil.GetLength(groups.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(groups.Value)); index++)
                 {
                     groups.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledCreateInfos->Groups = fieldPointer;
             }
         }
         marshalledCreateInfos->MaxRecursionDepth  = maxRecursionDepth;
         marshalledCreateInfos->Layout             = layout?.handle ?? default(SharpVk.Interop.PipelineLayout);
         marshalledCreateInfos->BasePipelineHandle = basePipelineHandle?.handle ?? default(SharpVk.Interop.Pipeline);
         marshalledCreateInfos->BasePipelineIndex  = basePipelineIndex;
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         marshalledPipelines = (SharpVk.Interop.Pipeline *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Pipeline>(1));
         SharpVk.Interop.NVidia.VkDeviceCreateRayTracingPipelinesDelegate commandDelegate = commandCache.Cache.vkCreateRayTracingPipelinesNV;
         Result methodResult = commandDelegate(extendedHandle.handle, pipelineCache?.handle ?? default(SharpVk.Interop.PipelineCache), marshalledCreateInfoCount, marshalledCreateInfos, marshalledAllocator, marshalledPipelines);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Pipeline(extendedHandle, *marshalledPipelines);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }