| Flutter Impeller |

Public Member Functions | Friends | List of all members
impeller::SamplerGLES Class Referencefinal

`#include <sampler_gles.h>`

Inheritance diagram for impeller::SamplerGLES:

## Public Member Functions
| ~SamplerGLES ()
bool | ConfigureBoundTexture (const TextureGLES &texture, const ProcTableGLES &gl) const
Public Member Functions inherited from impeller::Sampler
virtual | ~Sampler ()
const SamplerDescriptor & | GetDescriptor () const

## Friends
class | SamplerLibraryGLES

## Additional Inherited Members
Static Public Member Functions inherited from impeller::BackendCast< SamplerGLES, Sampler >
static SamplerGLES & | Cast (Sampler &base)
static const SamplerGLES & | Cast (const Sampler &base)
static SamplerGLES * | Cast (Sampler *base)
static const SamplerGLES * | Cast (const Sampler *base)
Protected Member Functions inherited from impeller::Sampler
| Sampler (SamplerDescriptor desc)
Protected Attributes inherited from impeller::Sampler
SamplerDescriptor | desc_

## Detailed Description

Definition at line 17 of file sampler_gles.h.

## Constructor & Destructor Documentation

## ◆ ~SamplerGLES()

impeller::SamplerGLES::~SamplerGLES | ( |  | ) |
| default

## Member Function Documentation

## ◆ ConfigureBoundTexture()

bool impeller::SamplerGLES::ConfigureBoundTexture | ( | const TextureGLES & | texture,
|  | const ProcTableGLES & | gl
| ) |  | const

Definition at line 70 of file sampler_gles.cc.

71 {
72 if (!IsValid()) {
73 return false;
74 }
75
76 if (texture.NeedsMipmapGeneration()) {
77 VALIDATION_LOG
78 << "Texture mip count is > 1, but the mipmap has not been generated. "
79 "Texture can not be sampled safely.";
80 return false;
81 }
82
83 auto target = ToTextureTarget(texture.GetTextureDescriptor().type);
84
85 if (!target.has_value()) {
86 return false;
87 }
88 const auto& desc = GetDescriptor();
89
90 std::optional<MipFilter> mip_filter = std::nullopt;
91 if (texture.GetTextureDescriptor().mip_count > 1) {
92 mip_filter = desc.mip_filter;
93 }
94
95 gl.TexParameteri(target.value(), GL_TEXTURE_MIN_FILTER,
96 ToParam(desc.min_filter, mip_filter));
97 gl.TexParameteri(target.value(), GL_TEXTURE_MAG_FILTER,
98 ToParam(desc.mag_filter));
99 gl.TexParameteri(target.value(), GL_TEXTURE_WRAP_S,
100 ToAddressMode(desc.width_address_mode));
101 gl.TexParameteri(target.value(), GL_TEXTURE_WRAP_T,
102 ToAddressMode(desc.height_address_mode));
103 return true;
104 }

References impeller::Sampler::GetDescriptor(), impeller::Texture::GetTextureDescriptor(), impeller::TextureDescriptor::mip_count, impeller::Texture::NeedsMipmapGeneration(), impeller::ToAddressMode(), impeller::ToParam(), impeller::ToTextureTarget(), impeller::TextureDescriptor::type, and VALIDATION_LOG.

## Friends And Related Function Documentation

## ◆ SamplerLibraryGLES

friend class SamplerLibraryGLES
| friend

Definition at line 26 of file sampler_gles.h.

The documentation for this class was generated from the following files:

- impeller/renderer/backend/gles/sampler_gles.h
- impeller/renderer/backend/gles/sampler_gles.cc

impeller::ToAddressMode
static GLint ToAddressMode(SamplerAddressMode mode)
Definition: sampler_gles.cc:56
impeller::ToParam
static constexpr int ToParam(size_t index)
Definition: archive_statement.cc:75
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:60
impeller::Sampler::GetDescriptor
const SamplerDescriptor & GetDescriptor() const
Definition: sampler.cc:13
impeller::ToTextureTarget
constexpr std::optional< GLenum > ToTextureTarget(TextureType type)
Definition: formats_gles.h:183