| 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 SamplerLibraryGLES::SamplerLibraryGLES(bool supports_decal_sampler_address_mode)
15 : supports_decal_sampler_address_mode_(
16 supports_decal_sampler_address_mode) {}
17
18 // |SamplerLibrary|
19 SamplerLibraryGLES::~SamplerLibraryGLES() = default;
20
21 // |SamplerLibrary|
22 std::shared_ptr<const Sampler> SamplerLibraryGLES::GetSampler(
23 SamplerDescriptor descriptor) {
24 if (!supports_decal_sampler_address_mode_ &&
25 (descriptor.width_address_mode == SamplerAddressMode::kDecal ||
26 descriptor.height_address_mode == SamplerAddressMode::kDecal ||
27 descriptor.depth_address_mode == SamplerAddressMode::kDecal)) {
28 VALIDATION_LOG << "SamplerAddressMode::kDecal is not supported by the "
29 "current OpenGLES backend.";
30 return nullptr;
31 }
32
33 auto found = samplers_.find(descriptor);
34 if (found != samplers_.end()) {
35 return found->second;
36 }
37 return samplers_[descriptor] =
38 std::shared_ptr<SamplerGLES>(new SamplerGLES(descriptor));
39 }
40
41 } // 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:67
impeller::SamplerLibraryGLES::~SamplerLibraryGLES
~SamplerLibraryGLES() override
config.h
impeller::SamplerDescriptor::height_address_mode
SamplerAddressMode height_address_mode
Definition: sampler_descriptor.h:21
impeller
Definition: aiks_context.cc:10
impeller::SamplerAddressMode::kDecal
@ kDecal
decal sampling mode is only supported on devices that pass the Capabilities.SupportsDecalSamplerAddre...