Vulkan: Remove MSRTT assertion in the presence of OOM

When the MSRTT transient multisampled image is created, the emulated
clear staged update is removed (as it's also staged for the single
sampled image).  This was done after allocating memory for the image,
which can fail, leaving the update staged and leading to an ASSERT
failure when the texture is used.

Technically, the texture should not be used, and that's a Chrome bug
where the OOM result from ANGLE is being ignored.  This change makes
sure the staged update is removed before allocating memory so the
multisampled image is in a more consistent state.

Bug: chromium:1263046
Change-Id: Ida8923ccbc517f740d76b4c2880086a039fa8a1f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251580
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Shahbaz Youssefi 2021-10-28 11:00:03 -04:00 коммит произвёл Angle LUCI CQ
Родитель 694c50124e
Коммит 32b3c96317
1 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -4729,20 +4729,19 @@ angle::Result ImageHelper::initImplicitMultisampledRenderToTexture(
resolveImage.getLevelCount(), resolveImage.getLayerCount(),
isRobustResourceInitEnabled, nullptr, hasProtectedContent));
// Remove the emulated format clear from the multisampled image if any. There is one already
// staged on the resolve image if needed.
removeStagedUpdates(context, getFirstAllocatedLevel(), getLastAllocatedLevel());
const VkMemoryPropertyFlags kMultisampledMemoryFlags =
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
(hasLazilyAllocatedMemory ? VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT : 0) |
(hasProtectedContent ? VK_MEMORY_PROPERTY_PROTECTED_BIT : 0);
// If this ever fails, this code should be modified to retry creating the image without the
// TRANSIENT flag.
ANGLE_TRY(initMemory(context, hasProtectedContent, memoryProperties, kMultisampledMemoryFlags));
// Remove the emulated format clear from the multisampled image if any. There is one already
// staged on the resolve image if needed.
removeStagedUpdates(context, getFirstAllocatedLevel(), getLastAllocatedLevel());
return angle::Result::Continue;
// If this ever fails, it can be retried without the LAZILY_ALLOCATED flag (which will probably
// still fail), but ideally that means GL_EXT_multisampled_render_to_texture should not be
// advertized on this platform in the first place.
return initMemory(context, hasProtectedContent, memoryProperties, kMultisampledMemoryFlags);
}
VkImageAspectFlags ImageHelper::getAspectFlags() const