23#include "InputProvider.h"
24#include "../WindowAbstract.h"
30static const char* kTAG =
"renderPass";
32 ((void)__android_log_print(ANDROID_LOG_INFO, kTAG, __VA_ARGS__))
36const bool transientAttachment =
false;
39const bool transientAttachment =
false;
45 vk::DebugUtilsObjectNameInfoEXT debug(vk::ObjectType::eImage, (uint64_t)
static_cast<VkImage
>(imStruct.
image), imStruct.name.c_str());
54 return {vk::Format::eD16Unorm, vk::Format::eD32Sfloat, vk::Format::eD24UnormS8Uint};
73 createAttachementsRessources();
74 createDepthResources();
92 D(std::cout <<
"Create pipeline: " << i <<std::endl;)
103void VulkanRenderPass::createFramebuffers()
113 if (renderDirectlyToSwapchain) {
122 vk::FramebufferCreateInfo framebufferCreateInfo(
123 vk::FramebufferCreateFlags(),
125 static_cast<uint32_t
>(attachments.size()),
194 for(
auto framebuffer:framebuffers) {
223 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.0f, 0.0f, 1.0f} }));
231 std::vector<vk::ClearValue> clearValues;
233 clearValues.resize(9);
234 clearValues[0].color = clearColor;
235 clearValues[1].color = clearColor;
236 clearValues[2].color = clearColor;
237 clearValues[3].color = clearColor;
238 clearValues[4].color = clearColor;
239 clearValues[5].color = clearColor;
240 clearValues[6].color = clearColor;
241 clearValues[7].depthStencil = vk::ClearDepthStencilValue{ 1.0f, 0 };
242 clearValues[8].color = clearColor;
245 clearValues.resize(11);
246 clearValues[0].color = clearColor;
247 clearValues[1].color = clearColor;
248 clearValues[2].color = clearColor;
249 clearValues[3].color = clearColor;
250 clearValues[4].color = clearColor;
251 clearValues[5].color = clearColor;
252 clearValues[6].color = clearColor;
253 clearValues[7].color = clearColor;
254 clearValues[8].color = clearColor;
255 clearValues[9].depthStencil = vk::ClearDepthStencilValue{ 1.0f, 0 };
256 clearValues[10].color = clearColor;
261 vk::RenderPassBeginInfo renderPassBeginInfo(
264 vk::Rect2D(vk::Offset2D(0, 0),
266 static_cast<uint32_t
>(clearValues.size()),
270 if (resetViewPortAndScissor) {
272 renderPassBeginInfo.renderArea = vk::Rect2D(vk::Offset2D(0, 0),
276 commandBuffer.beginRenderPass(renderPassBeginInfo, vk::SubpassContents::eInline);
285 (float)-1 * ext.height,
288 scissor = vk::Rect2D{ {0, 0}, ext };
289 commandBuffer.setViewport(0, {
viewport});
290 commandBuffer.setScissor(0, {
scissor});
297 vk::ClearColorValue clearColor(std::array<float, 4>({ {0.0f, 0.0f, 0.0f, 1.0f} }));
303 vk::ClearAttachment clear0(vk::ImageAspectFlagBits::eColor, 0, vk::ClearValue(clearColor));
304 vk::ClearAttachment clear1(vk::ImageAspectFlagBits::eColor, 1, vk::ClearValue(clearColor));
305 vk::ClearAttachment clear2(vk::ImageAspectFlagBits::eColor, 2, vk::ClearValue(clearColor));
306 vk::ClearAttachment clear3(vk::ImageAspectFlagBits::eDepth, 0, vk::ClearValue(vk::ClearDepthStencilValue{ 1.0f,0 }));
311 std::array<vk::ClearAttachment, 4> clearAttachments = { clear0,clear1,clear2, clear3};
312 vk::ClearRect rect0 = vk::ClearRect(
scissor, 0, 1);
313 vk::ClearRect rect1 = vk::ClearRect(
scissor, 0, 1);
314 vk::ClearRect rect2 = vk::ClearRect(
scissor, 0, 1);
315 std::array<vk::ClearRect, 3> clearRects = { rect0,rect1,rect2};
316 commandBuffer.clearAttachments(clearAttachments, clearRects);
323 commandBuffer.nextSubpass(vk::SubpassContents::eInline);
329 vk::ClearAttachment clearD(vk::ImageAspectFlagBits::eDepth, 0, vk::ClearValue(vk::ClearDepthStencilValue{ 0.0f,0 }));
330 std::array<vk::ClearAttachment, 1> clearAttachments = { clearD };
331 vk::ClearRect rect0 = vk::ClearRect(
scissor , 0, 1);
332 std::array<vk::ClearRect, 1> clearRect = { rect0 };
333 commandBuffer.clearAttachments(clearAttachments, clearRect);
344 commandBuffer.nextSubpass(vk::SubpassContents::eInline);
348 commandBuffer.endRenderPass();
351void VulkanRenderPass::createRenderPass()
357 vk::AttachmentDescription swapChainAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
359 vk::SampleCountFlagBits::e1,
360 vk::AttachmentLoadOp::eClear,
361 vk::AttachmentStoreOp::eStore,
362 vk::AttachmentLoadOp::eDontCare,
363 vk::AttachmentStoreOp::eDontCare,
364 vk::ImageLayout::eUndefined,
368 vk::AttachmentDescription depthSwapChainAttachment;
370 depthSwapChainAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
372 vk::SampleCountFlagBits::e1,
373 vk::AttachmentLoadOp::eClear,
374 vk::AttachmentStoreOp::eStore,
375 vk::AttachmentLoadOp::eDontCare,
376 vk::AttachmentStoreOp::eStore,
377 vk::ImageLayout::eUndefined,
378 vk::ImageLayout::eDepthStencilAttachmentOptimal
383 vk::AttachmentDescription colorAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
385 vk::SampleCountFlagBits::e1,
386 vk::AttachmentLoadOp::eClear,
387 vk::AttachmentStoreOp::eDontCare,
388 vk::AttachmentLoadOp::eDontCare,
389 vk::AttachmentStoreOp::eDontCare,
390 vk::ImageLayout::eUndefined,
395 vk::AttachmentDescription floatDepthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
397 vk::SampleCountFlagBits::e1,
398 vk::AttachmentLoadOp::eClear,
399 vk::AttachmentStoreOp::eDontCare,
400 vk::AttachmentLoadOp::eDontCare,
401 vk::AttachmentStoreOp::eDontCare,
402 vk::ImageLayout::eUndefined,
406 vk::AttachmentDescription qualityAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
408 vk::SampleCountFlagBits::e1,
409 vk::AttachmentLoadOp::eClear,
410 vk::AttachmentStoreOp::eDontCare,
411 vk::AttachmentLoadOp::eDontCare,
412 vk::AttachmentStoreOp::eDontCare,
413 vk::ImageLayout::eUndefined,
417 vk::AttachmentDescription accuColorAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
419 vk::SampleCountFlagBits::e1,
420 vk::AttachmentLoadOp::eClear,
422 (
inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
423 vk::AttachmentLoadOp::eDontCare,
424 vk::AttachmentStoreOp::eDontCare,
425 vk::ImageLayout::eUndefined,
426 (
inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout
429 vk::AttachmentDescription accuQualityAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
431 vk::SampleCountFlagBits::e1,
432 vk::AttachmentLoadOp::eClear,
433 vk::AttachmentStoreOp::eDontCare,
434 vk::AttachmentLoadOp::eDontCare,
435 vk::AttachmentStoreOp::eDontCare,
436 vk::ImageLayout::eUndefined,
439 vk::AttachmentDescription accuDepthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
441 vk::SampleCountFlagBits::e1,
442 vk::AttachmentLoadOp::eClear,
444 (
inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
445 vk::AttachmentLoadOp::eDontCare,
446 vk::AttachmentStoreOp::eDontCare,
447 vk::ImageLayout::eUndefined,
448 (
inputImage % 2 == 0 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout
451 vk::AttachmentDescription accuColor2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
453 vk::SampleCountFlagBits::e1,
454 vk::AttachmentLoadOp::eClear,
456 (
inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
457 vk::AttachmentLoadOp::eDontCare,
458 vk::AttachmentStoreOp::eDontCare,
459 vk::ImageLayout::eUndefined,
460 (
inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout
463 vk::AttachmentDescription accuQuality2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
465 vk::SampleCountFlagBits::e1,
466 vk::AttachmentLoadOp::eClear,
467 vk::AttachmentStoreOp::eDontCare,
468 vk::AttachmentLoadOp::eDontCare,
469 vk::AttachmentStoreOp::eDontCare,
470 vk::ImageLayout::eUndefined,
471 vk::ImageLayout::ePresentSrcKHR
473 vk::AttachmentDescription accuDepth2Attachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
475 vk::SampleCountFlagBits::e1,
476 vk::AttachmentLoadOp::eClear,
478 (
inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::AttachmentStoreOp::eStore : vk::AttachmentStoreOp::eDontCare,
479 vk::AttachmentLoadOp::eDontCare,
480 vk::AttachmentStoreOp::eDontCare,
481 vk::ImageLayout::eUndefined,
482 (
inputImage % 2 == 1 && !useSwapChainAttachment) ? vk::ImageLayout::eTransferSrcOptimal : finalLayout
487 vk::AttachmentDescription depthAttachment = vk::AttachmentDescription(vk::AttachmentDescriptionFlags(),
489 vk::SampleCountFlagBits::e1,
490 vk::AttachmentLoadOp::eClear,
492 vk::AttachmentLoadOp::eDontCare,
493 vk::AttachmentStoreOp::eDontCare,
494 vk::ImageLayout::eUndefined,
495 vk::ImageLayout::eDepthStencilAttachmentOptimal
499 std::vector<vk::AttachmentDescription> attachmentDescriptions;
501 if (useSwapChainAttachment) {
502 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuColor2Attachment, accuQuality2Attachment , depthAttachment, swapChainAttachment };
505 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuColor2Attachment, accuQuality2Attachment, depthAttachment };
508 if (useSwapChainAttachment) {
509 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuDepthAttachment,accuColor2Attachment, accuQuality2Attachment,accuDepth2Attachment, depthAttachment, swapChainAttachment };
512 attachmentDescriptions = { colorAttachment,floatDepthAttachment,qualityAttachment,accuColorAttachment,accuQualityAttachment,accuDepthAttachment,accuColor2Attachment, accuQuality2Attachment,accuDepth2Attachment, depthAttachment };
517 std::vector<vk::SubpassDescription> subPassDescriptions;
518 std::vector< vk::SubpassDependency> subPassDep;
519 vk::SubpassDependency dependency{};
520 dependency.srcSubpass = VK_SUBPASS_EXTERNAL;
521 dependency.dstSubpass = 0;
522 dependency.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
523 dependency.dstStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
524 dependency.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
525 dependency.dstAccessMask = vk::AccessFlagBits::eColorAttachmentWrite | vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eDepthStencilAttachmentWrite;
526 dependency.dependencyFlags = vk::DependencyFlagBits::eByRegion;
527 subPassDep.push_back(dependency);
529 vk::SubpassDependency dependency2{};
530 dependency2.srcSubpass = VK_SUBPASS_EXTERNAL;
531 dependency2.dstSubpass = 1;
532 dependency2.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput | vk::PipelineStageFlagBits::eEarlyFragmentTests;
533 dependency2.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader | vk::PipelineStageFlagBits::eColorAttachmentOutput;
534 dependency2.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
535 dependency2.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite;
536 dependency2.dependencyFlags = vk::DependencyFlagBits::eByRegion;
537 subPassDep.push_back(dependency2);
540 vk::AttachmentReference colorReference(0, vk::ImageLayout::eColorAttachmentOptimal);
541 vk::AttachmentReference fDepthReference(1, vk::ImageLayout::eColorAttachmentOptimal);
542 vk::AttachmentReference qualityReference(2, vk::ImageLayout::eColorAttachmentOptimal);
544 std::array<vk::AttachmentReference, 3> colorAttachementRef = { colorReference,fDepthReference,qualityReference };
545 std::vector<uint32_t> preserveAttachementRef = { 3,4,6,5 };
546 vk::AttachmentReference depthReference(7, vk::ImageLayout::eDepthStencilAttachmentOptimal);
549 vk::AttachmentReference imageInput(0, vk::ImageLayout::eShaderReadOnlyOptimal);
550 vk::AttachmentReference depthInput(1, vk::ImageLayout::eShaderReadOnlyOptimal);
551 vk::AttachmentReference qualityInput(2, vk::ImageLayout::eShaderReadOnlyOptimal);
553 vk::AttachmentReference accuColorInput0(3, vk::ImageLayout::eShaderReadOnlyOptimal);
554 vk::AttachmentReference accuQualityInput0(4, vk::ImageLayout::eShaderReadOnlyOptimal);
556 vk::AttachmentReference accuColorInput1(5, vk::ImageLayout::eShaderReadOnlyOptimal);
557 vk::AttachmentReference accuQualityInput1(6, vk::ImageLayout::eShaderReadOnlyOptimal);
559 vk::AttachmentReference colorOutput0(5, vk::ImageLayout::eColorAttachmentOptimal);
560 vk::AttachmentReference qualityOutput0(6, vk::ImageLayout::eColorAttachmentOptimal);
561 vk::AttachmentReference colorOutput1(3, vk::ImageLayout::eColorAttachmentOptimal);
562 vk::AttachmentReference qualityOutput1(4, vk::ImageLayout::eColorAttachmentOptimal);
565 vk::AttachmentReference colorOutputFinal(8, vk::ImageLayout::eColorAttachmentOptimal);
566 if (!useSwapChainAttachment) {
567 colorOutputFinal.attachment = (
inputImage-1 % 2 == 0) ? 5 : 3;
571 std::vector<vk::AttachmentReference> inputAttachementBlendingFirst = { imageInput, qualityInput, depthInput };
572 std::vector<uint32_t> preserveAttachementFirst = { 3,4 };
574 std::vector<vk::AttachmentReference> inputAttachementBlending0 = { imageInput, qualityInput, depthInput, accuColorInput0,accuQualityInput0 };
575 std::vector<vk::AttachmentReference> inputAttachementBlending1 = { imageInput, qualityInput, depthInput, accuColorInput1,accuQualityInput1 };
577 std::vector<vk::AttachmentReference> outputAttachementBlending0 = { colorOutput0, qualityOutput0 };
578 std::vector<vk::AttachmentReference> outputAttachementBlending1 = { colorOutput1, qualityOutput1 };
579 std::vector<vk::AttachmentReference> outputAttachementBlendingFinal = { colorOutputFinal };
581 std::array<uint32_t, 1> preserveAttachementDepth = { 7};
593 depthReference = vk::AttachmentReference(9, vk::ImageLayout::eDepthStencilAttachmentOptimal);
596 vk::AttachmentReference accuDepthInput0(5, vk::ImageLayout::eShaderReadOnlyOptimal);
598 accuColorInput1 = vk::AttachmentReference (6, vk::ImageLayout::eShaderReadOnlyOptimal);
599 accuQualityInput1 = vk::AttachmentReference(7, vk::ImageLayout::eShaderReadOnlyOptimal);
600 vk::AttachmentReference accuDepthInput1(8, vk::ImageLayout::eShaderReadOnlyOptimal);
602 colorOutput0 = vk::AttachmentReference(6, vk::ImageLayout::eColorAttachmentOptimal);
603 qualityOutput0 = vk::AttachmentReference(7, vk::ImageLayout::eColorAttachmentOptimal);
604 vk::AttachmentReference depthOutput0(8, vk::ImageLayout::eColorAttachmentOptimal);
606 vk::AttachmentReference depthOutput1(5, vk::ImageLayout::eColorAttachmentOptimal);
609 colorOutputFinal = vk::AttachmentReference(10, vk::ImageLayout::eColorAttachmentOptimal);
610 if (!useSwapChainAttachment) {
611 colorOutputFinal.attachment = (
inputImage - 1 % 2 == 0) ? 6 : 3;
619 preserveAttachementFirst = { 3,4,5 };
620 inputAttachementBlending0 = { imageInput, qualityInput, depthInput, accuColorInput0,accuQualityInput0, accuDepthInput0 };
621 inputAttachementBlending1 = { imageInput, qualityInput, depthInput, accuColorInput1,accuQualityInput1, accuDepthInput1 };
623 outputAttachementBlending0 = { colorOutput0, qualityOutput0, depthOutput0 };
624 outputAttachementBlending1 = { colorOutput1, qualityOutput1,depthOutput1 };
625 outputAttachementBlendingFinal = { colorOutputFinal };
631 vk::SubpassDescription subpass(
632 vk::SubpassDescriptionFlags(),
633 vk::PipelineBindPoint::eGraphics,
636 static_cast<uint32_t
>(colorAttachementRef.size()),
637 colorAttachementRef.data(),
640 static_cast<uint32_t
>(preserveAttachementRef.size()),
641 preserveAttachementRef.data()
643 subPassDescriptions.push_back(subpass);
646 std::vector<vk::AttachmentReference>* inputAttachementsBlending;
647 std::vector<vk::AttachmentReference>* outputAttachementsBlending;
650 inputAttachementsBlending = &inputAttachementBlending0;
651 outputAttachementsBlending = &outputAttachementBlending0;
654 inputAttachementsBlending = &inputAttachementBlending1;
655 outputAttachementsBlending = &outputAttachementBlending1;
658 inputAttachementsBlending = &inputAttachementBlendingFirst;
661 outputAttachementsBlending = &outputAttachementBlendingFinal;
663 vk::SubpassDescription subpassBlending(
664 vk::SubpassDescriptionFlags(),
665 vk::PipelineBindPoint::eGraphics,
666 static_cast<uint32_t
>(inputAttachementsBlending->size()),
667 inputAttachementsBlending->data(),
668 static_cast<uint32_t
>(outputAttachementsBlending->size()),
669 outputAttachementsBlending->data(),
672 i == 0 ?
static_cast<uint32_t
>(preserveAttachementFirst.size()) : 0,
673 i == 0 ? preserveAttachementFirst.data() :
nullptr
675 subPassDescriptions.push_back(subpassBlending);
677 vk::SubpassDependency dependencyBlend{};
678 dependencyBlend.srcSubpass = 0 + 2*i;
679 dependencyBlend.dstSubpass = 1 + 2*i;
680 dependencyBlend.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
681 dependencyBlend.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader;
682 dependencyBlend.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
683 dependencyBlend.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
684 dependencyBlend.dependencyFlags = vk::DependencyFlagBits::eByRegion;
686 subPassDep.push_back(dependencyBlend);
689 vk::SubpassDependency dependencyFragment{};
690 dependencyFragment.srcSubpass = (i-1) * 2 + 1;
691 dependencyFragment.dstSubpass = 2 * i + 1;
692 dependencyFragment.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
693 dependencyFragment.dstStageMask = vk::PipelineStageFlagBits::eFragmentShader;
694 dependencyFragment.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
695 dependencyFragment.dstAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
696 dependencyFragment.dependencyFlags = vk::DependencyFlagBits::eByRegion;
697 subPassDep.push_back(dependencyFragment);
700 vk::SubpassDependency dependencyInterView{};
701 dependencyInterView.srcSubpass = (i * 2) - 1;
702 dependencyInterView.dstSubpass = 2 * i;
703 dependencyInterView.srcStageMask = vk::PipelineStageFlagBits::eFragmentShader;
705 dependencyInterView.dstStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
706 dependencyInterView.srcAccessMask = vk::AccessFlagBits::eInputAttachmentRead;
708 dependencyInterView.dstAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
709 dependencyInterView.dependencyFlags = vk::DependencyFlagBits::eByRegion;
710 subPassDep.push_back(dependencyInterView);
716 vk::SubpassDependency finalDependency{};
717 finalDependency.srcSubpass = 2 *
inputImage - 1;
718 finalDependency.dstSubpass = VK_SUBPASS_EXTERNAL;
719 finalDependency.srcStageMask = vk::PipelineStageFlagBits::eColorAttachmentOutput;
720 finalDependency.dstStageMask = vk::PipelineStageFlagBits::eBottomOfPipe;
721 finalDependency.srcAccessMask = vk::AccessFlagBits::eColorAttachmentRead | vk::AccessFlagBits::eColorAttachmentWrite;
722 finalDependency.dstAccessMask = vk::AccessFlagBits::eMemoryRead;
723 finalDependency.dependencyFlags = vk::DependencyFlagBits::eByRegion;
724 subPassDep.push_back(finalDependency);
726 vk::RenderPassCreateInfo renderPassInfo(
727 vk::RenderPassCreateFlags(),
728 attachmentDescriptions.size(),
729 attachmentDescriptions.data(),
730 static_cast<uint32_t
>(subPassDescriptions.size()),
731 subPassDescriptions.data(),
732 static_cast<uint32_t
>(subPassDep.size()),
742void VulkanRenderPass::createAttachementsRessources()
769 auto imageUsageNonTransient = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eInputAttachment;
770 auto memoryPropertyNonLazy = vk::MemoryPropertyFlagBits::eDeviceLocal;
771 auto imageUsageTransient = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eInputAttachment | vk::ImageUsageFlagBits::eTransientAttachment;
772 vk::MemoryPropertyFlags memoryPropertyLazy = vk::MemoryPropertyFlagBits::eDeviceLocal | vk::MemoryPropertyFlagBits::eLazilyAllocated;
773 auto imageUsage = imageUsageNonTransient;
774 vk::MemoryPropertyFlags memoryProperty = memoryPropertyNonLazy;
775 if (transientAttachment) {
776 imageUsage = imageUsageTransient;
777 memoryProperty = memoryPropertyLazy;
780 for (
int i = 0; i < (attachmentSize); i++) {
797 auto image4Usage = (
inputImage % 2 == 0) ? imageUsageNonTransient | vk::ImageUsageFlagBits::eTransferSrc : imageUsage;
798 auto memoryProp4 = (
inputImage % 2 == 0) ? memoryPropertyNonLazy : memoryProperty;
804 auto image6Usage = (
inputImage % 2 == 1) ? imageUsageNonTransient | vk::ImageUsageFlagBits::eTransferSrc : imageUsage;
805 auto memoryProp6 = (
inputImage % 2 == 1) ? memoryPropertyNonLazy : memoryProperty;
817 for (
int i = 0; i < (attachmentSize); i++) {
887void VulkanRenderPass::createDepthResources()
898 for (
int i = 0; i < (attachmentSize); i++) {
901 commandPoolBuffer, vk::ImageLayout::eDepthStencilAttachmentOptimal, vk::ImageAspectFlagBits::eDepth);
913void VulkanRenderPass::createCommandPoolForBuffer()
917 vk::CommandPoolCreateInfo commandPoolInfo(vk::CommandPoolCreateFlagBits::eTransient, queueFamilyIndices.
graphicsFamily.value());
File that contain the VulkanContext class to manage Vulkan Instance, Physical device,...
Class that contains helper functions for Vulkan.
file that conthains a class that manages the pipeline for the blending
Contains the class that manages the warping pipeline.
file that contains the class that manage the renderPass containing the synthesis and blending steps
file that contains the VulkanWrapper class that manages the classes related to Vulkan code and ease t...
class that manages tasks related to Vulkan context (Vulkan Instance, Vulkan Physical device,...
vk::Format findDepthFormat()
vk::PhysicalDevice physicalDevice
WindowAbstract * get_window()
bool isIndepFromWindowDimension()
QueueFamilyIndices findQueueFamilies(vk::PhysicalDevice device)
An abstract class that contains a common base of code for the class that inherit from it.
vk::Extent2D renderingExtent
std::vector< ImageStruct > depthImages
vk::CommandPool commandPoolBuffer
virtual void init(InputProvider *inputProvider)
vk::RenderPass renderPass
std::vector< ImageStruct > attachementAccuQuality2
bool isInitialized() override
std::vector< ImageStruct > attachementAccuColor2
std::vector< vk::ImageView > getAttachmentView(int swapIndex, int view)
std::vector< vk::Format > getSupportedDepthFormats() const override
void recordCommandBuffer(vk::CommandBuffer &commandBuffer, int i, std::span< InputProvider::StreamFrameInfo > frameInfos, int view) override
std::vector< ImageStruct > attachementDepthFloat
VulkanRenderPass(VulkanContext *context, VulkanWrapper *wraps)
std::vector< std::unique_ptr< VulkanPipelineWarping > > warpingPipelines
std::vector< ImageStruct > attachementAccuDepth2
std::vector< ImageStruct > attachementQualityFloat
std::vector< std::vector< vk::Framebuffer > > swapChainFramebuffers
void init(InputProvider *inputProvider) override
std::vector< ImageStruct > attachementAccuDepth
std::vector< ImageStruct > attachementAccuColor
std::vector< ImageStruct > attachementAccuQuality
void updateBuffer(uint32_t currentImage, bool initAll, std::span< InputProvider::StreamFrameInfo > infos, int view) override
std::vector< std::unique_ptr< VulkanPipelineBlending > > blendingPipelines
std::vector< ImageStruct > attachementColor
vk::Image getImageToBlit(int imageIndex) override
Class that manages the classes related to Vulkan code and act as a wrapper around them.
bool isDepthOutputRecquired()
const vk::Format internal1DAttachmentFormat
vk::Extent2D getRenderOutputExtent()
const vk::Format internalColorAttachmentFormat
vk::Extent2D getSwapchainExtend(int view=0)
bool isUsingDifferentViewSize()
vk::Format getDepthSwapchainFormat(int view=0)
const bool multiviewSetup
vk::Format getSwapchainFormat(int view=0)
const vk::Format qualityAttachmentFormat
vk::ImageLayout getLayoutAfterRenderpass()
vk::ImageView getSwapchainImageView(int view, int elem)
vk::ImageView getDepthSwapchainImageView(int view, int elem)
virtual bool isDepthRecquired()
file that contains the common include for the Vulkan part
Struct that aims to facilitate the creation of image, their view and memory.
Struct to encapsulate the indice of the queues families.
std::optional< uint32_t > graphicsFamily