| Flutter Impeller |

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
5 #include "impeller/renderer/backend/vulkan/sampler_library_vk.h"
6
7 #include "impeller/renderer/backend/vulkan/context_vk.h"
8 #include "impeller/renderer/backend/vulkan/formats_vk.h"
9 #include "impeller/renderer/backend/vulkan/sampler_vk.h"
10
11 namespace impeller {
12
13 SamplerLibraryVK::SamplerLibraryVK(
14 const std::weak_ptr<DeviceHolderVK>& device_holder)
15 : device_holder_(device_holder) {}
16
17 SamplerLibraryVK::~SamplerLibraryVK() = default;
18
19 static const std::unique_ptr<const Sampler> kNullSampler = nullptr;
20
21 const 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
formats_vk.h
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
sampler_vk.h
impeller::kNullSampler
static const std::unique_ptr< const Sampler > kNullSampler
Definition: sampler_library_gles.cc:14
context_vk.h
sampler_library_vk.h
impeller::SamplerLibraryVK::~SamplerLibraryVK
~SamplerLibraryVK() override
impeller
Definition: allocation.cc:12