Commit 9a608c0e by Yuly Novikov Committed by Commit Bot

Vulkan: request coherent memory for StagingImage

Otherwise vkInvalidateMappedMemoryRanges is needed, if allocated memory is not coherent, which was happening on Nexus 5X and was caught by validation layers. BUG=angleproject:2314 TEST=all angle_end2end_tests pass on Nexus 5X Change-Id: I008aae45b99c6ca87029ff1614913fae32f66ec3 Reviewed-on: https://chromium-review.googlesource.com/900203Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent df9ad2be
...@@ -847,8 +847,13 @@ Error StagingImage::init(VkDevice device, ...@@ -847,8 +847,13 @@ Error StagingImage::init(VkDevice device,
mImage.getMemoryRequirements(device, &memoryRequirements); mImage.getMemoryRequirements(device, &memoryRequirements);
// Find the right kind of memory index. // Find the right kind of memory index.
// TODO(ynovikov): better approach would be to request just visible memory,
// and call vkInvalidateMappedMemoryRanges if the allocated memory is not coherent.
// This would solve potential issues of:
// 1) not having (enough) coherent memory and 2) coherent memory being slower
uint32_t memoryIndex = memoryProperties.findCompatibleMemoryIndex( uint32_t memoryIndex = memoryProperties.findCompatibleMemoryIndex(
memoryRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); memoryRequirements.memoryTypeBits,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT);
VkMemoryAllocateInfo allocateInfo; VkMemoryAllocateInfo allocateInfo;
allocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; allocateInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment