| Flutter Impeller |

sampler_library_gles.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/gles/sampler_library_gles.h"
6
7 #include "impeller/base/config.h"
8 #include "impeller/base/validation.h"
9 #include "impeller/core/formats.h"
10 #include "impeller/renderer/backend/gles/sampler_gles.h"
11
12 namespace impeller {
13
14 static const std::unique_ptr<const Sampler> kNullSampler = nullptr;
15
16 SamplerLibraryGLES::SamplerLibraryGLES(bool supports_decal_sampler_address_mode)
17 : supports_decal_sampler_address_mode_(
18 supports_decal_sampler_address_mode) {}
19
20 // |SamplerLibrary|
21 SamplerLibraryGLES::~SamplerLibraryGLES() = default;
22
23 // |SamplerLibrary|
24 const std::unique_ptr<const Sampler>& SamplerLibraryGLES::GetSampler(
25 SamplerDescriptor descriptor) {
26 if (!supports_decal_sampler_address_mode_ &&
27 (descriptor.width_address_mode == SamplerAddressMode::kDecal ||
28 descriptor.height_address_mode == SamplerAddressMode::kDecal ||
29 descriptor.depth_address_mode == SamplerAddressMode::kDecal)) {
30 VALIDATION_LOG << "SamplerAddressMode::kDecal is not supported by the "
31 "current OpenGLES backend.";
32 return kNullSampler;
33 }
34
35 auto found = samplers_.find(descriptor);
36 if (found != samplers_.end()) {
37 return found->second;
38 }
39 return (samplers_[descriptor] =
40 std::unique_ptr<SamplerGLES>(new SamplerGLES(descriptor)));
41 }
42
43 } // namespace impeller
formats.h
validation.h
sampler_gles.h
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
sampler_library_gles.h
impeller::SamplerDescriptor::width_address_mode
SamplerAddressMode width_address_mode
Definition: sampler_descriptor.h:20
impeller::SamplerDescriptor::depth_address_mode
SamplerAddressMode depth_address_mode
Definition: sampler_descriptor.h:22
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::SamplerLibraryGLES::~SamplerLibraryGLES
~SamplerLibraryGLES() override
impeller::kNullSampler
static const std::unique_ptr< const Sampler > kNullSampler
Definition: sampler_library_gles.cc:14
config.h
impeller::SamplerDescriptor::height_address_mode
SamplerAddressMode height_address_mode
Definition: sampler_descriptor.h:21
impeller
Definition: aiks_blend_unittests.cc:18
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...