private (VkAttachmentDescription, VkAttachmentReference) CreateAttachment( VkFormat format, VkSampleCountFlags samples, uint index, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout initialLayout, VkImageLayout finalLayout) { return(new VkAttachmentDescription() { format = format, samples = samples, loadOp = loadOp, storeOp = storeOp, stencilLoadOp = VkAttachmentLoadOp.Load, stencilStoreOp = stencilStoreOp, initialLayout = initialLayout, finalLayout = finalLayout }, new VkAttachmentReference() { attachment = index, layout = finalLayout }); }
/// <summary> /// Specifies the load operation of this attachment. /// </summary> /// <param name="op">Load operation</param> /// <param name="stencilOp">Stencil load operation, or null if use <c>op</c></param> /// <returns>this</returns> public TBuilder LoadOp(VkAttachmentLoadOp op, VkAttachmentLoadOp?stencilOp = null) { if (!stencilOp.HasValue) { stencilOp = op; } _desc.LoadOp = op; _desc.StencilLoadOp = stencilOp.Value; return((TBuilder)this); }
/// <summary> /// VkAttachmentDescription - Structure specifying an attachment description. /// </summary> /// <param name="format">format is a VkFormat value specifying the format of the /// image view that will be used for the attachment</param> /// <param name="samples">samples is the number of samples of the image as defined in /// VkSampleCountFlagBits</param> /// <param name="loadOp">loadOp is a VkAttachmentLoadOp value specifying how the /// contents of color and depth components of the attachment are treated at /// the beginning of the subpass where it is first used</param> /// <param name="storeOp">storeOp is a VkAttachmentStoreOp value specifying how the /// contents of color and depth components of the attachment are treated at /// the end of the subpass where it is last used</param> /// <param name="stencilLoadOp">stencilLoadOp is a VkAttachmentLoadOp value specifying how /// the contents of stencil components of the attachment are treated at the /// beginning of the subpass where it is first used</param> /// <param name="stencilStoreOp">stencilStoreOp is a VkAttachmentStoreOp value specifying how /// the contents of stencil components of the attachment are treated at the /// end of the last subpass where it is used</param> /// <param name="initialLayout">initialLayout is the layout the attachment image subresource will /// be in when a render pass instance begins</param> /// <param name="finalLayout">finalLayout is the layout the attachment image subresource will be /// transitioned to when a render pass instance ends</param> /// <param name="flags">flags is a bitmask of VkAttachmentDescriptionFlagBits /// specifying additional properties of the attachment</param> public VkAttachmentDescription(VkFormat format, VkSampleCountFlagBits samples, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout initialLayout, VkImageLayout finalLayout, VkAttachmentDescriptionFlagBits flags = 0) { this.format = format; this.samples = samples; this.loadOp = loadOp; this.storeOp = storeOp; this.stencilLoadOp = stencilLoadOp; this.stencilStoreOp = stencilStoreOp; this.initialLayout = initialLayout; this.finalLayout = finalLayout; this.flags = flags; }
public void AddAttachment(VkFormat format, VkImageLayout finalLayout, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.Clear, VkAttachmentStoreOp storeOp = VkAttachmentStoreOp.Store, VkImageLayout initialLayout = VkImageLayout.Undefined) { attachments.Add(new VkAttachmentDescription { format = format, samples = samples, loadOp = loadOp, storeOp = storeOp, stencilLoadOp = VkAttachmentLoadOp.DontCare, stencilStoreOp = VkAttachmentStoreOp.DontCare, initialLayout = initialLayout, finalLayout = finalLayout, }); }
public VkAttachmentDescription( VkFormat format, VkSampleCountFlags samples = VkSampleCountFlags.Count1, VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.Clear, VkAttachmentStoreOp storeOp = VkAttachmentStoreOp.Store, VkAttachmentLoadOp stencilLoadOp = VkAttachmentLoadOp.DontCare, VkAttachmentStoreOp stencilStoreOp = VkAttachmentStoreOp.DontCare, VkImageLayout initialLayout = VkImageLayout.Undefined, VkImageLayout finalLayout = VkImageLayout.PresentSrcKHR, VkAttachmentDescriptionFlags flags = VkAttachmentDescriptionFlags.None) { 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; }
/// <summary> /// Create renderpass with a single color attachment and a resolve one if needed /// </summary> public RenderPass(Device device, VkFormat colorFormat, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, VkAttachmentLoadOp loadOp = VkAttachmentLoadOp.Clear) : this(device) { Samples = samples; AddAttachment(colorFormat, (samples == VkSampleCountFlags.SampleCount1) ? VkImageLayout.PresentSrcKHR : VkImageLayout.ColorAttachmentOptimal, samples, loadOp, VkAttachmentStoreOp.Store); ClearValues.Add(new VkClearValue { color = new VkClearColorValue(0.0f, 0.0f, 0.0f) }); SubPass subpass0 = new SubPass(); subpass0.AddColorReference(0, VkImageLayout.ColorAttachmentOptimal); if (samples != VkSampleCountFlags.SampleCount1) { AddAttachment(colorFormat, VkImageLayout.PresentSrcKHR, VkSampleCountFlags.SampleCount1); ClearValues.Add(new VkClearValue { color = new VkClearColorValue(0.0f, 0.0f, 0.0f) }); subpass0.AddResolveReference(1, VkImageLayout.ColorAttachmentOptimal); } AddSubpass(subpass0); AddDependency(Vk.SubpassExternal, 0, VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.ColorAttachmentOutput, VkAccessFlags.MemoryRead, VkAccessFlags.ColorAttachmentWrite); AddDependency(0, Vk.SubpassExternal, VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.BottomOfPipe, VkAccessFlags.ColorAttachmentWrite, VkAccessFlags.MemoryRead); }