New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] change default sampler descriptor to use nearest mip level and remove kNone #40460
[Impeller] change default sampler descriptor to use nearest mip level and remove kNone #40460
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the more accurate default. If there is only one mip level, then the nearest mip index should be zero. I can't think of any other case where we'd need to have mip levels but always sample from zero. Makes me wonder why @bdero preferred trilinear filtering here https://github.com/flutter/engine/pull/40425/files though. So he may have additional context.
Ok, we should remove MipFilter::kNone altogether. It is not supported in Vulkan either. |
@@ -74,7 +67,7 @@ bool SamplerGLES::ConfigureBoundTexture(const TextureGLES& texture, | |||
gl.TexParameteri(target.value(), GL_TEXTURE_MIN_FILTER, | |||
ToParam(desc.min_filter, desc.mip_filter)); | |||
gl.TexParameteri(target.value(), GL_TEXTURE_MAG_FILTER, | |||
ToParam(desc.mag_filter, MipFilter::kNone)); | |||
ToParam(desc.mag_filter, MipFilter::kNearest)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chinmaygarde what is this supposed to be? This line seems sus before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was patched by @bdero in 4becf4942e8. Looking closer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why I changed this when landing the blit pass... This might be debugging leftovers. I'd try changing it back and seeing if Play/RendererTest.CanGenerateMipmaps/OpenGLES
is broken once this is addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reread this and realized kNone
is actually correct here because of #40460 (comment)
@@ -21,13 +21,6 @@ bool SamplerGLES::IsValid() const { | |||
|
|||
static GLint ToParam(MinMagFilter minmag_filter, MipFilter mip_filter) { | |||
switch (mip_filter) { | |||
case MipFilter::kNone: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think sampling with GL_[NEAREST|LINEAR]_MIPMAP_[NEAREST|LINEAR]
will fail in GLES if the mip count is 1, and either GL_NEAREST
or GL_LINEAR
needs to be set when this is the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please verify that this doesn't break the GLES playgrounds if landing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can retain this behavior for now without the enum variant. Make the mip_filter optional and treat nullopt as if it were none.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh yeah, got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The capture above is Play/DisplayListTest.CanDrawBackdropFilter/OpenGLES
, which was rendering nothing a couple of days ago on both M1 Mac and the Windows Nvidia driver prior to this fix: https://github.com/flutter/engine/pull/40425/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
… mip level and remove kNone (flutter/engine#40460)
By default we create mipmaps for every decoded image. Choosing the nearest mip level is the only reasonable default.