Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
sampler_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
6
10
11namespace impeller {
12
13SamplerLibraryVK::SamplerLibraryVK(
14 const std::weak_ptr<DeviceHolderVK>& device_holder)
15 : device_holder_(device_holder) {}
16
17SamplerLibraryVK::~SamplerLibraryVK() = default;
18
19static const std::unique_ptr<const Sampler> kNullSampler = nullptr;
20
21const std::unique_ptr<const Sampler>& SamplerLibraryVK::GetSampler(
22 SamplerDescriptor desc) {
23 auto found = samplers_.find(desc);
24 if (found != samplers_.end()) {
25 return found->second;
26 }
27 auto device_holder = device_holder_.lock();
28 if (!device_holder || !device_holder->GetDevice()) {
29 return kNullSampler;
30 }
31 return (samplers_[desc] =
32 std::make_unique<SamplerVK>(device_holder->GetDevice(), desc));
33}
34
35} // namespace impeller
static const std::unique_ptr< const Sampler > kNullSampler