OSDN Git Service

anv/pass: Store subpass attachment reference list
authorNanley Chery <nanley.g.chery@intel.com>
Sat, 25 Feb 2017 23:57:32 +0000 (15:57 -0800)
committerNanley Chery <nanley.g.chery@intel.com>
Thu, 2 Mar 2017 21:17:55 +0000 (13:17 -0800)
We'll loop through this array when performing automatic layout
transitions.

v2: Adjust formatting of an assignment (Jason Ekstrand)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_pass.c
src/intel/vulkan/anv_private.h

index 5bd205d..4a1a340 100644 (file)
@@ -86,9 +86,11 @@ VkResult anv_CreateRenderPass(
       const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
 
       subpass_attachment_count +=
+      pass->subpasses[i].attachment_count =
          desc->inputAttachmentCount +
          desc->colorAttachmentCount +
-         (desc->pResolveAttachments ? desc->colorAttachmentCount : 0);
+         (desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
+         (desc->pDepthStencilAttachment != NULL);
    }
 
    pass->subpass_attachments =
@@ -108,6 +110,7 @@ VkResult anv_CreateRenderPass(
 
       subpass->input_count = desc->inputAttachmentCount;
       subpass->color_count = desc->colorAttachmentCount;
+      subpass->attachments = p;
 
       if (desc->inputAttachmentCount > 0) {
          subpass->input_attachments = p;
@@ -169,7 +172,8 @@ VkResult anv_CreateRenderPass(
 
       if (desc->pDepthStencilAttachment) {
          uint32_t a = desc->pDepthStencilAttachment->attachment;
-         subpass->depth_stencil_attachment = *desc->pDepthStencilAttachment;
+         *p++ = subpass->depth_stencil_attachment =
+            *desc->pDepthStencilAttachment;
          if (a != VK_ATTACHMENT_UNUSED) {
             pass->attachments[a].usage |=
                VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
index 9319564..455bf35 100644 (file)
@@ -1921,6 +1921,13 @@ struct anv_framebuffer {
 };
 
 struct anv_subpass {
+   uint32_t                                     attachment_count;
+
+   /**
+    * A pointer to all attachment references used in this subpass.
+    * Only valid if ::attachment_count > 0.
+    */
+   VkAttachmentReference *                      attachments;
    uint32_t                                     input_count;
    VkAttachmentReference *                      input_attachments;
    uint32_t                                     color_count;