16 SamplerGLES::SamplerGLES(
const SamplerDescriptor& desc) : Sampler(desc) {}
18 SamplerGLES::~SamplerGLES() =
default;
21 switch (minmag_filter) {
22 case MinMagFilter::kNearest:
24 case MinMagFilter::kLinear:
32 case MipFilter::kBase:
34 case MipFilter::kNearest:
35 switch (minmag_filter) {
36 case MinMagFilter::kNearest:
37 return GL_NEAREST_MIPMAP_NEAREST;
38 case MinMagFilter::kLinear:
39 return GL_LINEAR_MIPMAP_NEAREST;
41 case MipFilter::kLinear:
42 switch (minmag_filter) {
43 case MinMagFilter::kNearest:
44 return GL_NEAREST_MIPMAP_LINEAR;
45 case MinMagFilter::kLinear:
46 return GL_LINEAR_MIPMAP_LINEAR;
53 bool supports_decal_sampler_address_mode) {
55 case SamplerAddressMode::kClampToEdge:
56 return GL_CLAMP_TO_EDGE;
57 case SamplerAddressMode::kRepeat:
59 case SamplerAddressMode::kMirror:
60 return GL_MIRRORED_REPEAT;
61 case SamplerAddressMode::kDecal:
62 if (supports_decal_sampler_address_mode) {
65 return GL_CLAMP_TO_EDGE;
71 bool SamplerGLES::ConfigureBoundTexture(
const TextureGLES& texture,
75 <<
"Texture mip count is > 1, but the mipmap has not been generated. "
76 "Texture can not be sampled safely.";
82 if (!target.has_value()) {
97 gl.TexParameteri(*target, GL_TEXTURE_MIN_FILTER, min_filter);
98 gl.TexParameteri(*target, GL_TEXTURE_MAG_FILTER, mag_filter);
100 const auto supports_decal_mode =
108 gl.TexParameteri(*target, GL_TEXTURE_WRAP_S, wrap_s);
109 gl.TexParameteri(*target, GL_TEXTURE_WRAP_T, wrap_t);
114 const GLfloat border_color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const std::shared_ptr< const CapabilitiesGLES > & GetCapabilities() const
const TextureDescriptor & GetTextureDescriptor() const
bool NeedsMipmapGeneration() 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
SamplerAddressMode width_address_mode
SamplerAddressMode height_address_mode