27 std::vector<vk::SubpassDependency> dependencies;
101 for (
auto pre : desc.predecessors)
103 vk::SubpassDependency dependency{};
106 dependency.srcAccessMask = ToVkAccessFlags(pre.neighborAccess);
109 dependency.dstAccessMask = ToVkAccessFlags(pre.currentAccess);
110 dependencies.push_back(dependency);
121 }
catch (
const std::exception& e) {
122 ferr <<
"Failed to create render pass: " << e.what() << std::endl;
147 fout <<
"No attachments for framebuffer!" << std::endl;
151 uint32_t width, height;
166 }
catch (
const std::exception& e) {
167 ferr <<
"Failed to create framebuffer: " << e.what() << std::endl;
179 m_clearValues[i].setDepthStencil(vk::ClearDepthStencilValue(1.0f, 0));
181 m_clearValues[i].setColor(vk::ClearColorValue(std::array<float, 4>{0.0f, 0.0f, 0.0f, 1.0f}));
299 std::map<FCT::Image*, uint32_t> imageToAttachmentIndex;
303 auto vkPass =
static_cast<VK_Pass*
>(pass);
305 for (
auto& targetPair : pass->renderTargets())
307 auto& image = targetPair.second;
308 uint32_t attachmentIndex;
310 auto it = imageToAttachmentIndex.find(image);
311 if (it != imageToAttachmentIndex.end()) {
312 attachmentIndex = it->second;
314 vk::AttachmentDescription desc;
318 desc.storeOp = vk::AttachmentStoreOp::eStore;
320 desc.loadOp = vk::AttachmentLoadOp::eLoad;
321 desc.initialLayout = vk::ImageLayout::eColorAttachmentOptimal;
323 desc.loadOp = vk::AttachmentLoadOp::eLoad;
324 desc.initialLayout = vk::ImageLayout::eColorAttachmentOptimal;
328 desc.finalLayout = vk::ImageLayout::ePresentSrcKHR;
330 desc.finalLayout = vk::ImageLayout::eGeneral;
333 desc.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
334 desc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
339 imageToAttachmentIndex[image] = attachmentIndex;
347 vkPass->targetAttachmentIndices()[targetPair.first] = attachmentIndex;
353 uint32_t attachmentIndex;
356 if (it != imageToAttachmentIndex.end()) {
357 attachmentIndex = it->second;
359 vk::AttachmentDescription desc;
363 desc.loadOp = vk::AttachmentLoadOp::eLoad;
364 desc.storeOp = vk::AttachmentStoreOp::eStore;
366 if (desc.format == vk::Format::eD24UnormS8Uint ||
367 desc.format == vk::Format::eD32SfloatS8Uint ||
368 desc.format == vk::Format::eD16UnormS8Uint ||
369 desc.format == vk::Format::eD32Sfloat
372 desc.stencilLoadOp = vk::AttachmentLoadOp::eLoad;
373 desc.stencilStoreOp = vk::AttachmentStoreOp::eStore;
377 desc.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
378 desc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
381 desc.initialLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
382 desc.finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
395 vkPass->setDepthStencilAttachmentIndex(attachmentIndex);