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;}
Usar o buffer de hardware durante a renderização do Vulkan
Consulte vulkan_handler.cc para conferir um exemplo de como renderizar um app de RA usando o Vulkan.
Dispositivos compatíveis
O suporte à renderização do Vulkan está disponível apenas nos níveis 27 e
mais recentes da API do Android. Além disso, o dispositivo precisa oferecer suporte à extensão VK_ANDROID_external_memory_android_hardware_buffer.
Exigir o Vulkan no manifesto do app
O Google Play usa <uses-feature> declarado no manifesto do app para filtrar o
app de dispositivos que não atendem aos requisitos de recursos de hardware e software.
Os dispositivos que usam o Vulkan 1.0 podem não oferecer suporte à extensão necessária, mas os dispositivos
compatíveis com o Vulkan 1.1 precisam ter a extensão necessária a partir do Android 10 (nível 29 da API).
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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"]]