/// <summary> /// Initializes a new instance of the <see cref="SwapchainCreateInfoKhr"/> structure. /// </summary> /// <param name="surface"> /// The <see cref="SurfaceKhr"/> that the swapchain will present images to. /// </param> /// <param name="imageExtent"> /// The size (in pixels) of the swapchain. Behavior is platform-dependent when the image /// extent does not match the surface's <see cref="SurfaceCapabilitiesKhr.CurrentExtent"/> as /// returned by <see cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>. /// </param> /// <param name="preTransform"> /// A bitmask describing the transform, relative to the presentation engine’s natural /// orientation, applied to the image content prior to presentation. If it does not match the /// <see cref="SurfaceCapabilitiesKhr.CurrentTransform"/> value returned by <see /// cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>, the presentation engine will /// transform the image content as part of the presentation operation. /// </param> /// <param name="imageUsage"> /// A bitmask indicating how the application will use the swapchain’s presentable images. /// </param> /// <param name="flags">A bitmask indicating parameters of swapchain creation.</param> /// <param name="minImageCount"> /// The minimum number of presentable images that the application needs. The platform will /// either create the swapchain with at least that many images, or will fail to create the swapchain. /// </param> /// <param name="imageFormat">A format that is valid for swapchains on the specified surface.</param> /// <param name="compositeAlpha"> /// A bitmask indicating the alpha compositing mode to use when this surface is composited /// together with other surfaces on certain window systems. /// </param> /// <param name="imageArrayLayers"> /// The number of views in a multiview/stereo surface. For non-stereoscopic-3D applications, /// this value is 1. /// </param> /// <param name="presentMode"> /// The presentation mode the swapchain will use. A swapchain’s present mode determines how /// incoming present requests will be processed and queued internally. /// </param> /// <param name="clipped"> /// Indicates whether the Vulkan implementation is allowed to discard rendering operations /// that affect regions of the surface which are not visible. /// </param> /// <param name="oldSwapchain">Existing swapchain to replace, if any.</param> public SwapchainCreateInfoKhr( SurfaceKhr surface, Format imageFormat, Extent2D imageExtent, SurfaceTransformsKhr preTransform, PresentModeKhr presentMode, SwapchainCreateFlagsKhr flags = 0, int minImageCount = 2, ImageUsages imageUsage = ImageUsages.ColorAttachment | ImageUsages.TransferDst, CompositeAlphasKhr compositeAlpha = CompositeAlphasKhr.Opaque, int imageArrayLayers = 1, bool clipped = true, SwapchainKhr oldSwapchain = null) { Flags = flags; Surface = surface; ImageUsage = imageUsage; MinImageCount = minImageCount; ImageFormat = imageFormat; ImageColorSpace = 0; ImageExtent = imageExtent; ImageArrayLayers = imageArrayLayers; ImageSharingMode = 0; QueueFamilyIndices = null; PreTransform = preTransform; CompositeAlpha = compositeAlpha; PresentMode = presentMode; Clipped = clipped; OldSwapchain = oldSwapchain; }
private static Image CreateImage( Device logicalDevice, Format format, Int2 size, int mipLevels, ImageUsages usage, bool cubeMap) => logicalDevice.CreateImage(new ImageCreateInfo { Flags = cubeMap ? ImageCreateFlags.CubeCompatible : ImageCreateFlags.None, ImageType = ImageType.Image2D, Format = format, Extent = new Extent3D(size.X, size.Y, 1), MipLevels = mipLevels, ArrayLayers = cubeMap ? 6 : 1, Samples = SampleCounts.Count1, Tiling = ImageTiling.Optimal, Usage = usage, SharingMode = SharingMode.Exclusive, InitialLayout = ImageLayout.Undefined });
/// <summary> /// Determine image capabilities compatible with external memory handle types. /// </summary> /// <param name="physicalDevice">The physical device from which to query the image capabilities.</param> /// <param name="format">The image format, corresponding to <see cref="ImageCreateInfo.Format"/>.</param> /// <param name="type">The image type, corresponding to <see cref="ImageCreateInfo.ImageType"/>.</param> /// <param name="tiling">The image tiling, corresponding to <see cref="ImageCreateInfo.Tiling"/>.</param> /// <param name="usage">The intended usage of the image, corresponding to <see cref="ImageCreateInfo.Usage"/>.</param> /// <param name="flags"> /// A bitmask describing additional parameters of the image, corresponding to <see cref="ImageCreateInfo.Flags"/>. /// </param> /// <param name="externalHandleType"> /// Either one of the bits from <see cref="ExternalMemoryHandleTypesNV"/>, or 0. /// </param> /// <returns>The structure in which capabilities are returned.</returns> /// <exception cref="VulkanException">Vulkan returns an error code.</exception> public static ExternalImageFormatPropertiesNV GetExternalImageFormatPropertiesNV(this PhysicalDevice physicalDevice, Format format, ImageType type, ImageTiling tiling, ImageUsages usage, ImageCreateFlags flags, ExternalMemoryHandleTypesNV externalHandleType) { ExternalImageFormatPropertiesNV properties; Result result = vkGetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, externalHandleType, &properties); VulkanException.ThrowForInvalidResult(result); return(properties); }