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 
9 
10 namespace impeller {
11 
12 class Context;
13 
14 struct SamplerDescriptor final {
18 
22 
23  std::string_view label = "NN Clamp Sampler";
24 
26 
27  SamplerDescriptor(std::string_view label,
31 
32  static uint64_t ToKey(const SamplerDescriptor& d) {
33  static_assert(sizeof(MinMagFilter) == 1);
34  static_assert(sizeof(MipFilter) == 1);
35  static_assert(sizeof(SamplerAddressMode) == 1);
36 
37  return static_cast<uint64_t>(d.min_filter) << 0 |
38  static_cast<uint64_t>(d.mag_filter) << 8 |
39  static_cast<uint64_t>(d.mip_filter) << 16 |
40  static_cast<uint64_t>(d.width_address_mode) << 24 |
41  static_cast<uint64_t>(d.height_address_mode) << 32 |
42  static_cast<uint64_t>(d.depth_address_mode) << 40;
43  }
44 };
45 
46 } // namespace impeller
47 
48 #endif // FLUTTER_IMPELLER_CORE_SAMPLER_DESCRIPTOR_H_
SamplerAddressMode
Definition: formats.h:441
MipFilter
Options for selecting and filtering between mipmap levels.
Definition: formats.h:425
@ kNearest
The nearst mipmap level is selected.
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
Definition: formats.h:415
@ kNearest
Select nearest to the sample point. Most widely supported.
SamplerAddressMode depth_address_mode
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode
static uint64_t ToKey(const SamplerDescriptor &d)