Vulkan: Support EGL_ANDROID_image_native_buffer on Android.
BUG=angleproject:2668
BUG=angleproject:3121
Change-Id: I0dfb2ec0737ebd963b0fadb78cf720a90874f00b
Reviewed-on: https://chromium-review.googlesource.com/c/1452264
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 4589451..4e18085 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -923,6 +923,18 @@
enabledDeviceExtensions.push_back(VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
}
+#if defined(ANGLE_PLATFORM_ANDROID)
+ if (getFeatures().supportsAndroidHardwareBuffer)
+ {
+ enabledDeviceExtensions.push_back(VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME);
+ enabledDeviceExtensions.push_back(
+ VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME);
+ InitExternalMemoryHardwareBufferANDROIDFunctions(mInstance);
+ }
+#else
+ ASSERT(!getFeatures().supportsAndroidHardwareBuffer);
+#endif
+
std::sort(enabledDeviceExtensions.begin(), enabledDeviceExtensions.end(), StrLess);
ANGLE_VK_TRY(displayVk, VerifyExtensionsPresent(deviceExtensionNames, enabledDeviceExtensions));
@@ -1181,6 +1193,11 @@
{
mFeatures.supportsIncrementalPresent = true;
}
+
+#if defined(ANGLE_PLATFORM_ANDROID)
+ mFeatures.supportsAndroidHardwareBuffer = ExtensionFound(
+ VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, deviceExtensionNames);
+#endif
}
void RendererVk::initPipelineCacheVkKey()