33// found in the LICENSE file.
44
55#include " impeller/renderer/backend/gles/sampler_gles.h"
6- #include < iostream>
76
87#include " impeller/renderer/backend/gles/formats_gles.h"
98#include " impeller/renderer/backend/gles/proc_table_gles.h"
@@ -20,19 +19,15 @@ bool SamplerGLES::IsValid() const {
2019 return true ;
2120}
2221
23- static GLint ToParam (MinMagFilter minmag_filter,
24- std::optional<MipFilter> mip_filter = std::nullopt ) {
25- if (!mip_filter.has_value ()) {
26- switch (minmag_filter) {
27- case MinMagFilter::kNearest :
28- return GL_NEAREST;
29- case MinMagFilter::kLinear :
30- return GL_LINEAR;
31- }
32- FML_UNREACHABLE ();
33- }
34-
35- switch (mip_filter.value ()) {
22+ static GLint ToParam (MinMagFilter minmag_filter, MipFilter mip_filter) {
23+ switch (mip_filter) {
24+ case MipFilter::kNone :
25+ switch (minmag_filter) {
26+ case MinMagFilter::kNearest :
27+ return GL_NEAREST;
28+ case MinMagFilter::kLinear :
29+ return GL_LINEAR;
30+ }
3631 case MipFilter::kNearest :
3732 switch (minmag_filter) {
3833 case MinMagFilter::kNearest :
@@ -74,17 +69,12 @@ bool SamplerGLES::ConfigureBoundTexture(const TextureGLES& texture,
7469 if (!target.has_value ()) {
7570 return false ;
7671 }
77- const auto & desc = GetDescriptor ();
78-
79- std::optional<MipFilter> mip_filter = std::nullopt ;
80- if (texture.GetTextureDescriptor ().mip_count > 1 ) {
81- mip_filter = desc.mip_filter ;
82- }
8372
73+ const auto & desc = GetDescriptor ();
8474 gl.TexParameteri (target.value (), GL_TEXTURE_MIN_FILTER,
85- ToParam (desc.min_filter , mip_filter));
75+ ToParam (desc.min_filter , desc. mip_filter ));
8676 gl.TexParameteri (target.value (), GL_TEXTURE_MAG_FILTER,
87- ToParam (desc.mag_filter ));
77+ ToParam (desc.mag_filter , MipFilter:: kNone ));
8878 gl.TexParameteri (target.value (), GL_TEXTURE_WRAP_S,
8979 ToAddressMode (desc.width_address_mode ));
9080 gl.TexParameteri (target.value (), GL_TEXTURE_WRAP_T,
0 commit comments