简体   繁体   中英

how to write to android hardware buffer in vulkan?

In OpenGL, the texture of which memory is imported by android hardware buffer can be used as sample image and color attachments. However, when I try to use texture of which memory is imported from android hardware buffer, it seems than it can sampled from the texture successfully. But when writing to the external memory, it does not work as expected.So how to write to android hardware buffer directly in vulkan?

I consulted the documentation specification of vulkan. In the following link, https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#memory-external-handle-types in chapter of 11.2.17, i found the specification said "Vulkan can import Android hardware buffers that have external formats, but since the image contents are in an undiscoverable and possibly proprietary representation, images with external formats must only be used as sampled images, must only be sampled with a sampler that has Y′CBCR conversion enabled, and must have optimal tiling".Is that means that Android hardware buffers that have external formats cannot be used as color attactments to be write?

Based on the specs vulkan consulted, that means that Android hardware buffers with external formats cannot be used as color attachments to write to. However, this doesn't mean that those hardware buffers can't be used at all. Instead, the hardware buffer can be used as the sampled image, and the image must be sampled with a sampler that has Y'CBCR conversion enabled, and must have optimal tiling. So if you want to use that hardware buffer as a color attachment to write to, you'll have to find another way to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM