Commit bcdd4e58 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Fix validation errors with YUV

Had several validation errors with YUV ImageTests using Vulkan back-end. This corrects those issues and tests now pass. Initializing YUV AHardwareBuffers requires Android API 29. The CI bots are not yet to Android 29 so this must be tested locally by compiling with the appropriate api level in args.gn: android32_ndk_api_level = 29 android64_ndk_api_level = 29 Test: ImageTestES3.SourceYUVAHBTargetExternalRGBSampleInitData Note: Some tests can run at api 26: ImageTestES3.ClearYUVAHB ImageTestES3.YUVValidation Bug: angleproject:4852 Bug: b/172649538 Bug: b/175021871 Change-Id: I383d24faa9911f77a71bd9b764232ad519b54e9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2530454 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 73d4d9fa
......@@ -183,12 +183,17 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk
if (bufferFormatProperties.format == VK_FORMAT_UNDEFINED)
{
ANGLE_VK_CHECK(displayVk, bufferFormatProperties.externalFormat != 0, VK_ERROR_UNKNOWN);
externalFormat.externalFormat = bufferFormatProperties.externalFormat;
// VkImageCreateInfo struct: If the pNext chain includes a VkExternalFormatANDROID structure
// whose externalFormat member is not 0, usage must not include any usages except
// VK_IMAGE_USAGE_SAMPLED_BIT
usage = VK_IMAGE_USAGE_SAMPLED_BIT;
// If the pNext chain includes a VkExternalFormatANDROID structure whose externalFormat
// member is not 0, tiling must be VK_IMAGE_TILING_OPTIMAL
imageTilingMode = VK_IMAGE_TILING_OPTIMAL;
}
// With the introduction of sRGB related GLES extensions any texture could be respecified
......
......@@ -3921,6 +3921,13 @@ angle::Result ImageHelper::initLayerImageViewImpl(
yuvConversionInfo.pNext = nullptr;
yuvConversionInfo.conversion = mYuvConversionSampler.get().getHandle();
AddToPNextChain(&viewInfo, &yuvConversionInfo);
// VUID-VkImageViewCreateInfo-image-02399
// If image has an external format, format must be VK_FORMAT_UNDEFINED
if (mExternalFormat)
{
viewInfo.format = VK_FORMAT_UNDEFINED;
}
}
ANGLE_VK_TRY(context, imageViewOut->init(context->getDevice(), viewInfo));
return angle::Result::Continue;
......
......@@ -2034,14 +2034,12 @@ TEST_P(ImageTest, SourceYUVAHBTargetExternalRGBSampleInitData)
std::cout << "Test skipped: !ANGLE_AHARDWARE_BUFFER_LOCK_PLANES_SUPPORT." << std::endl;
return;
#else
// Multiple issues sampling AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420 in the Vulkan backend:
// http://issuetracker.google.com/172649538
ANGLE_SKIP_TEST_IF(IsVulkan());
EGLWindow *window = getEGLWindow();
ANGLE_SKIP_TEST_IF(!hasOESExt() || !hasBaseExt() || !has2DTextureExt());
ANGLE_SKIP_TEST_IF(!hasAndroidImageNativeBufferExt() || !hasAndroidHardwareBufferSupport());
// http://issuetracker.google.com/175021871
ANGLE_SKIP_TEST_IF(IsPixel2() || IsPixel2XL());
// 3 planes of data
GLubyte dataY[4] = {7, 51, 197, 231};
......
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