41 std::vector<vk::SubpassDependency> dependencies;
115 for (
auto pre : desc.predecessors)
117 vk::SubpassDependency dependency{};
120 dependency.srcAccessMask = ToVkAccessFlags(pre.neighborAccess);
123 dependency.dstAccessMask = ToVkAccessFlags(pre.currentAccess);
124 dependencies.push_back(dependency);
135 }
catch (
const std::exception& e) {
136 ferr <<
"Failed to create render pass: " << e.what() << std::endl;
161 fout <<
"No attachments for framebuffer!" << std::endl;
165 uint32_t width, height;
180 }
catch (
const std::exception& e) {
181 ferr <<
"Failed to create framebuffer: " << e.what() << std::endl;
193 m_clearValues[i].setDepthStencil(vk::ClearDepthStencilValue(1.0f, 0));
195 m_clearValues[i].setColor(vk::ClearColorValue(std::array<float, 4>{0.0f, 0.0f, 0.0f, 1.0f}));
313 std::map<FCT::Image*, uint32_t> imageToAttachmentIndex;
317 auto vkPass =
static_cast<VK_Pass*
>(pass);
319 for (
auto& targetPair : pass->renderTargets())
321 auto& image = targetPair.second;
322 uint32_t attachmentIndex;
324 auto it = imageToAttachmentIndex.find(image);
325 if (it != imageToAttachmentIndex.end()) {
326 attachmentIndex = it->second;
328 vk::AttachmentDescription desc;
332 desc.storeOp = vk::AttachmentStoreOp::eStore;
334 desc.loadOp = vk::AttachmentLoadOp::eLoad;
335 desc.initialLayout = vk::ImageLayout::eColorAttachmentOptimal;
337 desc.loadOp = vk::AttachmentLoadOp::eLoad;
338 desc.initialLayout = vk::ImageLayout::eColorAttachmentOptimal;
342 desc.finalLayout = vk::ImageLayout::ePresentSrcKHR;
344 desc.finalLayout = vk::ImageLayout::eGeneral;
347 desc.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
348 desc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
353 imageToAttachmentIndex[image] = attachmentIndex;
361 vkPass->targetAttachmentIndices()[targetPair.first] = attachmentIndex;
367 uint32_t attachmentIndex;
370 if (it != imageToAttachmentIndex.end()) {
371 attachmentIndex = it->second;
373 vk::AttachmentDescription desc;
377 desc.loadOp = vk::AttachmentLoadOp::eLoad;
378 desc.storeOp = vk::AttachmentStoreOp::eStore;
380 if (desc.format == vk::Format::eD24UnormS8Uint ||
381 desc.format == vk::Format::eD32SfloatS8Uint ||
382 desc.format == vk::Format::eD16UnormS8Uint ||
383 desc.format == vk::Format::eD32Sfloat
386 desc.stencilLoadOp = vk::AttachmentLoadOp::eLoad;
387 desc.stencilStoreOp = vk::AttachmentStoreOp::eStore;
391 desc.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
392 desc.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
395 desc.initialLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
396 desc.finalLayout = vk::ImageLayout::eDepthStencilAttachmentOptimal;
409 vkPass->setDepthStencilAttachmentIndex(attachmentIndex);