Skip to content

Commit 2fff171

Browse files
jorgep31415facebook-github-bot
authored andcommitted
Enable AHB extension for Android builds (#5729)
Summary: Pull Request resolved: #5729 Upcoming changes will allow using the ET-VK runtime for Vulkan buffer/image creation around AHardwareBuffers. ghstack-source-id: 245150387 exported-using-ghexport Reviewed By: SS-JIA Differential Revision: D63327846 fbshipit-source-id: 0cb3c03d25586ad0aaaae2f6128534d0804f7e20
1 parent 55cc430 commit 2fff171

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

backends/vulkan/runtime/vk_api/Adapter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ VkDevice create_logical_device(
7070
#ifdef VK_KHR_portability_subset
7171
VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME,
7272
#endif /* VK_KHR_portability_subset */
73+
#ifdef VK_ANDROID_external_memory_android_hardware_buffer
74+
VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME,
75+
#endif /* VK_ANDROID_external_memory_android_hardware_buffer */
7376
VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
7477
VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
7578
VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME,

backends/vulkan/runtime/vk_api/vk_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010

1111
#ifdef USE_VULKAN_WRAPPER
1212
#ifdef USE_VULKAN_VOLK
13+
#ifdef VK_ANDROID_external_memory_android_hardware_buffer
14+
#include <android/hardware_buffer.h>
15+
#include <vulkan/vulkan.h>
16+
#include <vulkan/vulkan_android.h>
17+
#endif /* VK_ANDROID_external_memory_android_hardware_buffer */
18+
1319
#include <volk.h>
1420
#else
1521
#include <vulkan_wrapper.h>

backends/vulkan/targets.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,18 @@ def define_common_targets(is_fbcode = False):
142142
VK_API_DEPS += [
143143
"fbsource//third-party/volk:volk",
144144
]
145+
VK_API_DEPS += select({
146+
"DEFAULT": [],
147+
"ovr_config//os:android": ["fbsource//third-party/toolchains:android"],
148+
})
145149
VK_API_PREPROCESSOR_FLAGS += [
146150
"-DUSE_VULKAN_WRAPPER",
147151
"-DUSE_VULKAN_VOLK",
148152
]
153+
VK_API_PREPROCESSOR_FLAGS += select({
154+
"DEFAULT": [],
155+
"ovr_config//os:android": ["-DVK_ANDROID_external_memory_android_hardware_buffer"],
156+
})
149157
else:
150158
VK_API_DEPS += [
151159
"fbsource//third-party/swiftshader:swiftshader_vk_headers",

0 commit comments

Comments
 (0)