| Flutter Impeller |

ahb_texture_source_vk.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.h"
6
7 #include "impeller/renderer/backend/vulkan/allocator_vk.h"
8 #include "impeller/renderer/backend/vulkan/context_vk.h"
9 #include "impeller/renderer/backend/vulkan/texture_source_vk.h"
10 #include "impeller/renderer/backend/vulkan/yuv_conversion_library_vk.h"
11
12 namespace impeller {
13
14 using AHBProperties = vk::StructureChain<
15 // For VK_ANDROID_external_memory_android_hardware_buffer
16 vk::AndroidHardwareBufferPropertiesANDROID,
17 // For VK_ANDROID_external_memory_android_hardware_buffer
18 vk::AndroidHardwareBufferFormatPropertiesANDROID>;
19
20 static vk::UniqueImage CreateVKImageWrapperForAndroidHarwareBuffer(
21 const vk::Device& device,
22 const AHBProperties& ahb_props,
23 const AHardwareBuffer_Desc& ahb_desc) {
24 const auto& ahb_format =
25 ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
26
27 vk::StructureChain<vk::ImageCreateInfo,
28 // For VK_KHR_external_memory
29 vk::ExternalMemoryImageCreateInfo,
30 // For VK_ANDROID_external_memory_android_hardware_buffer
31 vk::ExternalFormatANDROID>
32 image_chain;
33
34 auto& image_info = image_chain.get<vk::ImageCreateInfo>();
35
36 vk::ImageUsageFlags image_usage_flags;
37 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE) {
38 image_usage_flags |= vk::ImageUsageFlagBits::eSampled;
39 }
40 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER) {
41 image_usage_flags |= vk::ImageUsageFlagBits::eColorAttachment;
42 }
43 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY) {
44 image_usage_flags |= vk::ImageUsageFlagBits::eColorAttachment;
45 image_usage_flags |= vk::ImageUsageFlagBits::eInputAttachment;
46 image_usage_flags |= vk::ImageUsageFlagBits::eTransferDst;
47 }
48
49 vk::ImageCreateFlags image_create_flags;
50 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT) {
51 image_create_flags |= vk::ImageCreateFlagBits::eProtected;
52 }
53 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) {
54 image_create_flags |= vk::ImageCreateFlagBits::eCubeCompatible;
55 }
56
57 image_info.imageType = vk::ImageType::e2D;
58 image_info.format = ahb_format.format;
59 image_info.extent.width = ahb_desc.width;
60 image_info.extent.height = ahb_desc.height;
61 image_info.extent.depth = 1;
62 image_info.mipLevels =
63 (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
64 ? ISize{ahb_desc.width, ahb_desc.height}.MipCount()
65 : 1u;
66 image_info.arrayLayers = ahb_desc.layers;
67 image_info.samples = vk::SampleCountFlagBits::e1;
68 image_info.tiling = vk::ImageTiling::eOptimal;
69 image_info.usage = image_usage_flags;
70 image_info.flags = image_create_flags;
71 image_info.sharingMode = vk::SharingMode::eExclusive;
72 image_info.initialLayout = vk::ImageLayout::eUndefined;
73
74 image_chain.get<vk::ExternalMemoryImageCreateInfo>().handleTypes =
75 vk::ExternalMemoryHandleTypeFlagBits::eAndroidHardwareBufferANDROID;
76
77 // If the format isn't natively supported by Vulkan (i.e, be a part of the
78 // base vkFormat enum), an untyped "external format" must be specified when
79 // creating the image and the image views. Usually includes YUV formats.
80 if (ahb_format.format == vk::Format::eUndefined) {
81 image_chain.get<vk::ExternalFormatANDROID>().externalFormat =
82 ahb_format.externalFormat;
83 } else {
84 image_chain.unlink<vk::ExternalFormatANDROID>();
85 }
86
87 auto image = device.createImageUnique(image_chain.get());
88 if (image.result != vk::Result::eSuccess) {
89 VALIDATION_LOG << "Could not create image for external buffer: "
90 << vk::to_string(image.result);
91 return {};
92 }
93
94 return std::move(image.value);
95 }
96
97 static vk::UniqueDeviceMemory ImportVKDeviceMemoryFromAndroidHarwareBuffer(
98 const vk::Device& device,
99 const vk::PhysicalDevice& physical_device,
100 const vk::Image& image,
101 struct AHardwareBuffer* hardware_buffer,
102 const AHBProperties& ahb_props) {
103 vk::PhysicalDeviceMemoryProperties memory_properties;
104 physical_device.getMemoryProperties(&memory_properties);
105 int memory_type_index = AllocatorVK::FindMemoryTypeIndex(
106 ahb_props.get().memoryTypeBits, memory_properties);
107 if (memory_type_index < 0) {
108 VALIDATION_LOG << "Could not find memory type of external image.";
109 return {};
110 }
111
112 vk::StructureChain<vk::MemoryAllocateInfo,
113 // Core in 1.1
114 vk::MemoryDedicatedAllocateInfo,
115 // For VK_ANDROID_external_memory_android_hardware_buffer
116 vk::ImportAndroidHardwareBufferInfoANDROID>
117 memory_chain;
118
119 auto& mem_alloc_info = memory_chain.get<vk::MemoryAllocateInfo>();
120 mem_alloc_info.allocationSize = ahb_props.get().allocationSize;
121 mem_alloc_info.memoryTypeIndex = memory_type_index;
122
123 auto& dedicated_alloc_info =
124 memory_chain.get<vk::MemoryDedicatedAllocateInfo>();
125 dedicated_alloc_info.image = image;
126
127 auto& ahb_import_info =
128 memory_chain.get<vk::ImportAndroidHardwareBufferInfoANDROID>();
129 ahb_import_info.buffer = hardware_buffer;
130
131 auto device_memory = device.allocateMemoryUnique(memory_chain.get());
132 if (device_memory.result != vk::Result::eSuccess) {
133 VALIDATION_LOG << "Could not allocate device memory for external image : "
134 << vk::to_string(device_memory.result);
135 return {};
136 }
137
138 return std::move(device_memory.value);
139 }
140
141 static std::shared_ptr<YUVConversionVK> CreateYUVConversion(
142 const ContextVK& context,
143 const AHBProperties& ahb_props) {
144 YUVConversionDescriptorVK conversion_chain;
145
146 const auto& ahb_format =
147 ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
148
149 const bool supports_linear_filtering =
150 !!(ahb_format.formatFeatures &
151 vk::FormatFeatureFlagBits::eSampledImageYcbcrConversionLinearFilter);
152
153 auto& conversion_info = conversion_chain.get();
154
155 conversion_info.format = ahb_format.format;
156 conversion_info.ycbcrModel = ahb_format.suggestedYcbcrModel;
157 conversion_info.ycbcrRange = ahb_format.suggestedYcbcrRange;
158 conversion_info.components = ahb_format.samplerYcbcrConversionComponents;
159 conversion_info.xChromaOffset = ahb_format.suggestedXChromaOffset;
160 conversion_info.yChromaOffset = ahb_format.suggestedYChromaOffset;
161 conversion_info.chromaFilter =
162 supports_linear_filtering ? vk::Filter::eLinear : vk::Filter::eNearest;
163 conversion_info.forceExplicitReconstruction = false;
164
165 if (conversion_info.format == vk::Format::eUndefined) {
166 auto& external_format = conversion_chain.get<vk::ExternalFormatANDROID>();
167 external_format.externalFormat = ahb_format.externalFormat;
168 } else {
169 conversion_chain.unlink<vk::ExternalFormatANDROID>();
170 }
171
172 return context.GetYUVConversionLibrary()->GetConversion(conversion_chain);
173 }
174
175 static vk::UniqueImageView CreateVKImageView(
176 const vk::Device& device,
177 const vk::Image& image,
178 const vk::SamplerYcbcrConversion& yuv_conversion,
179 const AHBProperties& ahb_props,
180 const AHardwareBuffer_Desc& ahb_desc) {
181 const auto& ahb_format =
182 ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
183
184 vk::StructureChain<vk::ImageViewCreateInfo,
185 // Core in 1.1
186 vk::SamplerYcbcrConversionInfo>
187 view_chain;
188
189 auto& view_info = view_chain.get();
190
191 view_info.image = image;
192 view_info.viewType = vk::ImageViewType::e2D;
193 view_info.format = ahb_format.format;
194 view_info.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
195 view_info.subresourceRange.baseMipLevel = 0u;
196 view_info.subresourceRange.baseArrayLayer = 0u;
197 view_info.subresourceRange.levelCount =
198 (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
199 ? ISize{ahb_desc.width, ahb_desc.height}.MipCount()
200 : 1u;
201 view_info.subresourceRange.layerCount = ahb_desc.layers;
202
203 // We need a custom YUV conversion only if we don't recognize the format.
204 if (view_info.format == vk::Format::eUndefined) {
205 view_chain.get<vk::SamplerYcbcrConversionInfo>().conversion =
206 yuv_conversion;
207 } else {
208 view_chain.unlink<vk::SamplerYcbcrConversionInfo>();
209 }
210
211 auto image_view = device.createImageViewUnique(view_info);
212 if (image_view.result != vk::Result::eSuccess) {
213 VALIDATION_LOG << "Could not create external image view: "
214 << vk::to_string(image_view.result);
215 return {};
216 }
217
218 return std::move(image_view.value);
219 }
220
221 static PixelFormat ToPixelFormat(AHardwareBuffer_Format format) {
222 switch (format) {
223 case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM:
224 return PixelFormat::kR8G8B8A8UNormInt;
225 case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT:
226 return PixelFormat::kR16G16B16A16Float;
227 case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT:
228 return PixelFormat::kD24UnormS8Uint;
229 case AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT:
230 return PixelFormat::kD32FloatS8UInt;
231 case AHARDWAREBUFFER_FORMAT_S8_UINT:
232 return PixelFormat::kS8UInt;
233 case AHARDWAREBUFFER_FORMAT_R8_UNORM:
234 return PixelFormat::kR8UNormInt;
235 case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM:
236 case AHARDWAREBUFFER_FORMAT_R16G16_UINT:
237 case AHARDWAREBUFFER_FORMAT_D32_FLOAT:
238 case AHARDWAREBUFFER_FORMAT_R16_UINT:
239 case AHARDWAREBUFFER_FORMAT_D24_UNORM:
240 case AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420:
241 case AHARDWAREBUFFER_FORMAT_YCbCr_P010:
242 case AHARDWAREBUFFER_FORMAT_BLOB:
243 case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM:
244 case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM:
245 case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
246 case AHARDWAREBUFFER_FORMAT_D16_UNORM:
247 case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM:
248 // Not understood by the rest of Impeller. Use a placeholder but create
249 // the native image and image views using the right external format.
250 break;
251 }
252 return PixelFormat::kR8G8B8A8UNormInt;
253 }
254
255 static TextureType ToTextureType(const AHardwareBuffer_Desc& ahb_desc) {
256 if (ahb_desc.layers == 1u) {
257 return TextureType::kTexture2D;
258 }
259 if (ahb_desc.layers % 6u == 0 &&
260 (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP)) {
261 return TextureType::kTextureCube;
262 }
263 // Our texture types seem to understand external OES textures. Should these be
264 // wired up instead?
265 return TextureType::kTexture2D;
266 }
267
268 static TextureDescriptor ToTextureDescriptor(
269 const AHardwareBuffer_Desc& ahb_desc) {
270 const auto ahb_size = ISize{ahb_desc.width, ahb_desc.height};
271 TextureDescriptor desc;
272 // We are not going to touch hardware buffers on the CPU or use them as
273 // transient attachments. Just treat them as device private.
274 desc.storage_mode = StorageMode::kDevicePrivate;
275 desc.format =
276 ToPixelFormat(static_cast<AHardwareBuffer_Format>(ahb_desc.format));
277 desc.size = ahb_size;
278 desc.type = ToTextureType(ahb_desc);
279 desc.sample_count = SampleCount::kCount1;
280 desc.compression_type = CompressionType::kLossless;
281 desc.mip_count = (ahb_desc.usage & AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE)
282 ? ahb_size.MipCount()
283 : 1u;
284 if (ahb_desc.usage & AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY) {
285 desc.usage = TextureUsage::kRenderTarget;
286 }
287 return desc;
288 }
289
290 AHBTextureSourceVK::AHBTextureSourceVK(
291 const std::shared_ptr<Context>& p_context,
292 struct AHardwareBuffer* ahb,
293 const AHardwareBuffer_Desc& ahb_desc)
294 : TextureSourceVK(ToTextureDescriptor(ahb_desc)) {
295 if (!p_context) {
296 return;
297 }
298
299 const auto& context = ContextVK::Cast(*p_context);
300
301 const auto& device = context.GetDevice();
302 const auto& physical_device = context.GetPhysicalDevice();
303
304 AHBProperties ahb_props;
305
306 if (device.getAndroidHardwareBufferPropertiesANDROID(ahb, &ahb_props.get()) !=
307 vk::Result::eSuccess) {
308 VALIDATION_LOG << "Could not determine properties of the Android hardware "
309 "buffer.";
310 return;
311 }
312
313 const auto& ahb_format =
314 ahb_props.get<vk::AndroidHardwareBufferFormatPropertiesANDROID>();
315
316 // Create an image to refer to our external image.
317 auto image =
318 CreateVKImageWrapperForAndroidHarwareBuffer(device, ahb_props, ahb_desc);
319 if (!image) {
320 return;
321 }
322
323 // Create a device memory allocation to refer to our external image.
324 auto device_memory = ImportVKDeviceMemoryFromAndroidHarwareBuffer(
325 device, physical_device, image.get(), ahb, ahb_props);
326 if (!device_memory) {
327 return;
328 }
329
330 // Bind the image to the image memory.
331 if (auto result = device.bindImageMemory(image.get(), device_memory.get(), 0);
332 result != vk::Result::eSuccess) {
333 VALIDATION_LOG << "Could not bind external device memory to image : "
334 << vk::to_string(result);
335 return;
336 }
337
338 // Figure out how to perform YUV conversions.
339 auto yuv_conversion = CreateYUVConversion(context, ahb_props);
340 if (!yuv_conversion || !yuv_conversion->IsValid()) {
341 return;
342 }
343
344 // Create image view for the newly created image.
345 auto image_view = CreateVKImageView(device, //
346 image.get(), //
347 yuv_conversion->GetConversion(), //
348 ahb_props, //
349 ahb_desc //
350 );
351 if (!image_view) {
352 return;
353 }
354
355 needs_yuv_conversion_ = ahb_format.format == vk::Format::eUndefined;
356 device_memory_ = std::move(device_memory);
357 image_ = std::move(image);
358 yuv_conversion_ = std::move(yuv_conversion);
359 image_view_ = std::move(image_view);
360
361 #ifdef IMPELLER_DEBUG
362 context.SetDebugName(device_memory_.get(), "AHB Device Memory");
363 context.SetDebugName(image_.get(), "AHB Image");
364 context.SetDebugName(yuv_conversion_->GetConversion(), "AHB YUV Conversion");
365 context.SetDebugName(image_view_.get(), "AHB ImageView");
366 #endif // IMPELLER_DEBUG
367
368 is_valid_ = true;
369 }
370
371 AHBTextureSourceVK::AHBTextureSourceVK(
372 const std::shared_ptr<Context>& context,
373 std::unique_ptr<android::HardwareBuffer> backing_store,
374 bool is_swapchain_image)
375 : AHBTextureSourceVK(context,
376 backing_store->GetHandle(),
377 backing_store->GetAndroidDescriptor()) {
378 backing_store_ = std::move(backing_store);
379 is_swapchain_image_ = is_swapchain_image;
380 }
381
382 // |TextureSourceVK|
383 AHBTextureSourceVK::~AHBTextureSourceVK() = default;
384
385 bool AHBTextureSourceVK::IsValid() const {
386 return is_valid_;
387 }
388
389 // |TextureSourceVK|
390 vk::Image AHBTextureSourceVK::GetImage() const {
391 return image_.get();
392 }
393
394 // |TextureSourceVK|
395 vk::ImageView AHBTextureSourceVK::GetImageView() const {
396 return image_view_.get();
397 }
398
399 // |TextureSourceVK|
400 vk::ImageView AHBTextureSourceVK::GetRenderTargetView() const {
401 return image_view_.get();
402 }
403
404 // |TextureSourceVK|
405 bool AHBTextureSourceVK::IsSwapchainImage() const {
406 return is_swapchain_image_;
407 }
408
409 // |TextureSourceVK|
410 std::shared_ptr<YUVConversionVK> AHBTextureSourceVK::GetYUVConversion() const {
411 return needs_yuv_conversion_ ? yuv_conversion_ : nullptr;
412 }
413
414 const android::HardwareBuffer* AHBTextureSourceVK::GetBackingStore() const {
415 return backing_store_.get();
416 }
417
418 } // namespace impeller
impeller::AHBTextureSourceVK::GetBackingStore
const android::HardwareBuffer * GetBackingStore() const
Definition: ahb_texture_source_vk.cc:414
impeller::PixelFormat::kS8UInt
@ kS8UInt
impeller::AllocatorVK::FindMemoryTypeIndex
static int32_t FindMemoryTypeIndex(uint32_t memory_type_bits_requirement, vk::PhysicalDeviceMemoryProperties &memory_properties)
Select a matching memory type for the given [memory_type_bits_requirement], or -1 if none is found.
Definition: allocator_vk.cc:175
impeller::TextureSourceVK
Abstract base class that represents a vkImage and an vkImageView.
Definition: texture_source_vk.h:28
impeller::AHBTextureSourceVK::IsValid
bool IsValid() const
Definition: ahb_texture_source_vk.cc:385
impeller::AHBTextureSourceVK::AHBTextureSourceVK
AHBTextureSourceVK(const std::shared_ptr< Context > &context, struct AHardwareBuffer *hardware_buffer, const AHardwareBuffer_Desc &hardware_buffer_desc)
Definition: ahb_texture_source_vk.cc:290
allocator_vk.h
impeller::AHBTextureSourceVK::~AHBTextureSourceVK
~AHBTextureSourceVK() override
external_format
GLenum external_format
Definition: blit_command_gles.cc:126
impeller::PixelFormat::kR8UNormInt
@ kR8UNormInt
impeller::AHBTextureSourceVK::GetImageView
vk::ImageView GetImageView() const override
Retrieve the image view used for sampling/blitting/compute with this texture source.
Definition: ahb_texture_source_vk.cc:395
texture_source_vk.h
impeller::TextureDescriptor::format
PixelFormat format
Definition: texture_descriptor.h:41
impeller::PixelFormat::kR8G8B8A8UNormInt
@ kR8G8B8A8UNormInt
impeller::TextureType
TextureType
Definition: formats.h:262
impeller::TextureDescriptor::mip_count
size_t mip_count
Definition: texture_descriptor.h:43
yuv_conversion_library_vk.h
impeller::TextureUsage::kRenderTarget
@ kRenderTarget
impeller::CreateVKImageWrapperForAndroidHarwareBuffer
static vk::UniqueImage CreateVKImageWrapperForAndroidHarwareBuffer(const vk::Device &device, const AHBProperties &ahb_props, const AHardwareBuffer_Desc &ahb_desc)
Definition: ahb_texture_source_vk.cc:20
impeller::TextureDescriptor::sample_count
SampleCount sample_count
Definition: texture_descriptor.h:45
impeller::ImportVKDeviceMemoryFromAndroidHarwareBuffer
static vk::UniqueDeviceMemory ImportVKDeviceMemoryFromAndroidHarwareBuffer(const vk::Device &device, const vk::PhysicalDevice &physical_device, const vk::Image &image, struct AHardwareBuffer *hardware_buffer, const AHBProperties &ahb_props)
Definition: ahb_texture_source_vk.cc:97
impeller::TextureDescriptor::usage
TextureUsageMask usage
Definition: texture_descriptor.h:44
impeller::PixelFormat::kD32FloatS8UInt
@ kD32FloatS8UInt
impeller::PixelFormat
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition: formats.h:99
impeller::TextureDescriptor::type
TextureType type
Definition: texture_descriptor.h:40
impeller::TSize
Definition: size.h:19
impeller::android::HardwareBuffer
A wrapper for AHardwareBuffer https://developer.android.com/ndk/reference/group/a-hardware-buffer.
Definition: hardware_buffer.h:95
impeller::StorageMode::kDevicePrivate
@ kDevicePrivate
impeller::CompressionType::kLossless
@ kLossless
impeller::PixelFormat::kD24UnormS8Uint
@ kD24UnormS8Uint
impeller::TextureType::kTextureCube
@ kTextureCube
impeller::PixelFormat::kR16G16B16A16Float
@ kR16G16B16A16Float
impeller::ToTextureType
constexpr GLenum ToTextureType(TextureType type)
Definition: formats_gles.h:171
impeller::AHBTextureSourceVK::GetImage
vk::Image GetImage() const override
Get the image handle for this texture source.
Definition: ahb_texture_source_vk.cc:390
impeller::CreateYUVConversion
static std::shared_ptr< YUVConversionVK > CreateYUVConversion(const ContextVK &context, const AHBProperties &ahb_props)
Definition: ahb_texture_source_vk.cc:141
impeller::TextureType::kTexture2D
@ kTexture2D
impeller::TSize::width
Type width
Definition: size.h:22
impeller::ContextVK
Definition: context_vk.h:42
impeller::TextureDescriptor::size
ISize size
Definition: texture_descriptor.h:42
impeller::ToTextureDescriptor
static TextureDescriptor ToTextureDescriptor(const AHardwareBuffer_Desc &ahb_desc)
Definition: ahb_texture_source_vk.cc:268
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::AHBTextureSourceVK
A texture source that wraps an instance of AHardwareBuffer.
Definition: ahb_texture_source_vk.h:32
impeller::BackendCast< ContextVK, Context >::Cast
static ContextVK & Cast(Context &base)
Definition: backend_cast.h:13
ahb_texture_source_vk.h
impeller::SampleCount::kCount1
@ kCount1
impeller::ContextVK::GetYUVConversionLibrary
const std::shared_ptr< YUVConversionLibraryVK > & GetYUVConversionLibrary() const
Definition: context_vk.cc:637
impeller::TextureDescriptor::storage_mode
StorageMode storage_mode
Definition: texture_descriptor.h:39
impeller::AHBProperties
vk::StructureChain< vk::AndroidHardwareBufferPropertiesANDROID, vk::AndroidHardwareBufferFormatPropertiesANDROID > AHBProperties
Definition: ahb_texture_source_vk.cc:18
impeller::TextureDescriptor
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
Definition: texture_descriptor.h:38
context_vk.h
impeller::YUVConversionDescriptorVK
vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo > YUVConversionDescriptorVK
Definition: yuv_conversion_vk.h:30
impeller::AHBTextureSourceVK::GetRenderTargetView
vk::ImageView GetRenderTargetView() const override
Retrieve the image view used for render target attachments with this texture source.
Definition: ahb_texture_source_vk.cc:400
impeller::TextureDescriptor::compression_type
CompressionType compression_type
Definition: texture_descriptor.h:46
impeller
Definition: allocation.cc:12
impeller::AHBTextureSourceVK::IsSwapchainImage
bool IsSwapchainImage() const override
Determines if swapchain image. That is, an image used as the root render target.
Definition: ahb_texture_source_vk.cc:405
impeller::CreateVKImageView
static vk::UniqueImageView CreateVKImageView(const vk::Device &device, const vk::Image &image, const vk::SamplerYcbcrConversion &yuv_conversion, const AHBProperties &ahb_props, const AHardwareBuffer_Desc &ahb_desc)
Definition: ahb_texture_source_vk.cc:175
impeller::ToPixelFormat
static PixelFormat ToPixelFormat(AHardwareBuffer_Format format)
Definition: ahb_texture_source_vk.cc:221
impeller::AHBTextureSourceVK::GetYUVConversion
std::shared_ptr< YUVConversionVK > GetYUVConversion() const override
When sampling from textures whose formats are not known to Vulkan, a custom conversion is necessary t...
Definition: ahb_texture_source_vk.cc:410