vk/meta: Fix usage flags for image-wrapped-buffers
authorChad Versace <chad.versace@intel.com>
Wed, 7 Oct 2015 01:34:37 +0000 (18:34 -0700)
committerChad Versace <chad.versace@intel.com>
Wed, 7 Oct 2015 04:22:18 +0000 (21:22 -0700)
In make_image_for_buffer(), use VK_IMAGE_USAGE_SAMPLED_BIT when
transferring from the buffer and use VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
when transferring to the buffer.

src/vulkan/anv_meta.c

index 4abd8d3821354ccd1f9cd026b893c49bf0dff8d7..7646071276ac767d184f2f559c1369293335a528 100644 (file)
@@ -1304,6 +1304,7 @@ void anv_CmdBlitImage(
 
 static VkImage
 make_image_for_buffer(VkDevice vk_device, VkBuffer vk_buffer, VkFormat format,
+                      VkImageUsageFlags usage,
                       const VkBufferImageCopy *copy)
 {
    ANV_FROM_HANDLE(anv_buffer, buffer, vk_buffer);
@@ -1326,7 +1327,7 @@ make_image_for_buffer(VkDevice vk_device, VkBuffer vk_buffer, VkFormat format,
          .arraySize = 1,
          .samples = 1,
          .tiling = VK_IMAGE_TILING_LINEAR,
-         .usage = VK_IMAGE_USAGE_SAMPLED_BIT,
+         .usage = usage,
          .flags = 0,
       }, &vk_image);
    assert(result == VK_SUCCESS);
@@ -1368,8 +1369,7 @@ void anv_CmdCopyBufferToImage(
       }
 
       VkImage srcImage = make_image_for_buffer(vk_device, srcBuffer,
-                                               proxy_format,
-                                               &pRegions[r]);
+            proxy_format, VK_IMAGE_USAGE_SAMPLED_BIT, &pRegions[r]);
 
       struct anv_image_view src_iview;
       anv_image_view_init(&src_iview, cmd_buffer->device,
@@ -1490,8 +1490,7 @@ void anv_CmdCopyImageToBuffer(
       }
 
       VkImage destImage = make_image_for_buffer(vk_device, destBuffer,
-                                                dest_format,
-                                                &pRegions[r]);
+            dest_format, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &pRegions[r]);
 
       struct anv_image_view dest_iview;
       anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,