Fix protected image allocation in createVkImageForBackendSurface()

GrVkGpu::createVkImageForBackendSurface() was trying to allocate
protected CPU-accessible buffer. That operation fails because
protected memory is not CPU-accessible. That buffer is used to
initialize image content with vkCmdCopyBufferToImage().
vkCmdCopyBufferToImage() allows source buffer to be non-protected
even when commandBuffer is protected. Updated buffer allocating
logic to always use non-protected buffer.

Bug: b/147809344
Change-Id: Id6b89ceb5391c57eb3076884a0d144dec9c43540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264937
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
This commit is contained in:
Sergey Ulanov 2020-01-16 16:10:42 -08:00 committed by Skia Commit-Bot
parent 08842e9ec4
commit c38c00a9b0

View File

@ -1733,7 +1733,7 @@ bool GrVkGpu::createVkImageForBackendSurface(VkFormat vkFormat,
VkBufferCreateInfo bufInfo;
memset(&bufInfo, 0, sizeof(VkBufferCreateInfo));
bufInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
bufInfo.flags = fProtectedContext == GrProtected::kYes ? VK_BUFFER_CREATE_PROTECTED_BIT : 0;
bufInfo.flags = 0;
bufInfo.size = combinedBufferSize;
bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;