17 SamplerGLES::SamplerGLES(
const SamplerDescriptor& desc) : Sampler(desc) {}
19 SamplerGLES::~SamplerGLES() =
default;
22 switch (minmag_filter) {
23 case MinMagFilter::kNearest:
25 case MinMagFilter::kLinear:
33 case MipFilter::kBase:
35 case MipFilter::kNearest:
36 switch (minmag_filter) {
37 case MinMagFilter::kNearest:
38 return GL_NEAREST_MIPMAP_NEAREST;
39 case MinMagFilter::kLinear:
40 return GL_LINEAR_MIPMAP_NEAREST;
42 case MipFilter::kLinear:
43 switch (minmag_filter) {
44 case MinMagFilter::kNearest:
45 return GL_NEAREST_MIPMAP_LINEAR;
46 case MinMagFilter::kLinear:
47 return GL_LINEAR_MIPMAP_LINEAR;
54 bool supports_decal_sampler_address_mode) {
56 case SamplerAddressMode::kClampToEdge:
57 return GL_CLAMP_TO_EDGE;
58 case SamplerAddressMode::kRepeat:
60 case SamplerAddressMode::kMirror:
61 return GL_MIRRORED_REPEAT;
62 case SamplerAddressMode::kDecal:
63 if (supports_decal_sampler_address_mode) {
66 return GL_CLAMP_TO_EDGE;
72 bool SamplerGLES::ConfigureBoundTexture(
const TextureGLES& texture,
76 if (!target.has_value()) {
91 gl.TexParameteri(*target, GL_TEXTURE_MIN_FILTER, min_filter);
92 gl.TexParameteri(*target, GL_TEXTURE_MAG_FILTER, mag_filter);
101 if (*target != GL_TEXTURE_EXTERNAL_OES &&
103 const GLint max_level =
105 gl.TexParameteri(*target, GL_TEXTURE_MAX_LEVEL, max_level);
108 const auto supports_decal_mode =
116 gl.TexParameteri(*target, GL_TEXTURE_WRAP_S, wrap_s);
117 gl.TexParameteri(*target, GL_TEXTURE_WRAP_T, wrap_t);
122 const GLfloat border_color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
131 const uint32_t max_anisotropy =
133 if (max_anisotropy > 1) {
134 const GLfloat anisotropy[1] = {
static_cast<GLfloat
>(
const std::shared_ptr< const CapabilitiesGLES > & GetCapabilities() const
const TextureDescriptor & GetTextureDescriptor() const
static GLint ToAddressMode(SamplerAddressMode mode, bool supports_decal_sampler_address_mode)
static GLint ToParam(MinMagFilter minmag_filter, MipFilter mip_filter)
MipFilter
Options for selecting and filtering between mipmap levels.
constexpr std::optional< GLenum > ToTextureTarget(TextureType type)
MinMagFilter
Describes how the texture should be sampled when the texture is being shrunk (minified) or expanded (...
#define IMPELLER_GL_TEXTURE_BORDER_COLOR
#define IMPELLER_GL_CLAMP_TO_BORDER
#define IMPELLER_GL_TEXTURE_MAX_ANISOTROPY
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode