anv/meta: Remove redundancies in do_buffer_copy()
authorNanley Chery <nanley.g.chery@intel.com>
Sat, 27 Feb 2016 21:29:04 +0000 (13:29 -0800)
committerNanley Chery <nanley.g.chery@intel.com>
Thu, 3 Mar 2016 19:24:42 +0000 (11:24 -0800)
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/intel/vulkan/anv_meta_blit.c

index 9d41add6079adf028e3794dafd09f03a527c0aa9..478b1997172947ceea8bda8ab7d3975e92d1503c 100644 (file)
@@ -446,39 +446,29 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
    anv_image_from_handle(dest_image)->bo = dest;
    anv_image_from_handle(dest_image)->offset = dest_offset;
 
+   VkImageViewCreateInfo iview_info = {
+      .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+      .image = 0, /* TEMPLATE */
+      .viewType = VK_IMAGE_VIEW_TYPE_2D,
+      .format = copy_format,
+      .subresourceRange = {
+         .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+         .baseMipLevel = 0,
+         .levelCount = 1,
+         .baseArrayLayer = 0,
+         .layerCount = 1
+      },
+   };
+
    struct anv_image_view src_iview;
+   iview_info.image = src_image;
    anv_image_view_init(&src_iview, cmd_buffer->device,
-      &(VkImageViewCreateInfo) {
-         .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
-         .image = src_image,
-         .viewType = VK_IMAGE_VIEW_TYPE_2D,
-         .format = copy_format,
-         .subresourceRange = {
-            .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
-            .baseMipLevel = 0,
-            .levelCount = 1,
-            .baseArrayLayer = 0,
-            .layerCount = 1
-         },
-      },
-      cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT);
+      &iview_info, cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT);
 
    struct anv_image_view dest_iview;
+   iview_info.image = dest_image;
    anv_image_view_init(&dest_iview, cmd_buffer->device,
-      &(VkImageViewCreateInfo) {
-         .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
-         .image = dest_image,
-         .viewType = VK_IMAGE_VIEW_TYPE_2D,
-         .format = copy_format,
-         .subresourceRange = {
-            .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
-            .baseMipLevel = 0,
-            .levelCount = 1,
-            .baseArrayLayer = 0,
-            .layerCount = 1,
-         },
-      },
-      cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
+      &iview_info, cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
 
    meta_emit_blit(cmd_buffer,
                   anv_image_from_handle(src_image),