15 return AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
22 AHardwareBuffer_Desc ahb_desc = {};
23 ahb_desc.width = desc.size.width;
24 ahb_desc.height = desc.size.height;
28 ahb_desc.usage |= AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER;
31 ahb_desc.usage |= AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY;
34 ahb_desc.usage |= AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
41 return GetProcTable().AHardwareBuffer_isSupported(&desc) != 0u;
45 : descriptor_(descriptor),
48 VALIDATION_LOG <<
"The hardware buffer descriptor is not allocatable.";
55 proc_table.AHardwareBuffer_allocate(&android_descriptor_, &
buffer);
91 return android_descriptor_;
107 uint64_t out_id = 0u;
119 AHardwareBuffer_Desc desc = {};
struct AHardwareBuffer AHardwareBuffer
void reset(const T &value=Traits::InvalidValue())
HardwareBuffer(HardwareBufferDescriptor descriptor)
static bool IsAvailableOnPlatform()
const HardwareBufferDescriptor & GetDescriptor() const
AHardwareBuffer * GetHandle() const
const AHardwareBuffer_Desc & GetAndroidDescriptor() const
static std::optional< AHardwareBuffer_Desc > Describe(AHardwareBuffer *buffer)
std::optional< uint64_t > GetSystemUniqueID() const
Get the system wide unique ID of the hardware buffer if possible. This is only available on Android A...
static const uint8_t buffer[]
uint32_t uint32_t * format
#define FML_UNREACHABLE()
const ProcTable & GetProcTable()
static AHardwareBuffer_Desc ToAHardwareBufferDesc(const HardwareBufferDescriptor &desc)
static AHardwareBuffer_Format ToAHardwareBufferFormat(HardwareBufferFormat format)
constexpr TSize Max(const TSize &o) const
A descriptor use to specify hardware buffer allocations.
static HardwareBufferDescriptor MakeForSwapchainImage(const ISize &size)
Create a descriptor of the given size that is suitable for use as a swapchain image.
bool IsAllocatable() const
If hardware buffers can be created using this descriptor. Allocatable descriptors may still cause fai...
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.