| Flutter Impeller |

sampler_descriptor.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_CORE_SAMPLER_DESCRIPTOR_H_
6 #define FLUTTER_IMPELLER_CORE_SAMPLER_DESCRIPTOR_H_
7
8 #include "impeller/base/comparable.h"
9 #include "impeller/core/formats.h"
10
11 namespace impeller {
12
13 class Context;
14
15 struct SamplerDescriptor final : public Comparable<SamplerDescriptor> {
16 MinMagFilter min_filter = MinMagFilter::kNearest;
17 MinMagFilter mag_filter = MinMagFilter::kNearest;
18 MipFilter mip_filter = MipFilter::kNearest;
19
20 SamplerAddressMode width_address_mode = SamplerAddressMode::kClampToEdge;
21 SamplerAddressMode height_address_mode = SamplerAddressMode::kClampToEdge;
22 SamplerAddressMode depth_address_mode = SamplerAddressMode::kClampToEdge;
23
24 std::string label = "NN Clamp Sampler";
25
26 SamplerDescriptor();
27
28 SamplerDescriptor(std::string label,
29 MinMagFilter min_filter,
30 MinMagFilter mag_filter,
31 MipFilter mip_filter);
32
33 // Comparable<SamplerDescriptor>
34 std::size_t GetHash() const override {
35 return fml::HashCombine(min_filter, mag_filter, mip_filter,
36 width_address_mode, height_address_mode,
37 depth_address_mode);
38 }
39
40 // Comparable<SamplerDescriptor>
41 bool IsEqual(const SamplerDescriptor& o) const override {
42 return min_filter == o.min_filter && mag_filter == o.mag_filter &&
43 mip_filter == o.mip_filter &&
44 width_address_mode == o.width_address_mode &&
45 height_address_mode == o.height_address_mode &&
46 depth_address_mode == o.depth_address_mode;
47 }
48 };
49
50 } // namespace impeller
51
52 #endif // FLUTTER_IMPELLER_CORE_SAMPLER_DESCRIPTOR_H_
impeller::SamplerAddressMode
SamplerAddressMode
Definition: formats.h:435
formats.h
impeller::SamplerAddressMode::kClampToEdge
@ kClampToEdge
impeller::SamplerDescriptor::GetHash
std::size_t GetHash() const override
Definition: sampler_descriptor.h:34
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:17
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:15
impeller::MipFilter::kNearest
@ kNearest
The nearst mipmap level is selected.
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:16
impeller::MipFilter
MipFilter
Options for selecting and filtering between mipmap levels.
Definition: formats.h:419
impeller::SamplerDescriptor::width_address_mode
SamplerAddressMode width_address_mode
Definition: sampler_descriptor.h:20
impeller::MinMagFilter
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
Definition: formats.h:409
impeller::SamplerDescriptor::depth_address_mode
SamplerAddressMode depth_address_mode
Definition: sampler_descriptor.h:22
impeller::SamplerDescriptor::mip_filter
MipFilter mip_filter
Definition: sampler_descriptor.h:18
impeller::Comparable
Definition: comparable.h:29
comparable.h
impeller::SamplerDescriptor::label
std::string label
Definition: sampler_descriptor.h:24
impeller::SamplerDescriptor::SamplerDescriptor
SamplerDescriptor()
impeller::SamplerDescriptor::height_address_mode
SamplerAddressMode height_address_mode
Definition: sampler_descriptor.h:21
impeller
Definition: aiks_blend_unittests.cc:18
impeller::SamplerDescriptor::IsEqual
bool IsEqual(const SamplerDescriptor &o) const override
Definition: sampler_descriptor.h:41