From cf603714cb0e2e5c5dfe7309b8938c910933aafa Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 6 Oct 2015 18:34:37 -0700 Subject: [PATCH] vk/meta: Fix usage flags for image-wrapped-buffers 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 4abd8d38213..7646071276a 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -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, -- 2.30.2