From e06b07a992c64dc834592f21a4c3df023e8457cf Mon Sep 17 00:00:00 2001 From: Juston Li Date: Fri, 27 Sep 2024 18:17:16 +0000 Subject: [PATCH] Vulkan: populate ycbcr conversionDesc for yuv VkFormats For this case, the external format has a vulkan equivalent VkFormat and is YUV, so conversionDesc needs to be populated. YcbcrConversionDesc::update() expects externalFormat to be 0 in this case since it has an equivalent. Bug: b/368429977 Bug: b/352595520 Change-Id: Ifdae7a539555d78bbbf9d11cdbb946cb815c7709 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5896250 Reviewed-by: Charlie Lao Reviewed-by: Shahbaz Youssefi Commit-Queue: Charlie Lao --- .../android/HardwareBufferImageSiblingVkAndroid.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp b/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp index 07abd77794d..2057b897104 100644 --- a/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp +++ b/src/libANGLE/renderer/vulkan/android/HardwareBufferImageSiblingVkAndroid.cpp @@ -392,7 +392,10 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk // If not renderable, don't burn a slot on it. vkFormat = &renderer->getFormat(angle::FormatID::NONE); } + } + if (isExternal || imageFormat.isYUV) + { // Note from Vulkan spec: Since GL_OES_EGL_image_external does not require the same sampling // and conversion calculations as Vulkan does, achieving identical results between APIs may // not be possible on some implementations. @@ -411,12 +414,12 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk : vk::YcbcrLinearFilterSupport::Unsupported; conversionDesc.update( - renderer, bufferFormatProperties.externalFormat, + renderer, isExternal ? bufferFormatProperties.externalFormat : 0, bufferFormatProperties.suggestedYcbcrModel, bufferFormatProperties.suggestedYcbcrRange, bufferFormatProperties.suggestedXChromaOffset, bufferFormatProperties.suggestedYChromaOffset, vk::kDefaultYCbCrChromaFilter, - bufferFormatProperties.samplerYcbcrConversionComponents, angle::FormatID::NONE, - linearFilterSupported); + bufferFormatProperties.samplerYcbcrConversionComponents, + isExternal ? angle::FormatID::NONE : imageFormat.id, linearFilterSupported); } const gl::TextureType textureType = AhbDescUsageToTextureType(ahbDescription, layerCount);