public RenderPassCreateInfo ( StructureType?sType = StructureType.RenderPassCreateInfo, void *pNext = null, RenderPassCreateFlags?flags = null, uint?attachmentCount = null, AttachmentDescription *pAttachments = null, uint?subpassCount = null, SubpassDescription *pSubpasses = null, uint?dependencyCount = null, SubpassDependency *pDependencies = null ) : this() { if (sType is not null) { SType = sType.Value; } if (pNext is not null) { PNext = pNext; } if (flags is not null) { Flags = flags.Value; } if (attachmentCount is not null) { AttachmentCount = attachmentCount.Value; } if (pAttachments is not null) { PAttachments = pAttachments; } if (subpassCount is not null) { SubpassCount = subpassCount.Value; } if (pSubpasses is not null) { PSubpasses = pSubpasses; } if (dependencyCount is not null) { DependencyCount = dependencyCount.Value; } if (pDependencies is not null) { PDependencies = pDependencies; } }
internal void ToNative(out Native native, AttachmentDescription *attachments, SubpassDependency *dependencies) { int subpassCount = Subpasses?.Length ?? 0; var subpasses = (SubpassDescription.Native *)Interop.Alloc <SubpassDescription.Native>(subpassCount); for (int i = 0; i < subpassCount; i++) { Subpasses[i].ToNative(out subpasses[i]); } native.Type = StructureType.RenderPassCreateInfo; native.Next = IntPtr.Zero; native.Flags = 0; native.AttachmentCount = Attachments?.Length ?? 0; native.Attachments = attachments; native.SubpassCount = subpassCount; native.Subpasses = subpasses; native.DependencyCount = Dependencies?.Length ?? 0; native.Dependencies = dependencies; }
public RenderPassCreateInfo ( StructureType sType = StructureType.RenderPassCreateInfo, void *pNext = default, RenderPassCreateFlags flags = default, uint attachmentCount = default, AttachmentDescription *pAttachments = default, uint subpassCount = default, SubpassDescription *pSubpasses = default, uint dependencyCount = default, SubpassDependency *pDependencies = default ) { SType = sType; PNext = pNext; Flags = flags; AttachmentCount = attachmentCount; PAttachments = pAttachments; SubpassCount = subpassCount; PSubpasses = pSubpasses; DependencyCount = dependencyCount; PDependencies = pDependencies; }
private RenderPass CreateRenderpass() { AttachmentDescription *pAttachments = stackalloc AttachmentDescription[2] { //Color Attachment new AttachmentDescription { Format = SwapchainImageFormat, Samples = SampleCountFlags.SampleCount1Bit, LoadOp = AttachmentLoadOp.Clear, StoreOp = AttachmentStoreOp.Store, StencilLoadOp = AttachmentLoadOp.DontCare, StencilStoreOp = AttachmentStoreOp.DontCare, InitialLayout = ImageLayout.Undefined, FinalLayout = ImageLayout.PresentSrcKhr }, //Depth Attachment new AttachmentDescription { Format = DepthFormat, Samples = SampleCountFlags.SampleCount1Bit, LoadOp = AttachmentLoadOp.Clear, StoreOp = AttachmentStoreOp.DontCare, StencilLoadOp = AttachmentLoadOp.DontCare, StencilStoreOp = AttachmentStoreOp.DontCare, InitialLayout = ImageLayout.Undefined, FinalLayout = ImageLayout.DepthStencilAttachmentOptimal } }; var colorAttachmentRef = new AttachmentReference(0, ImageLayout.ColorAttachmentOptimal); var depthAttachmentRef = new AttachmentReference(1, ImageLayout.DepthStencilAttachmentOptimal); var subpass = new SubpassDescription { PipelineBindPoint = PipelineBindPoint.Graphics, ColorAttachmentCount = 1, PColorAttachments = &colorAttachmentRef, PDepthStencilAttachment = &depthAttachmentRef }; var dependency = new SubpassDependency { SrcSubpass = Vk.SubpassExternal, DstSubpass = 0, SrcStageMask = PipelineStageFlags.PipelineStageColorAttachmentOutputBit, SrcAccessMask = 0, DstStageMask = PipelineStageFlags.PipelineStageColorAttachmentOutputBit, DstAccessMask = AccessFlags.AccessColorAttachmentReadBit | AccessFlags.AccessColorAttachmentWriteBit }; var renderPassInfo = new RenderPassCreateInfo { SType = StructureType.RenderPassCreateInfo, AttachmentCount = 2, PAttachments = pAttachments, SubpassCount = 1, PSubpasses = &subpass, DependencyCount = 1, PDependencies = &dependency }; RenderPass rPass; var res = VkApi.CreateRenderPass(Device, &renderPassInfo, null, &rPass); if (res != Result.Success) { throw new VMASharp.VulkanResultException("Failed to create RenderPass!", res); } return(rPass); } }