/// <summary> /// VkViewport - Structure specifying a viewport. /// </summary> /// <param name="x">x and y are the viewport’s upper left corner (x,y).</param> /// <param name="y">x and y are the viewport’s upper left corner (x,y).</param> /// <param name="width">width and height are the viewport’s width and height, /// respectively.</param> /// <param name="height">width and height are the viewport’s width and height, /// respectively.</param> /// <param name="minDepth">minDepth and maxDepth are the depth range for the viewport. /// It is valid for minDepth to be greater than or equal to /// maxDepth.</param> /// <param name="maxDepth">minDepth and maxDepth are the depth range for the viewport. /// It is valid for minDepth to be greater than or equal to /// maxDepth.</param> public VkComponentMapping(VkComponentSwizzle r, VkComponentSwizzle g, VkComponentSwizzle b, VkComponentSwizzle a) { this.r = r; this.g = g; this.b = b; this.a = a; }
public void CreateView(VkImageViewType type = VkImageViewType.ImageView2D, VkImageAspectFlags aspectFlags = VkImageAspectFlags.Color, uint layerCount = 1, uint baseMipLevel = 0, uint levelCount = 1, uint baseArrayLayer = 0, VkComponentSwizzle r = VkComponentSwizzle.R, VkComponentSwizzle g = VkComponentSwizzle.G, VkComponentSwizzle b = VkComponentSwizzle.B, VkComponentSwizzle a = VkComponentSwizzle.A) { VkImageView view = default(VkImageView); VkImageViewCreateInfo viewInfo = VkImageViewCreateInfo.New(); viewInfo.image = handle; viewInfo.viewType = type; viewInfo.format = Format; viewInfo.components.r = r; viewInfo.components.g = g; viewInfo.components.b = b; viewInfo.components.a = a; viewInfo.subresourceRange.aspectMask = aspectFlags; viewInfo.subresourceRange.baseMipLevel = baseMipLevel; viewInfo.subresourceRange.levelCount = levelCount; viewInfo.subresourceRange.baseArrayLayer = baseArrayLayer; viewInfo.subresourceRange.layerCount = layerCount; Utils.CheckResult(vkCreateImageView(Dev.VkDev, ref viewInfo, IntPtr.Zero, out view)); if (Descriptor.imageView.Handle != 0) { Dev.DestroyImageView(Descriptor.imageView); } Descriptor.imageView = view; }