Fix dedicated allocations for protected images

Although shouldAlwaysUseDedicatedImageMemory() returns true for
protected images, this does not take effect because of the error
in if-else logic.

Bug: skia:9016
Change-Id: Iffdfdf5d045b38d846d438969747ded617d96739
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246916
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Emircan Uysaler 2019-10-07 18:30:38 -04:00 committed by Skia Commit-Bot
parent 0943c92aab
commit cdab9dfdf5

View File

@ -97,15 +97,17 @@ bool GrVkMemory::AllocAndBindImageMemory(const GrVkGpu* gpu,
GR_VK_CALL(gpu->vkInterface(), GetImageMemoryRequirements(gpu->device(), image, &memReqs));
AllocationPropertyFlags propFlags;
if (gpu->protectedContext()) {
propFlags = AllocationPropertyFlags::kProtected;
} else if (memReqs.size > kMaxSmallImageSize ||
if (memReqs.size > kMaxSmallImageSize ||
gpu->vkCaps().shouldAlwaysUseDedicatedImageMemory()) {
propFlags = AllocationPropertyFlags::kDedicatedAllocation;
} else {
propFlags = AllocationPropertyFlags::kNone;
}
if (gpu->protectedContext()) {
propFlags |= AllocationPropertyFlags::kProtected;
}
if (!allocator->allocateMemoryForImage(image, propFlags, &memory)) {
return false;
}