예제 #1
0
 /// <summary>
 /// Lists physical device's image format capabilities.
 /// </summary>
 public unsafe SharpVk.ImageFormatProperties GetImageFormatProperties(SharpVk.Format format, SharpVk.ImageType type, SharpVk.ImageTiling tiling, SharpVk.ImageUsageFlags usage, SharpVk.ImageCreateFlags?flags = default(SharpVk.ImageCreateFlags?))
 {
     try
     {
         SharpVk.ImageFormatProperties result          = default(SharpVk.ImageFormatProperties);
         SharpVk.ImageCreateFlags      marshalledFlags = default(SharpVk.ImageCreateFlags);
         SharpVk.ImageFormatProperties marshalledImageFormatProperties = default(SharpVk.ImageFormatProperties);
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.ImageCreateFlags);
         }
         SharpVk.Interop.VkPhysicalDeviceGetImageFormatPropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkPhysicalDeviceGetImageFormatPropertiesDelegate>("vkGetPhysicalDeviceImageFormatProperties", "");
         Result methodResult = commandDelegate(this.handle, format, type, tiling, usage, marshalledFlags, &marshalledImageFormatProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledImageFormatProperties;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 /// <summary>
 ///
 /// </summary>
 public VertexInputAttributeDescription(uint location, uint binding, SharpVk.Format format, uint offset)
 {
     this.Location = location;
     this.Binding  = binding;
     this.Format   = format;
     this.Offset   = offset;
 }
 /// <summary>
 ///
 /// </summary>
 public AttachmentDescription(SharpVk.AttachmentDescriptionFlags flags, SharpVk.Format format, SharpVk.SampleCountFlags samples, SharpVk.AttachmentLoadOp loadOp, SharpVk.AttachmentStoreOp storeOp, SharpVk.AttachmentLoadOp stencilLoadOp, SharpVk.AttachmentStoreOp stencilStoreOp, SharpVk.ImageLayout initialLayout, SharpVk.ImageLayout finalLayout)
 {
     this.Flags          = flags;
     this.Format         = format;
     this.Samples        = samples;
     this.LoadOp         = loadOp;
     this.StoreOp        = storeOp;
     this.StencilLoadOp  = stencilLoadOp;
     this.StencilStoreOp = stencilStoreOp;
     this.InitialLayout  = initialLayout;
     this.FinalLayout    = finalLayout;
 }
예제 #4
0
 /// <summary>
 /// Lists physical device's format capabilities.
 /// </summary>
 public unsafe SharpVk.FormatProperties GetFormatProperties(SharpVk.Format format)
 {
     try
     {
         SharpVk.FormatProperties result = default(SharpVk.FormatProperties);
         SharpVk.FormatProperties marshalledFormatProperties = default(SharpVk.FormatProperties);
         Interop.Commands.vkGetPhysicalDeviceFormatProperties(this.handle, format, &marshalledFormatProperties);
         result = marshalledFormatProperties;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #5
0
 /// <summary>
 /// Lists physical device's format capabilities.
 /// </summary>
 public unsafe SharpVk.FormatProperties GetFormatProperties(SharpVk.Format format)
 {
     try
     {
         SharpVk.FormatProperties result = default(SharpVk.FormatProperties);
         SharpVk.FormatProperties marshalledFormatProperties = default(SharpVk.FormatProperties);
         SharpVk.Interop.VkPhysicalDeviceGetFormatPropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkPhysicalDeviceGetFormatPropertiesDelegate>("vkGetPhysicalDeviceFormatProperties", "");
         commandDelegate(this.handle, format, &marshalledFormatProperties);
         result = marshalledFormatProperties;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #6
0
 /// <summary>
 /// Retrieve properties of an image format applied to sparse images.
 /// </summary>
 public unsafe SharpVk.SparseImageFormatProperties[] GetSparseImageFormatProperties(SharpVk.Format format, SharpVk.ImageType type, SharpVk.SampleCountFlags samples, SharpVk.ImageUsageFlags usage, SharpVk.ImageTiling tiling)
 {
     try
     {
         SharpVk.SparseImageFormatProperties[] result = default(SharpVk.SparseImageFormatProperties[]);
         uint propertyCount = default(uint);
         SharpVk.SparseImageFormatProperties *marshalledProperties = default(SharpVk.SparseImageFormatProperties *);
         SharpVk.Interop.VkPhysicalDeviceGetSparseImageFormatPropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkPhysicalDeviceGetSparseImageFormatPropertiesDelegate>("vkGetPhysicalDeviceSparseImageFormatProperties", "");
         commandDelegate(this.handle, format, type, samples, usage, tiling, &propertyCount, marshalledProperties);
         marshalledProperties = (SharpVk.SparseImageFormatProperties *)(Interop.HeapUtil.Allocate <SharpVk.SparseImageFormatProperties>((uint)(propertyCount)));
         commandDelegate(this.handle, format, type, samples, usage, tiling, &propertyCount, marshalledProperties);
         if (marshalledProperties != null)
         {
             var fieldPointer = new SharpVk.SparseImageFormatProperties[(uint)(propertyCount)];
             for (int index = 0; index < (uint)(propertyCount); index++)
             {
                 fieldPointer[index] = marshalledProperties[index];
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.NVidia.ExternalImageFormatProperties GetExternalImageFormatProperties(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Format format, SharpVk.ImageType type, SharpVk.ImageTiling tiling, SharpVk.ImageUsageFlags usage, SharpVk.ImageCreateFlags?flags = default(SharpVk.ImageCreateFlags?), SharpVk.NVidia.ExternalMemoryHandleTypeFlags?externalHandleType = default(SharpVk.NVidia.ExternalMemoryHandleTypeFlags?))
 {
     try
     {
         SharpVk.NVidia.ExternalImageFormatProperties result = default(SharpVk.NVidia.ExternalImageFormatProperties);
         CommandCache             commandCache    = default(CommandCache);
         SharpVk.ImageCreateFlags marshalledFlags = default(SharpVk.ImageCreateFlags);
         SharpVk.NVidia.ExternalMemoryHandleTypeFlags marshalledExternalHandleType            = default(SharpVk.NVidia.ExternalMemoryHandleTypeFlags);
         SharpVk.NVidia.ExternalImageFormatProperties marshalledExternalImageFormatProperties = default(SharpVk.NVidia.ExternalImageFormatProperties);
         commandCache = extendedHandle.commandCache;
         if (flags != null)
         {
             marshalledFlags = flags.Value;
         }
         else
         {
             marshalledFlags = default(SharpVk.ImageCreateFlags);
         }
         if (externalHandleType != null)
         {
             marshalledExternalHandleType = externalHandleType.Value;
         }
         else
         {
             marshalledExternalHandleType = default(SharpVk.NVidia.ExternalMemoryHandleTypeFlags);
         }
         SharpVk.Interop.NVidia.VkPhysicalDeviceGetExternalImageFormatPropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.NVidia.VkPhysicalDeviceGetExternalImageFormatPropertiesDelegate>("vkGetPhysicalDeviceExternalImageFormatPropertiesNV", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, format, type, tiling, usage, marshalledFlags, marshalledExternalHandleType, &marshalledExternalImageFormatProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = marshalledExternalImageFormatProperties;
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #8
0
 /// <summary>
 ///
 /// </summary>
 public SurfaceFormat(SharpVk.Format format, SharpVk.Khronos.ColorSpace colorSpace)
 {
     this.Format     = format;
     this.ColorSpace = colorSpace;
 }
예제 #9
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();
     }
 }
예제 #10
0
 public static extern void vkGetPhysicalDeviceFormatProperties(SharpVk.Interop.PhysicalDevice physicalDevice, SharpVk.Format format, SharpVk.FormatProperties *formatProperties);
예제 #11
0
 public static extern void vkGetPhysicalDeviceSparseImageFormatProperties(SharpVk.Interop.PhysicalDevice physicalDevice, SharpVk.Format format, SharpVk.ImageType type, SharpVk.SampleCountFlags samples, SharpVk.ImageUsageFlags usage, SharpVk.ImageTiling tiling, uint *propertyCount, SharpVk.SparseImageFormatProperties *properties);
예제 #12
0
 public static extern SharpVk.Result vkGetPhysicalDeviceImageFormatProperties(SharpVk.Interop.PhysicalDevice physicalDevice, SharpVk.Format format, SharpVk.ImageType type, SharpVk.ImageTiling tiling, SharpVk.ImageUsageFlags usage, SharpVk.ImageCreateFlags flags, SharpVk.ImageFormatProperties *imageFormatProperties);
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.FormatProperties2 GetFormatProperties2(this SharpVk.PhysicalDevice extendedHandle, SharpVk.Format format)
 {
     try
     {
         SharpVk.Khronos.FormatProperties2 result = default(SharpVk.Khronos.FormatProperties2);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.FormatProperties2 marshalledFormatProperties = default(SharpVk.Interop.Khronos.FormatProperties2);
         commandCache = extendedHandle.commandCache;
         SharpVk.Interop.Khronos.VkPhysicalDeviceGetFormatProperties2Delegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkPhysicalDeviceGetFormatProperties2Delegate>("vkGetPhysicalDeviceFormatProperties2KHR", "instance");
         commandDelegate(extendedHandle.handle, format, &marshalledFormatProperties);
         result = SharpVk.Khronos.FormatProperties2.MarshalFrom(&marshalledFormatProperties);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
예제 #14
0
 /// <summary>
 /// Create a swapchain.
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="flags">
 /// A bitmask indicating parameters of swapchain creation. Bits which
 /// can be set include: + --
 /// </param>
 /// <param name="queueFamilyIndices">
 /// </param>
 /// <param name="swapchainCounterCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="deviceGroupSwapchainCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="imageFormatListCreateInfoKhr">
 /// Extension struct
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Khronos.Swapchain CreateSwapchain(this SharpVk.Device extendedHandle, SharpVk.Khronos.Surface surface, uint minImageCount, SharpVk.Format imageFormat, SharpVk.Khronos.ColorSpace imageColorSpace, SharpVk.Extent2D imageExtent, uint imageArrayLayers, SharpVk.ImageUsageFlags imageUsage, SharpVk.SharingMode imageSharingMode, ArrayProxy <uint>?queueFamilyIndices, SharpVk.Khronos.SurfaceTransformFlags preTransform, SharpVk.Khronos.CompositeAlphaFlags compositeAlpha, SharpVk.Khronos.PresentMode presentMode, bool clipped, SharpVk.Khronos.Swapchain oldSwapchain, SharpVk.Khronos.SwapchainCreateFlags?flags = default(SharpVk.Khronos.SwapchainCreateFlags?), SharpVk.Multivendor.SwapchainCounterCreateInfo?swapchainCounterCreateInfoExt = null, SharpVk.Khronos.DeviceGroupSwapchainCreateInfo?deviceGroupSwapchainCreateInfoKhr = null, SharpVk.Khronos.ImageFormatListCreateInfo?imageFormatListCreateInfoKhr = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.Swapchain result = default(SharpVk.Khronos.Swapchain);
         CommandCache commandCache        = default(CommandCache);
         SharpVk.Interop.Khronos.SwapchainCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Khronos.SwapchainCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.Swapchain    marshalledSwapchain = default(SharpVk.Interop.Khronos.Swapchain);
         if (swapchainCounterCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.SwapchainCounterCreateInfo>());
             swapchainCounterCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (deviceGroupSwapchainCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DeviceGroupSwapchainCreateInfo>());
             deviceGroupSwapchainCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (imageFormatListCreateInfoKhr != null)
         {
             SharpVk.Interop.Khronos.ImageFormatListCreateInfo *extensionPointer = default(SharpVk.Interop.Khronos.ImageFormatListCreateInfo *);
             extensionPointer = (SharpVk.Interop.Khronos.ImageFormatListCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.ImageFormatListCreateInfo>());
             imageFormatListCreateInfoKhr.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.SwapchainCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.SwapchainCreateInfo>());
         marshalledCreateInfo->SType = StructureType.SwapchainCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.SwapchainCreateFlags);
         }
         marshalledCreateInfo->Surface               = surface?.handle ?? default(SharpVk.Interop.Khronos.Surface);
         marshalledCreateInfo->MinImageCount         = minImageCount;
         marshalledCreateInfo->ImageFormat           = imageFormat;
         marshalledCreateInfo->ImageColorSpace       = imageColorSpace;
         marshalledCreateInfo->ImageExtent           = imageExtent;
         marshalledCreateInfo->ImageArrayLayers      = imageArrayLayers;
         marshalledCreateInfo->ImageUsage            = imageUsage;
         marshalledCreateInfo->ImageSharingMode      = imageSharingMode;
         marshalledCreateInfo->QueueFamilyIndexCount = (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices));
         if (queueFamilyIndices.IsNull())
         {
             marshalledCreateInfo->QueueFamilyIndices = null;
         }
         else
         {
             if (queueFamilyIndices.Value.Contents == ProxyContents.Single)
             {
                 marshalledCreateInfo->QueueFamilyIndices            = (uint *)(Interop.HeapUtil.Allocate <uint>());
                 *(uint *)(marshalledCreateInfo->QueueFamilyIndices) = queueFamilyIndices.Value.GetSingleValue();
             }
             else
             {
                 var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(queueFamilyIndices.Value)); index++)
                 {
                     fieldPointer[index] = queueFamilyIndices.Value[index];
                 }
                 marshalledCreateInfo->QueueFamilyIndices = fieldPointer;
             }
         }
         marshalledCreateInfo->PreTransform   = preTransform;
         marshalledCreateInfo->CompositeAlpha = compositeAlpha;
         marshalledCreateInfo->PresentMode    = presentMode;
         marshalledCreateInfo->Clipped        = clipped;
         marshalledCreateInfo->OldSwapchain   = oldSwapchain?.handle ?? default(SharpVk.Interop.Khronos.Swapchain);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.Khronos.VkDeviceCreateSwapchainDelegate commandDelegate = commandCache.Cache.vkCreateSwapchainKHR;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledSwapchain);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.Swapchain(extendedHandle, marshalledSwapchain);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }