5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_ANDROID_AHB_TEXTURE_SOURCE_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_ANDROID_AHB_TEXTURE_SOURCE_VK_H_
14#include <android/hardware_buffer_jni.h>
35 struct AHardwareBuffer* hardware_buffer,
36 const AHardwareBuffer_Desc& hardware_buffer_desc);
39 std::unique_ptr<android::HardwareBuffer> backing_store,
40 bool is_swapchain_image);
53 uint32_t array_layer)
const override;
67 vk::AndroidHardwareBufferPropertiesANDROID,
69 vk::AndroidHardwareBufferFormatPropertiesANDROID>;
73 vk::SamplerYcbcrConversionInfo>;
79 const AHardwareBuffer_Desc& ahb_desc);
84 const vk::Image&
image,
85 const std::shared_ptr<YUVConversionVK>& yuv_conversion_wrapper,
87 const AHardwareBuffer_Desc& ahb_desc);
90 std::unique_ptr<android::HardwareBuffer> backing_store_;
91 vk::UniqueDeviceMemory device_memory_ = {};
92 vk::UniqueImage image_ = {};
93 vk::UniqueImageView image_view_ = {};
94 std::shared_ptr<YUVConversionVK> yuv_conversion_ = {};
95 bool needs_yuv_conversion_ =
false;
96 bool is_swapchain_image_ =
false;
97 bool is_valid_ =
false;
A texture source that wraps an instance of AHardwareBuffer.
vk::StructureChain< vk::ImageViewCreateInfo, vk::SamplerYcbcrConversionInfo > ImageViewInfo
vk::ImageView GetRenderTargetView(uint32_t mip_level, uint32_t array_layer) const override
Retrieve the image view used to attach a specific subresource of this texture as a render target.
bool IsSwapchainImage() const override
Determines if swapchain image. That is, an image used as the root render target.
vk::Image GetImage() const override
Get the image handle for this texture source.
static vk::UniqueImage CreateVKImageWrapperForAndroidHarwareBuffer(const vk::Device &device, const AHBProperties &ahb_props, const AHardwareBuffer_Desc &ahb_desc)
Create a VkImage that wraps an Android hardware buffer.
const android::HardwareBuffer * GetBackingStore() const
std::shared_ptr< YUVConversionVK > GetYUVConversion() const override
When sampling from textures whose formats are not known to Vulkan, a custom conversion is necessary t...
vk::StructureChain< vk::AndroidHardwareBufferPropertiesANDROID, vk::AndroidHardwareBufferFormatPropertiesANDROID > AHBProperties
AHBTextureSourceVK(const std::shared_ptr< Context > &context, struct AHardwareBuffer *hardware_buffer, const AHardwareBuffer_Desc &hardware_buffer_desc)
~AHBTextureSourceVK() override
vk::ImageView GetImageView() const override
Retrieve the image view used for sampling/blitting/compute with this texture source.
static ImageViewInfo CreateImageViewInfo(const vk::Image &image, const std::shared_ptr< YUVConversionVK > &yuv_conversion_wrapper, const AHBProperties &ahb_props, const AHardwareBuffer_Desc &ahb_desc)
Abstract base class that represents a vkImage and an vkImageView.
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
FlutterVulkanImage * image
std::shared_ptr< ContextGLES > context