tu: Translate VkRenderPassMultiviewCreateInfo to VkRenderPassCreateInfo2
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 2 Jul 2020 08:46:27 +0000 (10:46 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 20 Aug 2020 19:21:17 +0000 (19:21 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5720>

src/freedreno/vulkan/tu_pass.c

index fdc3048fdd284c5942ac6baab41da98ca07e0135..bef3c3b1e39e279ba095911d211bdd73d329d7a8 100644 (file)
@@ -518,6 +518,14 @@ tu_CreateRenderPass(VkDevice device,
    VkAttachmentReference2 reference[reference_count];
    VkAttachmentReference2 *reference_ptr = reference;
 
+   VkRenderPassMultiviewCreateInfo *multiview_info = NULL;
+   vk_foreach_struct(ext, pCreateInfo->pNext) {
+      if (ext->sType == VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO) {
+         multiview_info = (VkRenderPassMultiviewCreateInfo*) ext;
+         break;
+      }
+   }
+
    for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
       attachments[i] = (VkAttachmentDescription2) {
          .sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2,
@@ -545,6 +553,9 @@ tu_CreateRenderPass(VkDevice device,
          .colorAttachmentCount = pCreateInfo->pSubpasses[i].colorAttachmentCount,
       };
 
+      if (multiview_info && multiview_info->subpassCount)
+         subpasses[i].viewMask = multiview_info->pViewMasks[i];
+
       subpasses[i].pInputAttachments = reference_ptr;
       translate_references(&reference_ptr,
                            pCreateInfo->pSubpasses[i].pInputAttachments,
@@ -584,6 +595,9 @@ tu_CreateRenderPass(VkDevice device,
          .dependencyFlags = pCreateInfo->pDependencies[i].dependencyFlags,
          .viewOffset = 0,
       };
+
+      if (multiview_info && multiview_info->dependencyCount)
+         dependencies[i].viewOffset = multiview_info->pViewOffsets[i];
    }
 
    VkRenderPassCreateInfo2 create_info = {
@@ -598,6 +612,11 @@ tu_CreateRenderPass(VkDevice device,
       .pDependencies = dependencies,
    };
 
+   if (multiview_info) {
+      create_info.correlatedViewMaskCount = multiview_info->correlationMaskCount;
+      create_info.pCorrelatedViewMasks = multiview_info->pCorrelationMasks;
+   }
+
    return tu_CreateRenderPass2(device, &create_info, pAllocator, pRenderPass);
 }