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;}
Cómo usar el búfer de hardware durante la renderización de Vulkan
Consulta vulkan_handler.cc para ver un ejemplo de cómo renderizar una aplicación de RA con Vulkan.
Dispositivos compatibles
La compatibilidad con la renderización de Vulkan solo está disponible en los niveles de API de Android 27 y versiones posteriores. Además, el dispositivo debe admitir la extensión VK_ANDROID_external_memory_android_hardware_buffer.
Cómo exigir Vulkan en el manifiesto de tu app
Google Play usa <uses-feature> declarado en el manifiesto de tu app para aplicarle filtrado y excluir dispositivos que no cumplan con sus requisitos de las funciones de software y hardware.
Es posible que los dispositivos que usan Vulkan 1.0 no admitan la extensión requerida, pero los dispositivos compatibles con Vulkan 1.1 deben tener la extensión requerida a partir de Android 10 (nivel de API 29).
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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"]]