Commit 84b31c03 by Mohan Maiya Committed by Commit Bot

Vulkan: Fix bug in VkImageFormatListCreateInfoKHR

On some vendors VVL throws the following error, snippet only - [ VUID-VkImageViewCreateInfo-pNext-01585 ] Validation Error ... image was created with a VkImageFormatListCreateInfo in pNext of vkImageCreateInfo, but none of the formats match the VkImageViewCreateInfo::format ... The Vulkan spec states: If a VkImageFormatListCreateInfo structure was included in the pNext chain of the VkImageCreateInfo structure used when creating image and VkImageFormatListCreateInfo::viewFormatCount is not zero then format must be one of the formats in VkImageFormatListCreateInfo::pViewFormats. It looks like VkImageFormatListCreateInfoKHR::pViewFormats needs to contain all formats including the format of the VkImage itself. Bug: angleproject:5281 Change-Id: I93c6900d99791ef4f9f116cb114f068e0a318bf4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2849566Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 3839fa5b
......@@ -3922,13 +3922,16 @@ angle::Result ImageHelper::initExternal(Context *context,
RendererVk *rendererVk = context->getRenderer();
VkImageFormatListCreateInfoKHR imageFormatListInfo = {};
angle::FormatID imageFormat = format.actualImageFormatID;
angle::FormatID imageListFormat = format.actualImageFormat().isSRGB
? ConvertToLinear(imageFormat)
: ConvertToSRGB(imageFormat);
VkFormat imageListVkFormat = vk::GetVkFormatFromFormatID(imageListFormat);
angle::FormatID additionalFormat = format.actualImageFormat().isSRGB
? ConvertToLinear(imageFormat)
: ConvertToSRGB(imageFormat);
constexpr uint32_t kImageListFormatCount = 2;
VkFormat imageListFormats[kImageListFormatCount];
imageListFormats[0] = vk::GetVkFormatFromFormatID(imageFormat);
imageListFormats[1] = vk::GetVkFormatFromFormatID(additionalFormat);
if (rendererVk->getFeatures().supportsImageFormatList.enabled &&
rendererVk->haveSameFormatFeatureBits(imageFormat, imageListFormat))
rendererVk->haveSameFormatFeatureBits(imageFormat, additionalFormat))
{
imageFormatListEnabled = true;
......@@ -3939,8 +3942,8 @@ angle::Result ImageHelper::initExternal(Context *context,
// VkImage
imageFormatListInfo.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR;
imageFormatListInfo.pNext = externalImageCreateInfo;
imageFormatListInfo.viewFormatCount = 1;
imageFormatListInfo.pViewFormats = &imageListVkFormat;
imageFormatListInfo.viewFormatCount = kImageListFormatCount;
imageFormatListInfo.pViewFormats = imageListFormats;
}
if (imageFormatListEnabledOut)
......
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