Vulkan: always specify TRANSFER_DST_BIT usage when creating images

This patch adds VK_IMAGE_USAGE_TRANSFER_DST_BIT usage when creating
Vulkan images because when we do resource initialization with
vkCmdClearColorImage() and vkCmdClearDepthStencilImage(), the image must
have been created with VK_IMAGE_USAGE_TRANSFER_DST_BIT usage flag
according to Vulkan SPEC.

BUG=dawn:171
TEST=dawn_end2end_tests

Change-Id: Iaba6c04c6942354cc6be502eeee04457d3f43ba7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8100
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao 2019-06-13 00:07:42 +00:00 committed by Commit Bot service account
parent 3dc8bf4c6f
commit 87ab2f96d9
1 changed files with 5 additions and 0 deletions

View File

@ -301,6 +301,11 @@ namespace dawn_native { namespace vulkan {
createInfo.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
}
// We always set VK_IMAGE_USAGE_TRANSFER_DST_BIT unconditionally beause the Vulkan images
// that are used in vkCmdClearColorImage() must have been created with this flag, which is
// also required for the implementation of robust resource initialization.
createInfo.usage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
if (device->fn.CreateImage(device->GetVkDevice(), &createInfo, nullptr, &mHandle) !=
VK_SUCCESS) {
ASSERT(false);