void*native_hardware_buffer=NULL;ArFrame_getHardwareBuffer(ar_session,ar_frame,&native_hardware_buffer);if((int64_t)native_hardware_buffer==0){// The hardware buffer isn't ready yet.return;}
Use the hardware buffer during Vulkan rendering
See vulkan_handler.cc for an example of how to render an AR application using Vulkan.
Supported devices
Vulkan rendering support is only available on Android API levels 27 and
above. Additionally, the device must support the VK_ANDROID_external_memory_android_hardware_buffer extension.
Require Vulkan in your app's manifest
Google Play uses <uses-feature> declared in your app manifest to filter your
app from devices that don't meet its hardware and software feature requirements.
Devices using Vulkan 1.0 might not support the required extension, but devices
compatible with Vulkan 1.1 must have the required extension starting in Android 10 (API level 29).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-28 UTC."],[[["ARCore can provide the camera image as an Android hardware buffer for efficient Vulkan rendering by setting `ArTextureUpdateMode` to `AR_TEXTURE_UPDATE_MODE_EXPOSE_HARDWARE_BUFFER`."],["This hardware buffer can be accessed using `ArFrame_getHardwareBuffer()` and bound to a Vulkan `VkImage` for rendering."],["Vulkan rendering with ARCore is supported on Android API levels 27 and above, requiring devices to support the `VK_ANDROID_external_memory_android_hardware_buffer` extension."],["To ensure compatibility, declare Vulkan requirements in your app's manifest using `\u003cuses-feature\u003e`, targeting devices with Vulkan 1.1 for guaranteed support on Android 10 and above."],["A sample implementation of Vulkan rendering with ARCore can be found in the `hello_ar_vulkan_c` sample app."]]],["To enable hardware buffer access, set `ArTextureUpdateMode` to `AR_TEXTURE_UPDATE_MODE_EXPOSE_HARDWARE_BUFFER` using `ArConfig_setTextureUpdateMode`. After calling `ArSession_update()`, use `ArFrame_getHardwareBuffer()` to obtain the `AHardwareBuffer`. If using the buffer beyond the next `ArSession_update()`, call `AHardwareBuffer_acquire()` and `AHardwareBuffer_release()`. Vulkan rendering is supported on Android API 27+ with the `VK_ANDROID_external_memory_android_hardware_buffer` extension. Incompatible devices will return an error.\n"]]