(dev vk.Device, imgFmt *ImageFormat, depthFmt Types, clear bool)
| 90 | } |
| 91 | |
| 92 | func (rp *Render) ConfigImpl(dev vk.Device, imgFmt *ImageFormat, depthFmt Types, clear bool) vk.RenderPass { |
| 93 | // The initial layout for the color and depth attachments will be vk.LayoutUndefined |
| 94 | // because at the start of the renderpass, we don't care about their contents. |
| 95 | // At the start of the subpass, the color attachment's layout will be transitioned |
| 96 | // to vk.LayoutColorAttachmentOptimal and the depth stencil attachment's layout |
| 97 | // will be transitioned to vk.LayoutDepthStencilAttachmentOptimal. At the end of |
| 98 | // the renderpass, the color attachment's layout will be transitioned to |
| 99 | // vk.LayoutPresentSrc to be ready to present. This is all done as part of |
| 100 | // the renderpass, no barriers are necessary. |
| 101 | rp.Dev = dev |
| 102 | rp.Format = *imgFmt |
| 103 | rp.HasDepth = false |
| 104 | |
| 105 | ca := vk.AttachmentDescription{ |
| 106 | Format: rp.Format.Format, |
| 107 | Samples: rp.Format.Samples, |
| 108 | LoadOp: vk.AttachmentLoadOpClear, |
| 109 | StoreOp: vk.AttachmentStoreOpStore, |
| 110 | StencilLoadOp: vk.AttachmentLoadOpDontCare, |
| 111 | StencilStoreOp: vk.AttachmentStoreOpDontCare, |
| 112 | InitialLayout: vk.ImageLayoutUndefined, |
| 113 | FinalLayout: vk.ImageLayoutPresentSrc, |
| 114 | } |
| 115 | |
| 116 | if !clear { |
| 117 | ca.LoadOp = vk.AttachmentLoadOpLoad |
| 118 | ca.InitialLayout = vk.ImageLayoutPresentSrc |
| 119 | } |
| 120 | |
| 121 | atta := []vk.AttachmentDescription{ca} |
| 122 | |
| 123 | if depthFmt != UndefType { |
| 124 | rp.HasDepth = true |
| 125 | rp.Depth.ConfigDepth(rp.Sys.GPU, dev, depthFmt, imgFmt) |
| 126 | depthAttach := vk.AttachmentDescription{ |
| 127 | Format: rp.Depth.Format.Format, |
| 128 | Samples: rp.Depth.Format.Samples, |
| 129 | LoadOp: vk.AttachmentLoadOpClear, |
| 130 | StoreOp: vk.AttachmentStoreOpDontCare, |
| 131 | StencilLoadOp: vk.AttachmentLoadOpDontCare, |
| 132 | StencilStoreOp: vk.AttachmentStoreOpDontCare, |
| 133 | InitialLayout: vk.ImageLayoutUndefined, |
| 134 | FinalLayout: vk.ImageLayoutDepthStencilAttachmentOptimal, |
| 135 | } |
| 136 | atta = append(atta, depthAttach) |
| 137 | } |
| 138 | |
| 139 | if rp.Format.Samples != vk.SampleCount1Bit { |
| 140 | rp.HasMulti = true |
| 141 | ca.FinalLayout = vk.ImageLayoutColorAttachmentOptimal |
| 142 | rp.Multi.ConfigMulti(rp.Sys.GPU, dev, &rp.Format) |
| 143 | resolveAttach := vk.AttachmentDescription{ |
| 144 | Format: rp.Format.Format, |
| 145 | Samples: vk.SampleCount1Bit, |
| 146 | LoadOp: vk.AttachmentLoadOpDontCare, |
| 147 | StoreOp: vk.AttachmentStoreOpStore, |
| 148 | StencilLoadOp: vk.AttachmentLoadOpDontCare, |
| 149 | StencilStoreOp: vk.AttachmentStoreOpDontCare, |
no test coverage detected