| Flutter Impeller |

yuv_conversion_library_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/yuv_conversion_library_vk.h"
6
7 #include "impeller/base/validation.h"
8 #include "impeller/renderer/backend/vulkan/device_holder_vk.h"
9
10 namespace impeller {
11
12 YUVConversionLibraryVK::YUVConversionLibraryVK(
13 std::weak_ptr<DeviceHolderVK> device_holder)
14 : device_holder_(std::move(device_holder)) {}
15
16 YUVConversionLibraryVK::~YUVConversionLibraryVK() = default;
17
18 std::shared_ptr<YUVConversionVK> YUVConversionLibraryVK::GetConversion(
19 const YUVConversionDescriptorVK& desc) {
20 Lock lock(conversions_mutex_);
21 auto found = conversions_.find(desc);
22 if (found != conversions_.end()) {
23 return found->second;
24 }
25 auto device_holder = device_holder_.lock();
26 if (!device_holder) {
27 VALIDATION_LOG << "Context loss during creation of YUV conversion.";
28 return nullptr;
29 }
30 return (conversions_[desc] = std::shared_ptr<YUVConversionVK>(
31 new YUVConversionVK(device_holder->GetDevice(), desc)));
32 }
33
34 } // namespace impeller
impeller::YUVConversionLibraryVK::YUVConversionLibraryVK
YUVConversionLibraryVK(const YUVConversionLibraryVK &)=delete
impeller::Lock
Definition: thread.h:72
yuv_conversion_library_vk.h
validation.h
device_holder_vk.h
impeller::YUVConversionVK
It is sometimes necessary to deal with formats not native to Vulkan. In such cases,...
Definition: yuv_conversion_vk.h:51
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
std
Definition: comparable.h:95
impeller::YUVConversionDescriptorVK
vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo > YUVConversionDescriptorVK
Definition: yuv_conversion_vk.h:30
impeller
Definition: allocation.cc:12