Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
yuv_conversion_library_vk.h
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#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_YUV_CONVERSION_LIBRARY_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_YUV_CONVERSION_LIBRARY_VK_H_
7
9
10namespace impeller {
11
12class DeviceHolderVK;
13
14//------------------------------------------------------------------------------
15/// @brief Due the way the Vulkan spec. treats "identically defined"
16/// conversions, creating two conversion with identical descriptors,
17/// using one with the image and the other with the sampler, is
18/// invalid use.
19///
20/// A conversion library hashes and caches identical descriptors to
21/// de-duplicate conversions.
22///
23/// There can only be one conversion library (the constructor is
24/// private to force this) and it found in the context.
25///
27 public:
29
31
33
34 //----------------------------------------------------------------------------
35 /// @brief Get a conversion for the given descriptor. If there is already
36 /// a conversion created for an equivalent descriptor, a reference
37 /// to that descriptor is returned instead.
38 ///
39 /// @param[in] desc The descriptor.
40 ///
41 /// @return The conversion. A previously created conversion if one was
42 /// present and a new one if not. A newly created conversion is
43 /// cached for subsequent accesses.
44 ///
45 std::shared_ptr<YUVConversionVK> GetConversion(
46 const YUVConversionDescriptorVK& chain);
47
48 private:
49 friend class ContextVK;
50
51 using ConversionsMap = std::unordered_map<YUVConversionDescriptorVK,
52 std::shared_ptr<YUVConversionVK>,
55
56 std::weak_ptr<DeviceHolderVK> device_holder_;
57 Mutex conversions_mutex_;
58 ConversionsMap conversions_ IPLR_GUARDED_BY(conversions_mutex_);
59
60 explicit YUVConversionLibraryVK(std::weak_ptr<DeviceHolderVK> device_holder);
61};
62
63} // namespace impeller
64
65#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_YUV_CONVERSION_LIBRARY_VK_H_
Due the way the Vulkan spec. treats "identically defined" conversions, creating two conversion with i...
YUVConversionLibraryVK & operator=(const YUVConversionLibraryVK &)=delete
std::shared_ptr< YUVConversionVK > GetConversion(const YUVConversionDescriptorVK &chain)
Get a conversion for the given descriptor. If there is already a conversion created for an equivalent...
YUVConversionLibraryVK(const YUVConversionLibraryVK &)=delete
vk::StructureChain< vk::SamplerYcbcrConversionCreateInfo > YUVConversionDescriptorVK
#define IPLR_GUARDED_BY(x)